Chicken quality detection method and sorting equipment based on deep learning multi-source spectral fusion
By using a deep learning-based multi-source spectral fusion method, near-infrared and visible-near-infrared hyperspectral images are used to detect chicken quality. This solves the problem that existing technologies require specialized knowledge and damage sample integrity, and achieves non-destructive and efficient automated detection of chicken quality.
Patent Information
- Application Number
- CN202310149640.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-20
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-02-20
AI Technical Summary
In existing technologies, testing chicken quality using physical and chemical methods requires specialized knowledge and can damage sample integrity, making them unsuitable for large-scale testing.
A deep learning-based multi-source spectral fusion method is adopted. Near-infrared and visible-near-infrared hyperspectral images are input into the chicken quality detection model to extract and fuse feature images, obtain volatile basic nitrogen content and total bacterial count, and realize automated detection.
It enables non-destructive testing of chicken quality, improves testing efficiency, and is suitable for large-scale automated testing.
Smart Images

Figure CN116202978B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of chicken detection, in particular, to a chicken quality detection method based on deep learning multi-source spectrum fusion and a sorting device. BACKGROUND
[0002] Chicken is known as one of the most popular meats due to its rich protein content and good taste. However, due to the high water content in chicken, it is prone to deterioration.
[0003] In related technologies, the volatile base nitrogen content and the total number of colonies in chicken are usually detected based on physical and chemical methods, and then the freshness of chicken or whether the chicken is deteriorated is determined according to the volatile base nitrogen content and the total number of colonies. The above detection method not only requires high professional knowledge, but also destroys the integrity of the sample, thus being not conducive to detecting large-scale chicken samples. SUMMARY
[0004] The purpose of the present disclosure is to provide a chicken quality detection method based on deep learning multi-source spectrum fusion and a sorting device to solve the above technical problems.
[0005] To achieve the above purpose, the first aspect of the present disclosure provides a chicken quality detection method based on deep learning multi-source spectrum fusion, which comprises:
[0006] obtaining a near-infrared hyperspectral image and a visible-near-infrared hyperspectral image of chicken to be detected;
[0007] inputting the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image into a chicken quality detection model to obtain the volatile base nitrogen content and the total number of colonies of the chicken to be detected;
[0008] determining the quality of the chicken to be detected according to the volatile base nitrogen content and the total number of colonies;
[0009] wherein the chicken quality detection model is used to obtain the volatile base nitrogen content and the total number of colonies by the following operations:
[0010] extracting and fusing the features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image to obtain a colony fusion feature map, and obtaining the total number of colonies of the chicken to be detected according to the colony fusion feature map;
[0011] extracting and fusing the features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image to obtain a volatile base nitrogen fusion feature map, and obtaining the volatile base nitrogen content of the chicken to be detected according to the volatile base nitrogen fusion feature map.
[0012] Optionally, the feature extraction and fusion of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image obtain a colony fusion feature map, comprising:
[0013] At least one feature extraction and at least one dimension transformation are performed on the near-infrared hyperspectral image to obtain a first near-infrared hyperspectral feature map, and feature correction is performed on the first near-infrared hyperspectral feature map to obtain a first near-infrared hyperspectral channel attention feature map, and feature extraction is performed on the first near-infrared hyperspectral channel attention feature map to obtain a second near-infrared hyperspectral channel attention feature map;
[0014] At least one feature extraction and at least one dimension transformation are performed on the near-infrared hyperspectral image to obtain a first near-infrared hyperspectral feature map, and feature correction is performed on the first near-infrared hyperspectral feature map to obtain a first near-infrared hyperspectral channel attention feature map, and feature extraction is performed on the first near-infrared hyperspectral channel attention feature map to obtain a second near-infrared hyperspectral channel attention feature map;
[0015] The second near-infrared hyperspectral channel attention feature map and the second visible-near-infrared hyperspectral channel attention feature map are fused to obtain the colony fusion feature map.
[0016] Optionally, the feature correction on the first near-infrared hyperspectral feature map to obtain a first near-infrared hyperspectral channel attention feature map comprises:
[0017] The first near-infrared hyperspectral feature map is deformed to obtain a second near-infrared hyperspectral feature map, and attention weight extraction is performed on the first near-infrared hyperspectral feature map to obtain a channel attention weight matrix;
[0018] The product of the second near-infrared hyperspectral feature map, the channel attention weight matrix and a first preset channel coefficient is calculated, and the product is added to the first near-infrared hyperspectral feature map to obtain the first near-infrared hyperspectral channel attention feature map.
[0019] Optionally, the at least one feature extraction and at least one dimension transformation performed on the near-infrared hyperspectral image to obtain a first near-infrared hyperspectral feature map comprises:
[0020] At least one feature extraction is performed on the near-infrared hyperspectral image to obtain a first feature map;
[0021] The first feature map is sequentially subjected to dimension transformation, feature extraction and dimension transformation to obtain the first near-infrared hyperspectral feature map;
[0022] The at least one feature extraction on the near-infrared hyperspectral image obtains a first feature map, and the method comprises the following steps:
[0023] The near-infrared hyperspectral image is sequentially subjected to at least four times of feature extraction to obtain a first convolution feature map, and the first convolution feature map is subjected to four times of feature extraction in parallel to obtain a second convolution feature map, a third convolution feature map, a fourth convolution feature map and a fifth convolution feature map;
[0024] The third convolution feature map, the fourth convolution feature map and the fifth convolution feature map are subjected to feature extraction to obtain a sixth convolution feature map, a seventh convolution feature map and an eighth convolution feature map;
[0025] The second convolution feature map, the sixth convolution feature map, the seventh convolution feature map and the eighth convolution feature map are subjected to image splicing to obtain the first feature map.
[0026] Optionally, the second near-infrared hyperspectral channel attention feature map and the second visible-near-infrared hyperspectral channel attention feature map are fused to obtain the colony fusion feature map, and the method comprises the following steps:
[0027] The second near-infrared hyperspectral channel attention feature map is subjected to feature extraction to obtain a third near-infrared hyperspectral channel attention feature map, and the second visible-near-infrared hyperspectral channel attention feature map is subjected to feature extraction to obtain a third visible-near-infrared hyperspectral channel attention feature map;
[0028] The product of the third near-infrared hyperspectral channel attention feature map and the third visible-near-infrared hyperspectral channel attention feature map is calculated to obtain a first colony fusion feature map, and the first colony fusion feature map is subjected to feature extraction and feature correction to obtain a second colony fusion feature map;
[0029] The second colony fusion feature map is sequentially subjected to feature extraction and deformation processing to obtain a third colony fusion feature map, the second colony fusion feature map is subjected to attention weight extraction to obtain a spatial attention weight matrix, the product of the third colony fusion feature map, the spatial attention weight matrix and a preset spatial coefficient is calculated, and the product is added to the second colony fusion feature map to obtain the colony fusion feature map.
[0030] Optionally, the colony total number of the chicken to be detected is obtained according to the colony fusion feature map, and the method comprises the following steps:
[0031] The colony fusion feature map is subjected to feature extraction and at least one time of down-sampling to obtain an abstract feature of the colony fusion feature map;
[0032] The abstract features are integrated to obtain the total number of colonies of the chicken to be detected.
[0033] Optionally, the chicken quality detection model includes a total number of colonies detection sub-model and a volatile base nitrogen content detection sub-model, and the chicken quality detection model is used to obtain the volatile base nitrogen content and the total number of colonies by:
[0034] The features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image are extracted and fused by the total number of colonies detection sub-model to obtain a colony fusion feature map, and the total number of colonies of the chicken to be detected is obtained according to the colony fusion feature map;
[0035] The features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image are extracted and fused by the volatile base nitrogen content detection sub-model to obtain a volatile base nitrogen fusion feature map, and the volatile base nitrogen content of the chicken to be detected is obtained according to the volatile base nitrogen fusion feature map.
[0036] Optionally, the training process of the total number of colonies detection sub-model includes:
[0037] A plurality of groups of first sample pictures labeled with first labels are obtained, each group of first sample pictures including a near-infrared hyperspectral image and a visible-near-infrared hyperspectral image of chicken to be detected, and the first label is used to indicate a total number of colonies standard value generated according to the corresponding first sample picture;
[0038] The first sample picture is input into the total number of colonies detection sub-model to obtain a total number of colonies prediction value corresponding to the first sample picture, and a first loss function value is determined according to the total number of colonies prediction value and the total number of colonies standard value indicated by the first label;
[0039] The parameters of the total number of colonies detection sub-model are updated according to the first loss function value.
[0040] Optionally, the training process of the volatile base nitrogen content detection sub-model includes:
[0041] A plurality of groups of second sample pictures labeled with second labels are obtained, each group of second sample pictures including a near-infrared hyperspectral image and a visible-near-infrared hyperspectral image of chicken to be detected, and the second label is used to indicate a volatile base nitrogen content standard value generated according to the corresponding second sample picture;
[0042] inputting the second sample picture into the volatile base nitrogen content detection sub-model to obtain a volatile base nitrogen content prediction value corresponding to the second sample picture, and determining a second loss function value according to the volatile base nitrogen content prediction value and the volatile base nitrogen content standard value indicated by the second label;
[0043] updating parameters of the volatile base nitrogen content detection sub-model according to the second loss function value.
[0044] A second aspect of the present disclosure provides a chicken sorting device, the device comprising:
[0045] a conveying device for conveying chicken to be sorted;
[0046] a sorting device for sorting the chicken to be sorted;
[0047] a control device for performing the method according to any one of the first aspect to obtain the quality of the chicken to be sorted, and controlling the sorting device to sort the chicken to be sorted conveyed to a designated area of the conveying device to different areas according to the quality of the chicken to be sorted.
[0048] By the above technical solution, the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image of the chicken to be detected are input into the chicken quality detection model, the volatile base nitrogen content and the total number of colonies in the chicken to be detected can be obtained, and then the quality of the chicken can be determined according to the volatile base nitrogen content and the total number of colonies in the chicken to be detected. Therefore, when the chicken quality detection method provided by the present disclosure is used, the integrity of the chicken to be detected is not damaged, the detection process is simple, and the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image of the chicken to be detected are directly input into the chicken quality detection model, which effectively improves the detection efficiency of the chicken quality, and the detection process does not require human intervention and can be used in full-automatic and unmanned actual detection, which is beneficial to large-scale chicken sample detection.
[0049] Other features and advantages of the present disclosure will be described in detail in the following detailed description section. BRIEF DESCRIPTION OF DRAWINGS
[0050] The accompanying drawings are included to provide a further understanding of the present disclosure and constitute a part of the specification, and are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation on the present disclosure. In the drawings:
[0051] Figure 1 is a flowchart of a deep learning multi-source spectral fusion chicken quality detection method according to an exemplary embodiment of the present disclosure;
[0052] Figure 2is a structural schematic diagram of a convolutional layer group according to an exemplary embodiment of the present disclosure;
[0053] Figure 3 is a structural schematic diagram of another convolutional layer group according to an exemplary embodiment of the present disclosure;
[0054] Figure 4 is a structural schematic diagram of a colony total number detection sub-model according to an exemplary embodiment of the present disclosure;
[0055] Figure 5 is a structural schematic diagram of a feature extraction module according to an exemplary embodiment of the present disclosure;
[0056] Figure 6 is a structural schematic diagram of a feature fusion module according to an exemplary embodiment of the present disclosure;
[0057] Figure 7 is a structural schematic diagram of a processing module according to an exemplary embodiment of the present disclosure;
[0058] Figure 8 is a structural schematic diagram of a chicken sorting equipment according to an exemplary embodiment of the present disclosure;
[0059] Figure 9 is a structural schematic diagram of a conveying device according to an exemplary embodiment of the present disclosure;
[0060] Figure 10 is a structural schematic diagram of a control device according to an exemplary embodiment of the present disclosure;
[0061] Figure 11 is a structural schematic diagram of a control device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0062] Embodiments of the present disclosure will be described in more detail by referring to the drawings. Although certain embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein, but rather these embodiments are provided so as to more thoroughly and completely understand the present disclosure. It is understood that the drawings and embodiments of the present disclosure are for exemplary purposes only and are not intended to limit the scope of protection of the present disclosure.
[0063] It is understood that each step recited in the method embodiments of the present disclosure can be executed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the execution of the steps shown. The scope of the present disclosure is not limited in this respect.
[0064] As used herein, the term "includes" and its variants are open, non-limiting terms. The term "based on" means "based at least in part on." The term "one embodiment" means "at least one embodiment." The term "another embodiment" means "at least one additional embodiment." The term "some embodiments" means "at least some embodiments." Related terms have corresponding definitions.
[0065] It should be noted that the modification of "one", "a plurality of" mentioned in the present disclosure is illustrative but not restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more".
[0066] First, the application scenario of the present disclosure is described. Chicken is known as one of the most popular meats due to its high protein content and good taste. However, due to the high water content in chicken, it is prone to spoilage. In the related art, the volatile base nitrogen content and the total number of colonies in chicken are detected based on physical and chemical methods, and then the freshness of the chicken or whether the chicken is spoiled is determined according to the volatile base nitrogen content and the total number of colonies. The above detection method not only requires a high level of professional knowledge, but also destroys the integrity of the sample, so it is not conducive to detecting large-scale chicken samples.
[0067] In order to overcome the above technical problems, the related art proposes to combine data fusion strategies to explore the detection capabilities of two kinds of hyperspectral technology for multiple chicken quality. However, the current research is based on traditional methods to study the fusion effect of multiple hyperspectral data, that is, it is necessary to explore the combination of pre-processing and feature selection. Generally speaking, different combinations of pre-processing and feature selection methods will produce different modeling effects. However, to obtain the best combination, it is inevitable to need human intervention and judgment.
[0068] Specifically, the detection of chicken quality based on two kinds of hyperspectral technology in the related art mainly includes three main steps of data preprocessing, spectral feature selection and regression prediction.
[0069] In the data preprocessing process, due to the inherent fluctuations of the spectral instrument, external noise interference, human factors, the collected data often contains a large amount of interference information. Therefore, the data needs to be pre-processed, including noise reduction and normalization. General noise reduction algorithms include: moving average smoothing, Savitzky-Golay convolution smoothing. Normalization algorithms include: standard normal variable transformation, normalization and first-order differential transformation.
[0070] In the feature selection process, according to the algorithm, part of the spectral bands are selected as effective information, that is, feature band selection. The main methods include: PLS regression coefficient, competitive adaptive reweighted sampling, stepwise regression analysis, random frog, successive projections, backward interval partial least squares and principal component analysis.
[0071] In the regression analysis process, the selected feature bands are analyzed by using the algorithm to obtain the results, such as partial least squares and multiple linear regression.
[0072] In summary, the above methods mainly rely on manual selection and select features through human experience. Therefore, the above methods are prone to introduce artificial noise, resulting in inaccurate calculation results.
[0073] Therefore, the embodiment of the present disclosure provides a deep learning-based multi-source spectral fusion chicken quality detection method and sorting equipment. By inputting the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image of the chicken to be detected into the chicken quality detection model, the volatile nitrogen content and the total number of colonies in the chicken to be detected can be obtained, and then the quality of the chicken can be determined according to the volatile nitrogen content and the total number of colonies in the chicken to be detected. Compared with the physical or chemical detection method in the related art, the method provided in the embodiment of the present disclosure does not remove part of the chicken to be detected for quality detection, so the integrity of the chicken to be detected is not damaged. At the same time, compared with the chicken quality detection method based on two kinds of hyperspectral technology in the related art, the detection process of the method provided in the embodiment of the present disclosure is simple, and the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image of the chicken to be detected are directly input into the chicken quality detection model. Not only does it improve the detection efficiency of chicken quality, but also it can be used for full-automatic unmanned actual detection, which is conducive to the detection of large-scale chicken samples.
[0074] The embodiments of the present disclosure will be further explained and described below with reference to the accompanying drawings.
[0075] Figure 1 is a flowchart of a deep learning-based multi-source spectral fusion chicken quality detection method according to an exemplary embodiment of the present disclosure, referring to Figure 1 , the deep learning-based multi-source spectral fusion chicken quality detection method can include the following steps:
[0076] S101: Obtain the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image of the chicken to be detected.
[0077] S102: Input the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image into the chicken quality detection model to obtain the volatile nitrogen content and the total number of colonies of the chicken to be detected.
[0078] The chicken quality detection model is configured to obtain the total number of colonies and the volatile base nitrogen content of the chicken to be detected by the following operations:
[0079] The features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image are extracted and fused to obtain a colony fusion feature map, and the total number of colonies of the chicken to be detected is obtained according to the colony fusion feature map. The features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image are extracted and fused to obtain a volatile base nitrogen fusion feature map, and the volatile base nitrogen content of the chicken to be detected is obtained according to the volatile base nitrogen fusion feature map.
[0080] It should be understood that the chicken quality detection model can have the same or different ways to obtain the total number of colonies and the volatile base nitrogen content of the chicken to be detected according to the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image, and the present disclosure does not make any limitation in this regard.
[0081] In possible implementations, the chicken quality detection model has the same way to obtain the total number of colonies and the volatile base nitrogen content of the chicken to be detected according to the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image. In this case, the chicken quality detection model can include two sub-models having the same structure, one of which is configured to determine the total number of colonies of the chicken to be detected according to the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image of the chicken to be detected, and the other of which is configured to determine the volatile base nitrogen content of the chicken to be detected according to the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image of the chicken to be detected. In specific implementation, the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image of the chicken to be detected are input into the two sub-models respectively, so as to obtain the total number of colonies and the volatile base nitrogen content of the chicken to be detected. That is, according to one embodiment of the present disclosure, the chicken quality detection model can include a total number of colonies detection sub-model and a volatile base nitrogen content detection sub-model, and the chicken quality detection model is configured to obtain the total number of colonies and the volatile base nitrogen content of the chicken to be detected by the following operations:
[0082] The features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image are extracted and fused by the total number of colonies detection sub-model to obtain a colony fusion feature map, and the total number of colonies of the chicken to be detected is obtained according to the colony fusion feature map. The features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image are extracted and fused by the volatile base nitrogen content detection sub-model to obtain a volatile base nitrogen fusion feature map, and the volatile base nitrogen content of the chicken to be detected is obtained according to the volatile base nitrogen fusion feature map.
[0083] Since the total number of colonies detection sub-model and the volatile base nitrogen content detection sub-model have the same structure, the processing process of the visible-near infrared hyperspectral image and the near infrared hyperspectral image is also the same. Therefore, the processing process of the visible-near infrared hyperspectral image and the near infrared hyperspectral image will be described below by taking the total number of colonies detection sub-model as an example.
[0084] In possible embodiments, the extracting and fusing the features of the near infrared hyperspectral image and the visible-near infrared hyperspectral image to obtain the colony fusion feature map can include:
[0085] performing at least one feature extraction and at least one dimension transformation on the near infrared hyperspectral image to obtain a first near infrared hyperspectral feature map, performing feature correction on the first near infrared hyperspectral feature map to obtain a first near infrared hyperspectral channel attention feature map, and performing feature extraction on the first near infrared hyperspectral channel attention feature map to obtain a second near infrared hyperspectral channel attention feature map; performing at least one feature extraction and at least one dimension transformation on the visible-near infrared hyperspectral image to obtain a first visible-near infrared hyperspectral feature map, performing feature correction on the first visible-near infrared hyperspectral feature map to obtain a first visible-near infrared hyperspectral channel attention feature map, and performing feature extraction on the first visible-near infrared hyperspectral channel attention feature map to obtain a second visible-near infrared hyperspectral channel attention feature map; and fusing the second near infrared hyperspectral channel attention feature map and the second visible-near infrared hyperspectral channel attention feature map to obtain the colony fusion feature map.
[0086] It should be understood that the feature extraction on the near infrared hyperspectral image can be based on a single convolutional layer to perform convolution processing on the near infrared hyperspectral image, or can be based on a convolutional layer group (a convolutional layer group is composed of multiple convolutional layers) to perform multiple convolution processing on the near infrared hyperspectral image, and the embodiments of the present disclosure do not make any limitation thereon. In possible embodiments, the feature extraction on the near infrared hyperspectral image can be implemented based on a convolutional layer group.
[0087] As shown in Figure 2 schematically, the convolutional layer group can include 7 one-dimensional convolutional layers and a concatenation layer. Among them, the 7 one-dimensional convolutional layers can be divided into 4 groups, one group includes one one-dimensional convolutional layer with a convolution kernel size of 1, and the other three groups include two one-dimensional convolutional layers in series, and the convolution kernel size of each group is (3, 5), (5, 5) and (7, 5) respectively, and the output of each group of convolutional layers is connected with the input of the concatenation layer. When the convolutional layer group processes the near infrared hyperspectral image, the near infrared hyperspectral image is input in parallel to the four groups of convolutional layers for convolution processing to obtain four groups of features, and then the four groups of features are input to the concatenation layer for splicing to obtain the extracted feature map.
[0088] As shown schematically, Figure 3 The convolutional layer group can include four one-dimensional convolutional layers, and the four one-dimensional convolutional layers are sequentially connected. When the convolutional layer group processes the near-infrared hyperspectral image, the near-infrared hyperspectral image is sequentially input into the four one-dimensional convolutional layers for convolution processing to obtain the extracted feature map.
[0089] In possible implementations, the feature extraction on the near-infrared hyperspectral image can be implemented based on a single convolutional layer.
[0090] As shown schematically, the feature extraction on the near-infrared hyperspectral image can be implemented based on a two-dimensional convolutional layer. That is, when the convolutional layer processes the near-infrared hyperspectral image, the near-infrared hyperspectral image is input into the convolutional layer for convolution processing to obtain the extracted feature map.
[0091] Correspondingly, the at least one feature extraction on the near-infrared hyperspectral image can be implemented by a single convolutional layer, a plurality of convolutional layer groups, or a combination of a single convolutional layer and convolutional layer groups, and the present disclosure does not make any limitation in this regard.
[0092] In addition, it should be understood that, in the feature extraction process, the extracted features are not only related to the structure of the convolutional layer / convolutional layer group, but also related to the picture input into the convolutional layer / convolutional layer group. Therefore, in order to fully extract all the features in the near-infrared hyperspectral image, in possible implementations, the feature extraction on the near-infrared hyperspectral image can be performed first to obtain a feature map, then the dimension conversion is performed on the feature map to obtain a dimension-converted feature map, and then the feature extraction and the dimension restoration (i.e., the dimension conversion) are performed on the dimension-converted feature map to obtain a final feature map. That is, according to one embodiment of the present disclosure, the at least one feature extraction on the near-infrared hyperspectral image and the at least one dimension conversion to obtain the first near-infrared hyperspectral feature map can include:
[0093] The at least one feature extraction on the near-infrared hyperspectral image to obtain a first feature map, and the sequential dimension conversion, feature extraction, and dimension conversion on the first feature map to obtain the first near-infrared hyperspectral feature map, can include:
[0094] The near-infrared hyperspectral image is sequentially subjected to feature extraction for at least 4 times to obtain a first convolution feature map, and the first convolution feature map is subjected to feature extraction in parallel for 4 times to obtain a second convolution feature map, a third convolution feature map, a fourth convolution feature map and a fifth convolution feature map; the third convolution feature map, the fourth convolution feature map and the fifth convolution feature map are subjected to feature extraction to obtain a sixth convolution feature map, a seventh convolution feature map and an eighth convolution feature map; the second convolution feature map, the sixth convolution feature map, the seventh convolution feature map and the eighth convolution feature map are subjected to image stitching to obtain the first feature map.
[0095] It is worth noting that the feature extraction manner for the visible-near-infrared hyperspectral image is the same as the feature extraction manner for the near-infrared hyperspectral image, and therefore the feature extraction manner for the visible-near-infrared hyperspectral image can refer to the foregoing description of the feature extraction manner for the near-infrared hyperspectral image, and the embodiment of the present disclosure will not make a detailed elaboration.
[0096] It should be understood that the feature correction on the first near-infrared hyperspectral feature map to obtain the first near-infrared hyperspectral channel attention feature map can be realized based on a channel attention module, that is, the importance (weight) of each channel of the input image is calculated through the channel attention module, so as to determine which channels contain key information and which channels contain unimportant information according to the importance of each channel, and more attention is paid to the channels containing more key information, and less attention is paid to the channels containing little important information, so as to achieve the purpose of improving the feature representation capability. That is, the extracted features are corrected through the channel attention module to eliminate worthless features and retain valuable features.
[0097] Specifically, in possible implementation manners, the feature correction on the first near-infrared hyperspectral feature map to obtain the first near-infrared hyperspectral channel attention feature map can include:
[0098] The first near-infrared hyperspectral feature map is deformed to obtain a second near-infrared hyperspectral feature map, and attention weight extraction is performed on the first near-infrared hyperspectral feature map to obtain a channel attention weight matrix; the product of the second near-infrared hyperspectral feature map, the channel attention weight matrix and a first preset channel coefficient is calculated, and the product is added to the first near-infrared hyperspectral feature map to obtain the first near-infrared hyperspectral channel attention feature map.
[0099] The attention weight extraction on the first near-infrared hyperspectral feature map to obtain a channel attention weight matrix can include: sequentially performing matrix deformation and matrix transposition processing on the first near-infrared hyperspectral feature map to obtain a matrix D1; performing matrix deformation processing on the first near-infrared hyperspectral feature map to obtain a matrix D2, and sequentially performing matrix multiplication and exponential normalization processing on the matrix D1 and the matrix D2 to obtain the channel attention weight matrix.
[0100] It is worth noting that the feature correction manner for the visible-near-infrared hyperspectral image is the same as the feature correction manner for the near-infrared hyperspectral image, and thus the feature correction manner for the visible-near-infrared hyperspectral image can refer to the foregoing description of the feature correction manner for the near-infrared hyperspectral image, and the present disclosure will not make a detailed elaboration on this.
[0101] When the feature extraction is performed on the visible-near-infrared hyperspectral image and the near-infrared hyperspectral image by the foregoing method to obtain the second visible-near-infrared hyperspectral channel attention feature map and the second near-infrared hyperspectral channel attention feature map, the feature fusion processing can be performed on the second visible-near-infrared hyperspectral channel attention feature map and the second near-infrared hyperspectral channel attention feature map to obtain the colony fusion feature map.
[0102] In possible implementations, the fusion of the second near-infrared hyperspectral channel attention feature map and the second visible-near-infrared hyperspectral channel attention feature map to obtain the colony fusion feature map can include:
[0103] The feature extraction is performed on the second near-infrared hyperspectral channel attention feature map to obtain a third near-infrared hyperspectral channel attention feature map, and the feature extraction is performed on the second visible-near-infrared hyperspectral channel attention feature map to obtain a third visible-near-infrared hyperspectral channel attention feature map; the product of the third near-infrared hyperspectral channel attention feature map and the third visible-near-infrared hyperspectral channel attention feature map is calculated to obtain a first colony fusion feature map, and the feature extraction and the feature correction are performed on the first colony fusion feature map to obtain a second colony fusion feature map; the feature extraction and the deformation processing are sequentially performed on the second colony fusion feature map to obtain a third colony fusion feature map, the attention weight extraction is performed on the second colony fusion feature map to obtain a spatial attention weight matrix, and the product of the third colony fusion feature map, the spatial attention weight matrix, and a preset spatial coefficient is calculated, and the product is added to the second colony fusion feature map to obtain the colony fusion feature map.
[0104] The attention weight extraction is performed on the second colony fusion feature map to obtain a spatial attention weight matrix, which can include: inputting the second colony fusion feature map into two convolution layers respectively to obtain two matrices (feature maps), and denoted as matrix Q and matrix K respectively, performing matrix deformation and matrix transposition processing on the matrix Q to obtain matrix Q1; performing matrix deformation processing on the matrix K to obtain matrix K1; then performing matrix multiplication and exponential normalization processing on the matrix Q1 and the matrix K1 to obtain the spatial attention weight matrix.
[0105] According to one embodiment of the present disclosure, the obtaining of the total number of colonies of the chicken to be detected according to the colony fusion feature map can include:
[0106] The feature extraction and at least one down-sampling are performed on the colony fusion feature map to obtain abstract features of the colony fusion feature map; and the feature integration is performed on the abstract features to obtain the total number of colonies of the chicken to be detected.
[0107] It should be understood that the down-sampling of the colony fusion feature map can be implemented based on a max-pooling layer, an average-pooling layer, or a combination of the max-pooling layer and the average-pooling layer, and the embodiments of the present disclosure do not make any limitation in this regard. The feature extraction of the colony fusion feature map can be implemented based on a convolution layer, a group of convolution layers, or a combination of the convolution layer and the group of convolution layers, and the embodiments of the present disclosure do not make any limitation in this regard. The feature integration of the abstract features can be implemented based on a fully connected layer.
[0108] In a possible implementation, the feature extraction of the colony fusion feature map is performed based on a two-dimensional convolution layer; the down-sampling of the colony fusion feature map is performed based on a combination of a two-dimensional adaptive max-pooling layer and a two-dimensional adaptive average-pooling layer; and the feature integration of the colony fusion feature map is performed based on a fully connected layer. That is, according to one embodiment of the present disclosure, the colony fusion feature map sequentially passes through a two-dimensional adaptive max-pooling layer, a two-dimensional convolution layer, a two-dimensional adaptive max-pooling layer, a two-dimensional adaptive average-pooling layer, and a linear fully connected layer to obtain the total number of colonies of the chicken to be detected.
[0109] In summary, the total number of colonies detection sub-model can obtain the total number of colonies of the chicken to be detected by extracting and fusing the features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image.
[0110] Correspondingly, as an example, the total number of colonies detection sub-model can be as shown in FIG. 6. Figure 4As shown, the feature extraction module can include a feature extraction module, a feature fusion module, and a processing module. Among them, the feature extraction module is used to extract the features of the near-infrared hyperspectral image and the features of the visible-near-infrared hyperspectral image; the feature fusion module is used to fuse the features extracted by the feature extraction module to obtain a colony fusion feature map; the processing module is used to process the colony fusion feature map to obtain the total number of colonies of the chicken to be detected.
[0111] In possible embodiments, the feature extraction module can include a first convolutional layer group, a second convolutional layer group, a first dimension change layer, a first two-dimensional convolutional layer, a second dimension change layer, a first channel attention module, and a second two-dimensional convolutional layer connected in sequence; when the near-infrared hyperspectral image or the visible-near-infrared hyperspectral image is input into the feature extraction module, the near-infrared hyperspectral image or the visible-near-infrared hyperspectral image is processed in sequence by the first convolutional layer group, the second convolutional layer group, the first dimension change layer, the first two-dimensional convolutional layer, the second dimension change layer, the first channel attention module, and the second two-dimensional convolutional layer, to obtain a second near-infrared hyperspectral channel attention feature map or a second visible-near-infrared hyperspectral channel attention feature map. Figure 5
[0112] Among them, the first convolutional layer group can include four one-dimensional convolutional layers, and the four one-dimensional convolutional layers are connected in sequence. When the near-infrared hyperspectral image or the visible-near-infrared hyperspectral image is input into the convolutional layer group, the near-infrared hyperspectral image or the visible-near-infrared hyperspectral image is convolved by the four one-dimensional convolutional layers in sequence to obtain the first convolutional feature map of the near-infrared hyperspectral image or the visible-near-infrared hyperspectral image. The second convolutional layer group can include seven one-dimensional convolutional layers and a splicing layer. Among them, the seven one-dimensional convolutional layers can be divided into four groups, one group including one one-dimensional convolutional layer with a convolution kernel size of 1, and the other three groups including two one-dimensional convolutional layers connected in series, and the convolution kernel sizes of each group are (3, 5), (5, 5), and (7, 5), respectively, and the outputs of each group of convolutional layers are connected with the input of the splicing layer. When the first convolutional feature map of the near-infrared hyperspectral image or the visible-near-infrared hyperspectral image is input into the second convolutional layer, the first convolutional feature map is input into the four groups of convolutional layers for convolution processing to obtain four groups of features, and then the four groups of features are input into the splicing layer for splicing, and finally the first feature map of the near-infrared hyperspectral image or the visible-near-infrared hyperspectral image is output.
[0113] In possible embodiments, the feature fusion module can include a first two-dimensional convolutional layer, a second two-dimensional convolutional layer, a first dimension change layer, a second dimension change layer, a first channel attention module, and a second channel attention module connected in sequence. Figure 6 As shown, the feature fusion module can include, in series, a first two-dimensional convolutional layer, a first two-dimensional adaptive max-pooling layer, a first two-dimensional adaptive average-pooling layer, a first linear fully connected layer, a second two-dimensional convolutional layer, a second two-dimensional adaptive max-pooling layer, a second two-dimensional adaptive average-pooling layer, and a second linear fully connected layer. When the first near-infrared hyperspectral channel attention feature map and the first visible-near-infrared hyperspectral channel attention feature map are input into the feature fusion module, the first near-infrared hyperspectral channel attention feature map and the first visible-near-infrared hyperspectral channel attention feature map are processed by the first two-dimensional convolutional layer, the first two-dimensional adaptive max-pooling layer, the first two-dimensional adaptive average-pooling layer, the first linear fully connected layer, the second two-dimensional convolutional layer, the second two-dimensional adaptive max-pooling layer, the second two-dimensional adaptive average-pooling layer, and the second linear fully connected layer in series, and then the colony fusion feature map is output.
[0114] In possible implementations, the processing module can include, in series, a first two-dimensional adaptive max-pooling layer, a first two-dimensional convolutional layer, a first two-dimensional adaptive max-pooling layer, a first two-dimensional adaptive average-pooling layer, and a first linear fully connected layer. Figure 7 As shown, the feature fusion module can include, in series, a first two-dimensional convolutional layer, a first two-dimensional adaptive max-pooling layer, a first two-dimensional adaptive average-pooling layer, a first linear fully connected layer, a second two-dimensional convolutional layer, a second two-dimensional adaptive max-pooling layer, a second two-dimensional adaptive average-pooling layer, and a second linear fully connected layer. When the first near-infrared hyperspectral channel attention feature map and the first visible-near-infrared hyperspectral channel attention feature map are input into the feature fusion module, the first near-infrared hyperspectral channel attention feature map and the first visible-near-infrared hyperspectral channel attention feature map are processed by the first two-dimensional convolutional layer, the first two-dimensional adaptive max-pooling layer, the first two-dimensional adaptive average-pooling layer, the first linear fully connected layer, the second two-dimensional convolutional layer, the second two-dimensional adaptive max-pooling layer, the second two-dimensional adaptive average-pooling layer, and the second linear fully connected layer in series, and then the colony fusion feature map is output.
[0115] After the network structure of the colony total number detection sub-model and the volatile basic nitrogen content detection sub-model is determined, in order to enable the colony total number detection sub-model to obtain the colony total number of the chicken to be detected according to the input near-infrared hyperspectral image and visible-near-infrared hyperspectral image, and enable the volatile basic nitrogen content detection sub-model to obtain the volatile basic nitrogen content of the chicken to be detected according to the input near-infrared hyperspectral image and visible-near-infrared hyperspectral image, the colony total number detection sub-model and the volatile basic nitrogen content detection sub-model also need to be trained respectively, so as to obtain the best parameters of the colony total number detection sub-model and the volatile basic nitrogen content detection sub-model through continuous iterative training, so that the colony total number detection sub-model can obtain the colony total number of the chicken to be detected according to the input near-infrared hyperspectral image and visible-near-infrared hyperspectral image, and the volatile basic nitrogen content detection sub-model can obtain the volatile basic nitrogen content of the chicken to be detected according to the input near-infrared hyperspectral image and visible-near-infrared hyperspectral image.
[0116] In possible implementations, the training process of the colony total number detection sub-model can include:
[0117] S101: obtaining a plurality of groups of first sample pictures labeled with first labels, each group of first sample pictures comprising a near-infrared hyperspectral image and a visible-near-infrared hyperspectral image of chicken to be detected, and the first label being used to indicate a colony count standard value generated according to the corresponding first sample picture; inputting the first sample picture into the colony count detection sub-model to obtain a colony count prediction value corresponding to the first sample picture, and determining a first loss function value according to the colony count prediction value and the colony count standard value indicated by the first label; updating parameters of the colony count detection sub-model according to the first loss function value.
[0118] In possible implementation manners, the training process of the volatile base nitrogen content detection sub-model can comprise:
[0119] S101: obtaining a plurality of groups of first sample pictures labeled with first labels, each group of first sample pictures comprising a near-infrared hyperspectral image and a visible-near-infrared hyperspectral image of chicken to be detected, and the first label being used to indicate a colony count standard value generated according to the corresponding first sample picture; inputting the first sample picture into the colony count detection sub-model to obtain a colony count prediction value corresponding to the first sample picture, and determining a first loss function value according to the colony count prediction value and the colony count standard value indicated by the first label; updating parameters of the colony count detection sub-model according to the first loss function value.
[0120] S103: determining the quality of the chicken to be detected according to the volatile base nitrogen content and the colony count.
[0121] In possible implementation manners, a correspondence between the volatile base nitrogen content, the colony count and the quality of chicken can be preset, and when the volatile base nitrogen content and the colony count are obtained, the quality of the chicken is determined according to the correspondence. For example, the quality of chicken comprises a first quality, a second quality and a third quality, and the volatile base nitrogen content corresponding to the first quality ranges from [A1, A2), and the colony count corresponding to the first quality ranges from [B1, B2); the volatile base nitrogen content corresponding to the second quality ranges from [A2, A3), and the colony count corresponding to the second quality ranges from [B2, B3); the volatile base nitrogen content corresponding to the first quality ranges from [A3, A4), and the colony count corresponding to the first quality ranges from [B3, B4). When the value of the volatile base nitrogen content is located in the volatile base nitrogen content range [A2, A3) corresponding to the second quality, and the value of the colony count is located in the colony count range [B2, B3) corresponding to the second quality, it is considered that the quality of the chicken to be detected is the second quality.
[0122] In order to verify the feasibility of the scheme provided by the present disclosure, the total number of colonies and the volatile base nitrogen content are predicted by using the traditional method and the method provided by the present scheme. The comparison results of the prediction effect of volatile base nitrogen based on the traditional method and different strategies are shown in Table 1. The larger the determination coefficient and the smaller the root mean square error, the better the prediction effect of volatile base nitrogen.
[0123] Table 1 Comparison of prediction effect of volatile base nitrogen by traditional method and different strategies
[0124]
[0125] From Table 1, it can be seen that the prediction effect of the method provided by the present embodiment is the best for predicting the volatile base nitrogen content. Especially when using the data without processing for prediction, the optimal result can be obtained. It shows that the method provided by the present embodiment can be effectively applied to full-automatic unmanned actual detection.
[0126] The comparison results of the prediction effect of the total number of colonies based on the traditional method and different strategies are shown in Table 2. The larger the determination coefficient and the smaller the root mean square error, the better the prediction effect of the total number of colonies.
[0127] Table 2 Comparison of prediction effect of total number of colonies by traditional method and different strategies
[0128]
[0129] From Table 2, it can be seen that the prediction effect of the method provided by the present embodiment is the best for predicting the total number of colonies. Especially when using the data without processing for prediction, the optimal result can be obtained. It shows that the method provided by the present embodiment can be effectively applied to full-automatic unmanned actual detection.
[0130] In summary, by inputting the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image of the chicken to be detected into the chicken quality detection model, the volatile base nitrogen content and the total number of colonies in the chicken to be detected can be obtained, and then the quality of the chicken can be determined according to the volatile base nitrogen content and the total number of colonies in the chicken to be detected. Compared with the physical or chemical detection method in the related art, the method provided by the present embodiment does not cut part of the chicken to be detected for quality detection, so the integrity of the chicken to be detected is not damaged. At the same time, compared with the chicken quality detection method based on two kinds of hyperspectral technology in the related art, the detection process of the method provided by the present embodiment is simple, and the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image of the chicken to be detected are directly input into the chicken quality detection model. Not only the detection efficiency of the chicken quality is improved, but also the method can be applied to full-automatic unmanned actual detection, which is conducive to the detection of large-scale chicken samples.
[0131] Based on the same concept, the embodiments of the present disclosure also provide a chicken sorting device, as shown in Figure 8 The device can include:
[0132] A conveying device for conveying the chicken to be sorted.
[0133] The conveying device can be any device that can move the chicken to be detected, and the embodiments of the present disclosure do not make any restrictions thereon. In possible implementations, the conveying device can include a conveying roller 3, a conveying belt 6, a servo motor 2, and a base 4, as shown in Figure 8 and Figure 9 The conveying roller 3 is arranged at intervals on the base and is rotationally connected to the base 4. The conveying belt 6 covers the surface of the conveying roller 3 and moves forward under the driving of the conveying roller 3. The servo motor 2 is drivingly connected to the conveying roller 3 to provide driving force for the rotation of the conveying roller 3.
[0134] When the chicken to be sorted is placed on the conveying belt 6, the chicken to be sorted moves forward with the conveying belt 6.
[0135] A sorting device for sorting the chicken to be sorted.
[0136] In possible implementations, the sorting device can include a conveying structure, a push plate 7, a support 8, a guide plate 5, and a sensor, as shown in Figure 8 and Figure 9 The conveying structure can be the conveying device described above. The support 8 is arranged at intervals on the left and right sides of the conveying device. The push plate 7 is rotationally connected to the support 8 and is electrically connected to the control device. The push plate 7 is used to sort the chicken to be sorted to a designated area under the control of the control device. The guide plate 5 is arranged on the left and right sides of the conveying device and is used to guide the chicken to fall into the preset area. The sensor is arranged on the push plate 7 and is electrically connected to the control device. The sensor is used to detect whether the chicken to be sorted is transported to the designated area.
[0137] When a push plate 7 at a certain position receives a control instruction from the control device, the push plate 7 changes its state from state 1 (the axis of the push plate 7 is parallel to the movement direction of the conveying device) to state 2 (the axis of the push plate 7 is perpendicular to the movement direction of the conveying device) according to the control instruction. When the sensor detects that the chicken to be sorted is transported to the designated area, the control device controls the state of the push plate 7 to change from state 2 to state 1, so as to push the chicken to be sorted away from the conveying belt 6 and fall into the preset area through the guide plate 5.
[0138] It is worth noting that the sensor for detecting whether the chicken to be sorted is transported to the designated area can be a pressure sensor or a distance sensor, and the specific configuration can be set according to the actual situation, and the embodiments of the present disclosure do not make any restrictions thereon.
[0139] A control device is configured to execute the deep learning-based multi-source spectral fusion chicken quality detection method to obtain the quality of the chicken to be sorted, and control the sorting device to sort the chicken to be sorted into different regions according to the quality of the chicken to be sorted.
[0140] In possible embodiments, the control device comprises a spectrometer detection dark box 1, as shown in the drawings. Figures 8-11 The outer surface of the spectrometer detection dark box 1 is provided with a spectrometer outer connecting panel 11, and the spectrometer outer connecting panel 11 is provided with a control interface for use of a spectrometer main body 13. The bottom of the spectrometer outer connecting panel 11 is provided with a passage 12 for the chicken to be sorted to pass through, and the upper portion of the passage 12 is provided with an image acquisition device, an illumination device, the spectrometer main body 13 and a controller. The illumination device is used to illuminate the chicken to be sorted passing through the passage 12. The spectrometer main body 13 is used to acquire near-infrared hyperspectral images and visible-near-infrared hyperspectral images of the chicken to be sorted. The controller is used to analyze the acquired near-infrared hyperspectral images and visible-near-infrared hyperspectral images, obtain the quality of the chicken to be sorted, and generate relevant control commands.
[0141] In possible embodiments, the spectrometer main body 13 can comprise a near-infrared hyperspectral scanner 14 and a visible-near-infrared hyperspectral scanner 15. The near-infrared hyperspectral scanner 14 is used to acquire near-infrared hyperspectral images of the chicken to be sorted. The visible-near-infrared hyperspectral scanner 15 is used to acquire visible-near-infrared hyperspectral images of the chicken to be sorted.
[0142] The illumination device can comprise a plurality of full-spectrum lamps, and each full-spectrum lamp comprises a lamp holder 16, a lamp holder 17 and a bulb 18. The top of the lamp holder 16 is arranged at the bottom of the spectrometer main body 13. The bottom of the lamp holder 16 is connected to the top of the lamp holder 17. The bottom of the lamp holder 17 is connected to the bulb 18.
[0143] In possible embodiments, the plurality of full-spectrum lamps are arranged circumferentially at the bottom of the spectrometer main body 13, and are used to provide 360° annular light for the chicken to be detected, so that the image acquisition device can acquire better near-infrared hyperspectral images and visible-near-infrared hyperspectral images.
[0144] When the sorting device is used to sort the chicken to be sorted, the chicken to be sorted is placed on the conveying belt 6, so that the chicken to be sorted moves along with the conveying belt 6 to the spectral detection dark box 1 to complete the collection of spectral data (near-infrared hyperspectral images and visible-near-infrared hyperspectral images); after the spectral data collection is completed, the processor processes and analyzes the spectral data to obtain the quality of the chicken to be sorted, and the processor generates a sorting instruction according to the quality of the chicken to be sorted and transmits the sorting instruction to the specified position of the dial plate 7; when the sensor on the dial plate 7 detects that the chicken to be sorted reaches the specified position, the chicken is sorted to the specified position.
[0145] In possible embodiments, in order to ensure that the spectrometer body 13 can collect complete and clear visible-near-infrared hyperspectral images and near-infrared hyperspectral images, when the chicken to be sorted moves to the specified position in the spectral detection dark box 1, the chicken to be sorted stops moving for a period of time before moving again, so as to avoid the situation that the visible-near-infrared hyperspectral images and the near-infrared hyperspectral images collected by the spectrometer body 13 are unclear due to the movement of the chicken to be sorted during the collection of the visible-near-infrared hyperspectral images and the near-infrared hyperspectral images.
[0146] In the above, determining whether the chicken to be sorted moves to the specified position in the spectral detection dark box 1 can be determined by setting a distance sensor in the spectral detection dark box 1 to determine whether the chicken to be sorted moves to the specified position, can also be determined by image recognition technology, and can also be realized by controlling the movement time, movement speed, placement position and placement time of the conveying belt, and the embodiments of the present disclosure do not make any limitation on this.
[0147] In summary, through the above sorting device, when the chicken is sorted according to the quality of the chicken, the quality of the chicken to be sorted can be automatically obtained by the control device, and the chicken to be sorted is sorted to the specified area according to the quality of the chicken to be sorted. The whole sorting process can be completed without human intervention, which not only improves the efficiency of sorting, but also avoids the inaccuracy of manual sorting and improves the quality of sorting.
[0148] The preferred embodiments of the present disclosure are described in detail above in combination with the drawings, but the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
[0149] In addition, it should be noted that each specific technical feature described in the above specific embodiments can be combined in any appropriate manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0150] Furthermore, various embodiments of the present disclosure can be arbitrarily combined with each other, as long as the idea of the present disclosure is not violated, and it should be considered as disclosed in the present disclosure.
Claims
1. A deep learning-based multi-source spectral fusion chicken quality detection method, characterized in that, The method comprises: obtaining a near-infrared hyperspectral image and a visible-near-infrared hyperspectral image of the chicken to be detected; inputting the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image into a chicken quality detection model to obtain the volatile base nitrogen content and the total number of colonies of the chicken to be detected; determining the quality of the chicken to be detected according to the volatile base nitrogen content and the total number of colonies; wherein the chicken quality detection model is used to obtain the volatile base nitrogen content and the total number of colonies by: performing at least one feature extraction and at least one dimension transformation on the near-infrared hyperspectral image to obtain a first near-infrared hyperspectral feature map, performing feature correction on the first near-infrared hyperspectral feature map to obtain a first near-infrared hyperspectral channel attention feature map, and performing feature extraction on the first near-infrared hyperspectral channel attention feature map to obtain a second near-infrared hyperspectral channel attention feature map; performing at least one feature extraction and at least one dimension transformation on the visible-near-infrared hyperspectral image to obtain a first visible-near-infrared hyperspectral feature map, performing feature correction on the first visible-near-infrared hyperspectral feature map to obtain a first visible-near-infrared hyperspectral channel attention feature map, and performing feature extraction on the first visible-near-infrared hyperspectral channel attention feature map to obtain a second visible-near-infrared hyperspectral channel attention feature map; fusing the second near-infrared hyperspectral channel attention feature map and the second visible-near-infrared hyperspectral channel attention feature map to obtain a colony fusion feature map, and obtaining the total number of colonies of the chicken to be detected according to the colony fusion feature map; extracting and fusing the features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image to obtain a volatile base nitrogen fusion feature map, and obtaining the volatile base nitrogen content of the chicken to be detected according to the volatile base nitrogen fusion feature map.
2. The method of claim 1, wherein, The feature correction on the first near-infrared hyperspectral feature map to obtain a first near-infrared hyperspectral channel attention feature map comprises: deforming the first near-infrared hyperspectral feature map to obtain a second near-infrared hyperspectral feature map, and extracting attention weight from the first near-infrared hyperspectral feature map to obtain a channel attention weight matrix; calculating the product of the second near-infrared hyperspectral feature map, the channel attention weight matrix and a first preset channel coefficient, and adding the product to the first near-infrared hyperspectral feature map to obtain the first near-infrared hyperspectral channel attention feature map.
3. The method of claim 1, wherein, The at least one feature extraction and at least one dimension transformation on the near-infrared hyperspectral image to obtain a first near-infrared hyperspectral feature map comprises: performing at least one feature extraction on the near-infrared hyperspectral image to obtain a first feature map; performing dimension transformation, feature extraction and dimension transformation on the first feature map in sequence to obtain the first near-infrared hyperspectral feature map; wherein the at least one feature extraction on the near-infrared hyperspectral image to obtain a first feature map comprises: The near-infrared hyperspectral image is sequentially subjected to feature extraction for at least 4 times to obtain a first convolution feature map, and the first convolution feature map is subjected to feature extraction for 4 times in parallel to obtain a second convolution feature map, a third convolution feature map, a fourth convolution feature map and a fifth convolution feature map; The third convolution feature map, the fourth convolution feature map and the fifth convolution feature map are subjected to feature extraction to obtain a sixth convolution feature map, a seventh convolution feature map and an eighth convolution feature map; The second convolution feature map, the sixth convolution feature map, the seventh convolution feature map and the eighth convolution feature map are subjected to image stitching to obtain the first feature map.
4. The method of claim 1, wherein, The second near-infrared hyperspectral channel attention feature map and the second visible-near-infrared hyperspectral channel attention feature map are fused to obtain the colony fusion feature map, including: The second near-infrared hyperspectral channel attention feature map is subjected to feature extraction to obtain a third near-infrared hyperspectral channel attention feature map, and the second visible-near-infrared hyperspectral channel attention feature map is subjected to feature extraction to obtain a third visible-near-infrared hyperspectral channel attention feature map; The product of the third near-infrared hyperspectral channel attention feature map and the third visible-near-infrared hyperspectral channel attention feature map is calculated to obtain a first colony fusion feature map, and the first colony fusion feature map is subjected to feature extraction and feature correction to obtain a second colony fusion feature map; The second colony fusion feature map is sequentially subjected to feature extraction and deformation processing to obtain a third colony fusion feature map, the second colony fusion feature map is subjected to attention weight extraction to obtain a spatial attention weight matrix, and the product of the third colony fusion feature map, the spatial attention weight matrix and a preset spatial coefficient is calculated, and the product is added to the second colony fusion feature map to obtain the colony fusion feature map.
5. The method according to any one of claims 1-4, characterized in that, The colony total number of the chicken to be detected is obtained according to the colony fusion feature map, including: The colony fusion feature map is subjected to feature extraction and at least one down-sampling to obtain an abstract feature of the colony fusion feature map; The abstract feature is subjected to feature integration to obtain the colony total number of the chicken to be detected.
6. The method of claim 1, wherein, The chicken quality detection model includes a colony total number detection sub-model and a volatile base nitrogen content detection sub-model, and the chicken quality detection model is used to obtain the volatile base nitrogen content and the colony total number by the following operations: Features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image are extracted and fused by the colony total number detection sub-model to obtain a colony fusion feature map, and the colony total number of the chicken to be detected is obtained according to the colony fusion feature map; Features of the near-infrared hyperspectral image and the visible-near-infrared hyperspectral image are extracted and fused by the volatile base nitrogen content detection sub-model to obtain a volatile base nitrogen fusion feature map, and the volatile base nitrogen content of the chicken to be detected is obtained according to the volatile base nitrogen fusion feature map.
7. The method of claim 6, wherein, The training process of the colony total number detection sub-model includes: A plurality of groups of first sample pictures labeled with first labels are obtained, each group of first sample pictures including a near-infrared hyperspectral image and a visible-near-infrared hyperspectral image of chicken to be detected, and the first label is used to indicate a colony total number standard value generated according to the corresponding first sample picture; The first sample picture is input into the colony total number detection sub-model to obtain a colony total number prediction value corresponding to the first sample picture, and a first loss function value is determined according to the colony total number prediction value and the colony total number standard value indicated by the first label; The parameters of the colony total number detection sub-model are updated according to the first loss function value.
8. The method of claim 6, wherein, The training process of the volatile base nitrogen content detection sub-model includes: A plurality of groups of second sample pictures labeled with second labels are obtained, each group of second sample pictures including a near-infrared hyperspectral image and a visible-near-infrared hyperspectral image of chicken to be detected, and the second label is used to indicate a volatile base nitrogen content standard value generated according to the corresponding second sample picture; The second sample picture is input into the volatile base nitrogen content detection sub-model to obtain a volatile base nitrogen content prediction value corresponding to the second sample picture, and a second loss function value is determined according to the volatile base nitrogen content prediction value and the volatile base nitrogen content standard value indicated by the second label; The parameters of the volatile base nitrogen content detection sub-model are updated according to the second loss function value.
9. A chicken picking apparatus, characterised in that, The device includes: A conveying device for conveying chicken to be sorted; A sorting device for sorting the chicken to be sorted; A control device for executing the method according to any one of claims 1-8 to obtain the quality of the chicken to be sorted, and controlling the sorting device to sort the chicken to be sorted conveyed to a specified area of the conveying device to different areas according to the quality of the chicken to be sorted.
Citation Information
Patent Citations
Meat product freshness detection method based on multisource perceptual information fusion
CN103278609A
Detection method for quality grade of sausage
CN105866063A