CN115839923A - Intelligent food detection system and method thereof - Google Patents

Intelligent food detection system and method thereof Download PDF

Info

Publication number
CN115839923A
CN115839923A CN202211624870.7A CN202211624870A CN115839923A CN 115839923 A CN115839923 A CN 115839923A CN 202211624870 A CN202211624870 A CN 202211624870A CN 115839923 A CN115839923 A CN 115839923A
Authority
CN
China
Prior art keywords
map
feature
feature map
mutton
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211624870.7A
Other languages
Chinese (zh)
Inventor
苏媛媛
姜雪
仓义鹏
郭慧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
PRODUCT QUALITY SUPERVISING AND INSPECTING INSTITUTE OF SUQIAN CITY
Original Assignee
PRODUCT QUALITY SUPERVISING AND INSPECTING INSTITUTE OF SUQIAN CITY
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by PRODUCT QUALITY SUPERVISING AND INSPECTING INSTITUTE OF SUQIAN CITY filed Critical PRODUCT QUALITY SUPERVISING AND INSPECTING INSTITUTE OF SUQIAN CITY
Priority to CN202211624870.7A priority Critical patent/CN115839923A/en
Publication of CN115839923A publication Critical patent/CN115839923A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Analysis (AREA)
  • Investigating Or Analysing Materials By Optical Means (AREA)

Abstract

The application discloses an intelligent food detection system and a method thereof, which combine artificial intelligence and hyperspectral imaging technology to construct an intelligent food detection scheme for detecting water-injected mutton. Specifically, firstly, an image of a hyperspectral cube map of mutton to be detected is denoised to remove external factor interference, and multi-scale associated feature information among spectral features under different wavelengths in the hyperspectral cube map after denoising, namely multi-scale associated features of spatial implicit features of mutton under different sections, is extracted, so that mutton detection and judgment are performed. Thus, whether the mutton is water-injected mutton is accurately detected.

Description

Intelligent food detection system and method thereof
Technical Field
The present application relates to the field of food detection technology, and more particularly, to an intelligent food detection system and method.
Background
Mutton is one of main meats eaten by people in China, and the consumption is on the rise year by year. Lambs are much fresher than beef, and have less fat and cholesterol than pork and beef, and are easily digested and absorbed. Eating more mutton is helpful for improving the immune function of human body, and the mutton is very delicious and tasty. In recent years, mutton is gradually the mainstream of fresh meat consumption in China, and people put forward higher requirements on the quality of mutton. Moisture occupies the most important position in the components of mutton, and the moisture, protein and fat together account for more than 93 percent of the mutton by mass. The moisture content directly influences the taste and quality of meat products, and the moisture content is not only an important nutrition and sanitation index of meat, but also an important parameter for identifying adulterated mutton.
Currently, as the demand of people for meat products increases, the requirements for the quality of meat products are gradually increasing. In order to gain violence, some meat product production operators began mass production and sale of water-infused meat, which severely degraded the quality of the meat product and threatened the health of the consumer. Water flooding meat is a process by which the weight of the meat is increased by a specific method. The water injection method is to inject water into the stomach of the livestock through a water pipe before slaughtering or inject water into the fresh meat after slaughtering. If the water content of the mutton is more than 76 percent, the mutton can be judged to be water-injected mutton. In order to inject more water into raw meat, a certain amount of colloid powder is added into water by an operator, and once the water-injected meat is eaten by a consumer, the phenomena of breathing difficulty, food poisoning and the like can occur. When the water content of meat is excessive, cell structure is destroyed, the nutrient elements such as protein and vitamins contained in meat are greatly reduced, and viral microorganisms invade meat. In view of the aggravation of the phenomenon of water-infused mutton on the market, the detection of water-infused mutton becomes particularly important.
However, most of the existing detection schemes for detecting whether mutton is injected with water rely on naked eyes to observe the color and quality of mutton, so that the mutton injected with water is difficult to distinguish from normal mutton, and the change of the mutton due to environmental factors can be caused when the mutton is placed in an external environment for a long time, which can reduce the detection accuracy of the mutton injected with water.
Therefore, an optimized intelligent food detection system is expected, which can accurately detect whether mutton is water-injected mutton so as to ensure the food quality and eating health of mutton.
Disclosure of Invention
The present application is proposed to solve the above-mentioned technical problems. The embodiment of the application provides an intelligent food detection system and method, which combine artificial intelligence and hyperspectral imaging technology to construct an intelligent food detection scheme for detecting water-injected mutton. Specifically, image denoising of a hyperspectral cube map of mutton is carried out to remove external factor interference, multi-scale correlation characteristic information among spectral characteristics under different wavelengths in the cube map after denoising, namely multi-scale correlation characteristics of spatial implicit characteristics of mutton under different sections, is extracted, and detection and judgment of the mutton are carried out according to the multi-scale correlation characteristics. Thus, whether the mutton is water-injected mutton is accurately detected.
Accordingly, according to one aspect of the present application, there is provided a smart food detection system comprising:
the hyperspectral data acquisition module is used for acquiring a hyperspectral cube map of mutton to be detected, and the hyperspectral cube map comprises spectral images under a plurality of wavelengths;
the noise reduction module is used for enabling the hyperspectral cube map to pass through an image noise reducer based on an automatic coder-decoder to obtain a generated hyperspectral cube map;
the spatial attention coding module is used for enabling the spectral images under the wavelengths in the generated spectral image under the multiple wavelengths in the hyperspectral cube map to pass through a first convolution neural network model using a spatial attention mechanism so as to obtain multiple image feature matrixes;
the three-dimensional arrangement module is used for arranging the image feature matrixes into a three-dimensional feature tensor along a channel dimension;
a multi-scale associated feature extraction module, configured to pass the three-dimensional feature tensor through a dual-flow network model including a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map, where the second convolutional neural network uses a three-dimensional convolution kernel with a first scale, and the third convolutional neural network uses a three-dimensional convolution kernel with a second scale;
the characteristic correction module is used for respectively carrying out relative angle probability information representation correction on the first characteristic diagram and the second characteristic diagram to obtain a first corrected characteristic diagram and a second corrected characteristic diagram;
the feature fusion module is used for fusing the first correction feature map and the second correction feature map to obtain a multi-scale associated feature map; and
and the detection result generation module is used for taking the multi-scale associated characteristic diagram as a classification characteristic diagram and passing the classification characteristic diagram through a classifier to obtain a classification result, and the classification result is used for indicating whether the mutton to be detected is water-injected mutton or not.
In the above-mentioned intelligent food detection system, the noise reduction module includes: the encoding unit is used for inputting the hyperspectral cube map into an encoder of the image noise reducer, wherein the encoder uses a convolutional layer to perform explicit spatial encoding on the hyperspectral cube map so as to obtain hyperspectral cube map image features; and the decoding unit is used for inputting the hyperspectral cube map image features into a decoder of the image noise reducer, wherein the decoder performs deconvolution processing on the hyperspectral cube map image features by using a deconvolution layer to obtain the generated hyperspectral cube map.
In the above intelligent food detection system, the spatial attention coding module is further configured to: depth convolution coding is carried out on the spectral image by using a convolution coding part of the first convolution neural network model so as to obtain an initial convolution characteristic map; inputting the initial convolution feature map into a spatial attention portion of the first convolutional neural network model to obtain a spatial attention map; passing the spatial attention map through a Softmax activation function to obtain a spatial attention feature map; calculating the multiplication of the spatial attention feature map and the initial convolution feature map according to position points to obtain an image feature map; and carrying out global mean pooling along the channel dimension on the image feature map to obtain the image feature matrix.
In the above intelligent food detection system, the multi-scale associated feature extraction module includes: a first scale feature extraction unit, configured to perform, on the input data in the forward direction transfer of the layer, using the second convolutional neural network using the three-dimensional convolutional kernel having the first scale: performing three-dimensional convolution processing, mean pooling processing and nonlinear activation processing on the input data based on the three-dimensional convolution kernel with the first scale to obtain a first feature map; and a second scale feature extraction unit configured to perform, on the input data in forward transfer of layers, using the third convolutional neural network using the three-dimensional convolutional kernel having the second scale, respectively: and performing three-dimensional convolution processing, mean pooling processing and nonlinear activation processing on the input data based on the three-dimensional convolution kernel with the second scale to obtain a second feature map.
In the above-mentioned intelligent food detection system, the characteristic correction module includes: a first feature map correction unit, configured to perform relative angle-like probability information representation correction on the first feature map based on the second feature map according to the following formula to obtain the first corrected feature map; wherein the formula is:
Figure BDA0004003780050000041
Figure BDA0004003780050000042
wherein F 1 Showing the first characteristic diagram, F 2 Represents the firstTwo characteristic graphs are shown in the specification, wherein,
Figure BDA0004003780050000043
and &>
Figure BDA0004003780050000044
Is the characteristic value of the (i, j, k) -th position of the first characteristic map and of the second characteristic map, respectively, and->
Figure BDA0004003780050000045
And &>
Figure BDA0004003780050000046
Is the mean of all characteristic values of the first characteristic map and the second characteristic map, is/are>
Figure BDA0004003780050000047
(ii) a feature value representing the (i, j, k) th position of the first corrected feature map, log representing a base-2 logarithmic function value; the second characteristic diagram correction unit is used for carrying out relative angle probability information representation correction on the second characteristic diagram based on the first characteristic diagram by the following formula so as to obtain a second correction characteristic diagram; wherein the formula is:
Figure BDA0004003780050000048
Figure BDA0004003780050000049
wherein F 1 Showing the first characteristic diagram, F 2 A second characteristic diagram is shown, which represents the second characteristic diagram,
Figure BDA00040037800500000410
and &>
Figure BDA00040037800500000411
Is the (i, j, k) th bit of the first and second feature maps, respectivelySet characteristic value, and>
Figure BDA00040037800500000412
and &>
Figure BDA00040037800500000413
Is the mean of all characteristic values of the first characteristic map and the second characteristic map, is/are>
Figure BDA00040037800500000414
Representing the eigenvalues of the (i, j, k) th position of the second correction profile, log representing the base 2 logarithmic function value.
In the above intelligent food detection system, the feature fusion module is further configured to: fusing the first corrected feature map and the second corrected feature map to obtain a multi-scale associated feature map in the following formula; wherein the formula is:
Figure BDA0004003780050000051
wherein, F c For the multi-scale correlation feature map, F a For the first corrected feature map, F b For the purpose of the second correction feature map,
Figure BDA0004003780050000052
representing addition of elements at corresponding positions of the first correction feature map and the second correction feature map, α and β being weighting parameters for controlling a balance between the first correction feature map and the second correction feature map in the multi-scale associated feature map.
In the above-mentioned intelligent food detection system, the detection result generation module includes: the expansion unit is used for expanding each classification feature matrix in the classification feature map into a one-dimensional feature vector according to a row vector or a column vector and then performing cascade processing to obtain a classification feature vector; a full-connection coding unit, configured to perform full-connection coding on the classification feature vector using a full-connection layer of the classifier to obtain a coded classification feature vector; and the classification result generation unit is used for inputting the encoding classification feature vector into a Softmax classification function of the classifier to obtain the classification result.
According to another aspect of the present application, there is also provided an intelligent food detection method, including:
acquiring a hyperspectral cube map of mutton to be detected, wherein the hyperspectral cube map comprises spectral images under multiple wavelengths;
passing the hyperspectral cube map through an automatic codec based image noise reducer to obtain a generated hyperspectral cube map;
obtaining a plurality of image feature matrices by passing the spectral images at each wavelength of the spectral images at a plurality of wavelengths in the generated hyperspectral cube map through a first convolution neural network model using a spatial attention mechanism;
arranging the plurality of image feature matrices into a three-dimensional feature tensor along a channel dimension;
passing the three-dimensional feature tensor through a dual-stream network model comprising a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map, wherein the second convolutional neural network uses a three-dimensional convolution kernel with a first scale, and the third convolutional neural network uses a three-dimensional convolution kernel with a second scale;
respectively carrying out relative angle probability information representation correction on the first feature map and the second feature map to obtain a first corrected feature map and a second corrected feature map;
fusing the first correction feature map and the second correction feature map to obtain a multi-scale associated feature map; and
and taking the multi-scale association characteristic diagram as a classification characteristic diagram, and passing the classification characteristic diagram through a classifier to obtain a classification result, wherein the classification result is used for indicating whether the mutton to be detected is water-injected mutton.
In the above intelligent food detection method, the passing the hyperspectral cube map through an automatic codec-based image noise reducer to obtain a generated hyperspectral cube map includes: inputting the hyperspectral cube map into an encoder of the image noise reducer, wherein the encoder uses a convolutional layer to perform explicit spatial encoding on the hyperspectral cube map to obtain hyperspectral cube map image features; and inputting the hyperspectral cube map image features into a decoder of the image noise reducer, wherein the decoder performs deconvolution processing on the hyperspectral cube map image features by using a deconvolution layer to obtain the generated hyperspectral cube map.
In the above intelligent food detection method, the passing the spectral images at the respective wavelengths of the spectral images at the multiple wavelengths in the generated hyperspectral cube map through a first convolutional neural network model using a spatial attention mechanism to obtain multiple image feature matrices includes: performing depth convolution coding on the spectral image by using a convolution coding part of the first convolution neural network model to obtain an initial convolution characteristic map; inputting the initial convolution feature map into a spatial attention portion of the first convolutional neural network model to obtain a spatial attention map; passing the spatial attention map through a Softmax activation function to obtain a spatial attention feature map; calculating the multiplication of the spatial attention feature map and the initial convolution feature map according to position points to obtain an image feature map; and carrying out global mean pooling along the channel dimension on the image feature map to obtain the image feature matrix.
In the above method for detecting intelligent food, the passing the three-dimensional feature tensor through a dual-flow network model including a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map includes: performing, using the second convolutional neural network using a three-dimensional convolution kernel having a first scale, in forward pass of layers, respectively: performing three-dimensional convolution processing, mean pooling processing and nonlinear activation processing on the input data based on the three-dimensional convolution kernel with the first scale to obtain a first feature map; and performing, in the forward pass of the layers, input data using the third convolutional neural network using a three-dimensional convolution kernel having a second scale: and performing three-dimensional convolution processing, mean pooling processing and nonlinear activation processing on the input data based on the three-dimensional convolution kernel with the second scale to obtain a second feature map.
In the above intelligent food detection method, the obtaining a classification result by using the multi-scale associated feature map as a classification feature map through a classifier, where the classification result is used to indicate whether the mutton to be detected is water-injected mutton, includes: expanding each classification feature matrix in the classification feature map into a one-dimensional feature vector according to a row vector or a column vector, and then performing cascade processing to obtain a classification feature vector; performing full-concatenation coding on the classification feature vectors by using a full-concatenation layer of the classifier to obtain coded classification feature vectors; and inputting the encoding classification feature vector into a Softmax classification function of the classifier to obtain the classification result.
According to still another aspect of the present application, there is provided an electronic apparatus including: a processor; and a memory having stored therein computer program instructions which, when executed by the processor, cause the processor to perform the intelligent food detection method as described above.
According to yet another aspect of the present application, there is provided a computer readable medium having stored thereon computer program instructions which, when executed by a processor, cause the processor to perform the intelligent food detection method as described above.
Compared with the prior art, the intelligent food detection system and the method thereof combine artificial intelligence and hyperspectral imaging technology to construct an intelligent food detection scheme for detecting water-injected mutton. Specifically, noise reduction is carried out on an image of a hyperspectral cube map of mutton to remove external factor interference, multiscale correlation characteristic information among spectral characteristics under different wavelengths in the cube map after noise reduction, namely multiscale correlation characteristics of spatial implicit characteristics of mutton under different sections is extracted, and detection and judgment of the mutton are carried out according to the multiscale correlation characteristics. Thus, whether the mutton is water-injected mutton is accurately detected.
Drawings
The above and other objects, features and advantages of the present application will become more apparent by describing in more detail embodiments of the present application with reference to the attached drawings. The accompanying drawings are included to provide a further understanding of the embodiments of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the principles of the application. In the drawings, like reference numbers generally represent like parts or steps.
Fig. 1 is a schematic view of a scene of an intelligent food detection system according to an embodiment of the present application.
Fig. 2 is a block diagram of an intelligent food detection system according to an embodiment of the present application.
Fig. 3 is a schematic diagram of an architecture of an intelligent food detection system according to an embodiment of the present application.
Fig. 4 is a block diagram of a detection result generation module in the intelligent food detection system according to the embodiment of the present application.
Fig. 5 is a flowchart of a smart food detection method according to an embodiment of the application.
Fig. 6 is a block diagram of an electronic device according to an embodiment of the application.
Detailed Description
Hereinafter, example embodiments according to the present application will be described in detail with reference to the accompanying drawings. It should be understood that the described embodiments are only some embodiments of the present application and not all embodiments of the present application, and that the present application is not limited by the example embodiments described herein.
Summary of the application
As the background art mentioned above, the demand for meat products is increasing, and the quality of meat products is also increasing. In order to gain violence, some meat product production operators began mass production and sale of water-infused meat, which severely degraded the quality of the meat product and threatened the health of the consumer. Water flooding meat is a process by which the weight of the meat is increased by a specific method. The water injection method is to inject water into the stomach of the livestock through a water pipe before slaughtering or inject water into the fresh meat after slaughtering. If the water content of the mutton is more than 76 percent, the mutton can be judged to be water-injected meat. In order to inject more water into raw meat, a certain amount of colloid powder is added into water by an operator, and once the water-injected meat is eaten by a consumer, the phenomena of breathing difficulty, food poisoning and the like can occur. When the water content of meat is excessive, cell structure is destroyed, the nutrient elements such as protein and vitamins contained in meat are greatly reduced, and viral microorganisms invade meat. In view of the aggravation of the phenomenon of water-infused mutton on the market, the detection of water-infused mutton becomes particularly important.
However, the existing detection scheme for detecting whether mutton is filled with water mostly depends on naked eyes to observe the color and quality of mutton, so that the mutton filled with water is difficult to distinguish from normal mutton, the mutton is likely to change due to environmental factors when being placed in an external environment for a long time, and the detection precision of the mutton filled with water is reduced. Therefore, an optimized intelligent food detection system is expected, which can accurately detect whether mutton is water-injected mutton so as to ensure the food quality and eating health of the mutton.
At present, deep learning and neural networks have been widely used in the fields of computer vision, natural language processing, speech signal processing, and the like. In addition, deep learning and neural networks also exhibit a level close to or even exceeding that of humans in the fields of image classification, object detection, semantic segmentation, text translation, and the like.
In recent years, deep learning and development of neural networks provide new solutions and schemes for intelligent food detection of mutton water injection.
Correspondingly, the hyperspectral imaging technology is based on image data technology of a plurality of narrow wave bands, the imaging technology and the spectrum technology are combined, two-dimensional geometric space and one-dimensional spectrum information of a target are detected, and continuous and narrow wave band image data with hyperspectral resolution are obtained. The hyperspectral imaging technology integrates the advantages of the traditional imaging and spectrum technology, and can acquire the spatial information and the spectrum information of the detected object at the same time, so that the technology can detect the external quality of the object like the traditional imaging technology, and can detect the internal quality and the quality safety of the object like the spectrum technology. Therefore, the rapid development of the hyperspectral imaging technology enables the hyperspectral imaging technology to be widely applied to the fields of food safety and the like.
Based on this, in the technical scheme of this application, can adopt hyperspectral imaging technique to carry out the detection of water injection mutton, but, actually detect time measuring to water injection mutton, because can make the precision that detects to the water injection of mutton lower because of the interference of factors such as environmental factor and mutton surface blood water among the image of gathering. Moreover, the acquired images have more interference information, which brings difficulty to information extraction of mutton, and further brings difficulty to detection of the water-injected mutton. Therefore, in the technical scheme of the application, it is expected that the image noise of the hyperspectral cube map of the mutton is reduced by adopting an artificial intelligence technology based on machine vision so as to remove the interference of external factors, and multi-scale associated feature information among the spectral features under different wavelengths in the cube map after noise reduction is further extracted, namely the multi-scale associated features of spatial implicit features of the mutton under different sections are used for detecting and judging whether the mutton is water-injected mutton. That is, an artificial intelligence technology is combined with a hyperspectral imaging technology to construct an intelligent food detection scheme for detecting water-injected mutton. Therefore, whether the mutton is water-injected mutton or not can be accurately detected, so that the food quality and eating health of the mutton are ensured.
Specifically, in the technical scheme of the application, firstly, a hyperspectral cube map of the mutton to be detected is collected through a hyperspectral analyzer. Then, in the process of actually acquiring the hyperspectral cube map of the mutton to be detected, the fact that the interference of factors such as external environment factors and mutton surface blood water can cause image blurring is considered, and therefore the detection accuracy of the water-injected mutton is low. Therefore, in the technical scheme of the application, the hyperspectral cube map of the mutton to be detected is further input into an image noise reducer based on an automatic coder and decoder to be subjected to image noise reduction so as to obtain the generated hyperspectral cube map. In particular, the image noise reducer based on the automatic codec comprises an encoder and a decoder, wherein the encoder uses a convolution layer to perform explicit spatial coding on the hyperspectral cube map of the mutton to be detected to obtain image features, and the decoder uses an deconvolution layer to perform deconvolution processing on the image features to obtain the generated hyperspectral cube map.
Then, with respect to the hyperspectral cube map, it should be noted that the hyperspectral cube map has a three-dimensional data structure, and the data of each section of the mutton to be detected is image information under each wavelength, that is, the hyperspectral cube map has a wavelength hierarchical structure on the data structure. It should be understood that since the hyperspectral cube map includes spectral images at multiple wavelengths, the spectral image information at different wavelengths will contain different amounts of information and have different hidden features at different spatial locations. Therefore, in the technical solution of the present application, the spectral image is used as image data, and a first convolution neural network model with a spatial attention mechanism is used as a feature extractor to extract high-dimensional local implicit feature distribution information based on spatial positions of the image data generated under each wavelength in the hyperspectral cube map, so as to obtain a plurality of image feature matrices.
Further, in order to capture the correlation between the spectral features under different wavelengths, the image feature matrixes are further arranged into a three-dimensional feature tensor according to the channel dimension and then pass through a convolutional neural network serving as a feature detector to obtain a classification feature map. Particularly, in consideration of the fact that the spectral features under different wavelengths have different degrees of relevance feature information, in order to fully extract the relevance of the spectral features under different wavelengths to more accurately extract the feature information of the mutton to be detected for detecting the water-injected mutton, the feature mining of the three-dimensional feature tensor is further performed by using a dual-flow network model including a second convolutional neural network and a third convolutional neural network to obtain a multi-scale relevance feature map. In particular, here, the second convolutional neural network uses a three-dimensional convolutional kernel having a first scale, and the third convolutional neural network uses a three-dimensional convolutional kernel having a second scale, the first scale being different from the second scale. It should be understood that by using the convolution neural network of the three-dimensional convolution kernels with different scales to perform feature extraction of the three-dimensional feature tensor, multi-scale relevance feature distribution information among the spectral features under different wavelengths in the three-dimensional feature tensor, namely multi-scale relevance features on different section space features of the mutton to be detected, can be extracted, so as to obtain the multi-scale relevance feature map.
And then, further taking the multi-scale associated feature map as a classification feature map to perform classification processing in a classifier so as to obtain a classification result for indicating whether the mutton to be detected is water-injected mutton. Like this, can carry out intellectual detection system to whether the mutton carries out intellectual detection system for the water injection mutton to guarantee the food quality of mutton and eat healthily.
Particularly, in the technical solution of the present application, when the three-dimensional feature tensor is obtained as the classification feature map by using a dual-flow network model including a second convolutional neural network and a third convolutional neural network, the three-dimensional feature tensor needs to be fused by using a first feature map and a second feature map obtained by using the second convolutional neural network and the third convolutional neural network respectively to obtain the classification feature map. And because the second convolutional neural network and the third convolutional neural network use three-dimensional convolutional kernels with different scales, the feature distribution of the first feature map and the second feature map has a spatial position error in a high-dimensional feature space, thereby affecting the fusion effect of the first feature map and the second feature map.
The applicant of the present application considers that the first feature map and the second feature map are both obtained from the three-dimensional feature tensor, and therefore, there is a certain correspondence in feature distribution as a homologous feature map, and therefore, the first feature map and the second feature map can be corrected by representing relative class angle probability information, which is expressed as:
Figure BDA0004003780050000121
Figure BDA0004003780050000122
Figure BDA0004003780050000123
wherein
Figure BDA0004003780050000124
And &>
Figure BDA0004003780050000125
Respectively, the first characteristic diagram F 1 And said second characteristic diagram F 2 And ∑ at the (i, j, k) th position of (c), and ∑ is>
Figure BDA0004003780050000126
And &>
Figure BDA0004003780050000127
Is the first characteristic diagram F 1 And said second characteristic diagram F 2 Is calculated as the mean of all characteristic values of (1). />
Here, the relative angle probability information indicates that the correction is performed by the first feature map F 1 And said second characteristic diagram F 2 Relative class angle probability information representation between the first feature map F and the second feature map F 1 And said second characteristic diagram F 2 Geometric dilution of spatial position error of feature distribution in high-dimensional feature space, thereby obtaining the first feature map F 1 And said second characteristic diagram F 2 Has a certain correspondence between them, based on the first characteristic diagram F 1 And said second profile F 2 The first feature map F is improved by performing implicit context correspondence correction of features by point-by-point regression of positions with respect to distribution constraint of the feature value distribution at each position as compared with the distribution constraint of the whole of each other 1 And said second characteristic diagram F 2 The fusion effect of (2) and then the accuracy of classification is improved. Thus, can be used forWhether the mutton is water-injected mutton is accurately detected so as to ensure the food quality and eating health of the mutton.
Based on this, the present application provides an intelligent food detection system, which includes: the hyperspectral data acquisition module is used for acquiring a hyperspectral cube map of mutton to be detected, and the hyperspectral cube map comprises spectral images under a plurality of wavelengths; the noise reduction module is used for enabling the hyperspectral cube map to pass through an image noise reducer based on an automatic coder-decoder to obtain a generated hyperspectral cube map; the spatial attention coding module is used for enabling the spectral images under the wavelengths in the generated spectral image under the multiple wavelengths in the hyperspectral cube map to pass through a first convolution neural network model using a spatial attention mechanism so as to obtain multiple image feature matrixes; the three-dimensional arrangement module is used for arranging the image feature matrixes into a three-dimensional feature tensor along the channel dimension; a multi-scale associated feature extraction module, configured to pass the three-dimensional feature tensor through a dual-flow network model including a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map, where the second convolutional neural network uses a three-dimensional convolution kernel with a first scale, and the third convolutional neural network uses a three-dimensional convolution kernel with a second scale; the characteristic correction module is used for respectively carrying out relative angle probability information representation correction on the first characteristic diagram and the second characteristic diagram to obtain a first corrected characteristic diagram and a second corrected characteristic diagram; the feature fusion module is used for fusing the first correction feature map and the second correction feature map to obtain a multi-scale associated feature map; and the detection result generation module is used for taking the multi-scale associated characteristic diagram as a classification characteristic diagram and obtaining a classification result through a classifier, wherein the classification result is used for indicating whether the mutton to be detected is water-injected mutton.
Fig. 1 is a schematic view of a scene of an intelligent food detection system according to an embodiment of the present application. As shown in fig. 1, in an application scenario of the intelligent food detection system, a hyperspectral cube map of a mutton to be detected (e.g., M as illustrated in fig. 1) is first collected by a hyperspectral analyzer (e.g., se as illustrated in fig. 1). Further, the hyperspectral cube map is input into a server (for example, S shown in fig. 1) deployed with an intelligent food detection algorithm, where the server can process the hyperspectral cube map with the intelligent food detection algorithm to obtain a classification result indicating whether the mutton to be detected is water-injected mutton.
Having described the basic principles of the present application, various non-limiting embodiments of the present application will now be described with reference to the accompanying drawings.
Exemplary System
Fig. 2 is a block diagram of an intelligent food detection system according to an embodiment of the present application. As shown in fig. 2, the intelligent food detection system 100 according to the embodiment of the present application includes: the hyperspectral data acquisition module 110 is used for acquiring a hyperspectral cube map of mutton to be detected, wherein the hyperspectral cube map comprises spectral images under a plurality of wavelengths; a denoising module 120, configured to pass the hyperspectral cube map through an automatic codec based image denoiser to obtain a generated hyperspectral cube map; a spatial attention coding module 130, configured to pass the spectral images at the respective wavelengths of the spectral images at the multiple wavelengths in the generated hyperspectral cube map through a first convolution neural network model using a spatial attention mechanism to obtain multiple image feature matrices; a three-dimensional arrangement module 140, configured to arrange the image feature matrices into a three-dimensional feature tensor along a channel dimension; a multi-scale associated feature extraction module 150, configured to pass the three-dimensional feature tensor through a dual-flow network model including a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map, where the second convolutional neural network uses a three-dimensional convolution kernel with a first scale, and the third convolutional neural network uses a three-dimensional convolution kernel with a second scale; a feature correction module 160, configured to perform relative angle probability information representation correction on the first feature map and the second feature map respectively to obtain a first corrected feature map and a second corrected feature map; a feature fusion module 170, configured to fuse the first corrected feature map and the second corrected feature map to obtain a multi-scale associated feature map; and a detection result generation module 180, configured to pass the multi-scale associated feature map through a classifier as a classification feature map to obtain a classification result, where the classification result is used to indicate whether the mutton to be detected is water-injected mutton.
Fig. 3 is a schematic diagram of an architecture of an intelligent food detection system according to an embodiment of the present application. As shown in fig. 3, a hyperspectral cube map of mutton to be detected is first acquired, where the hyperspectral cube map includes spectral images at multiple wavelengths. Then, the hyperspectral cube map is passed through an automatic codec based image noise reducer to obtain a generated hyperspectral cube map. Then, the spectral images at the various wavelengths of the spectral images at the various wavelengths in the generated hyperspectral cube map are passed through a first convolution neural network model using a spatial attention mechanism to obtain a plurality of image feature matrices. Further, the plurality of image feature matrices are arranged as a three-dimensional feature tensor along a channel dimension. Then, the three-dimensional feature tensor is passed through a dual-stream network model comprising a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map, wherein the second convolutional neural network uses a three-dimensional convolution kernel with a first scale, and the third convolutional neural network uses a three-dimensional convolution kernel with a second scale. Then, relative angle probability information representation correction is carried out on the first feature map and the second feature map respectively to obtain a first corrected feature map and a second corrected feature map, and the first corrected feature map and the second corrected feature map are fused to obtain a multi-scale associated feature map. And then, taking the multi-scale associated feature map as a classification feature map, and passing the classification feature map through a classifier to obtain a classification result, wherein the classification result is used for indicating whether the mutton to be detected is water-injected mutton.
In the above intelligent food detection system 100, the hyperspectral data acquisition module 110 is configured to acquire a hyperspectral cube map of a mutton to be detected, where the hyperspectral cube map includes spectral images under multiple wavelengths. As the background art mentioned above, most of the existing detection schemes for detecting whether mutton is injected with water rely on naked eyes to observe the color and quality of mutton, so that the mutton injected with water is difficult to distinguish from normal mutton, and the mutton is likely to change due to environmental factors when being placed in an external environment for a long time, so that the detection accuracy of the mutton injected with water is reduced. Therefore, an optimized intelligent food detection system is expected, which can accurately detect whether mutton is water-injected mutton so as to ensure the food quality and eating health of mutton.
Correspondingly, the hyperspectral imaging technology is based on image data technology of a plurality of narrow wave bands, the imaging technology and the spectrum technology are combined, two-dimensional geometric space and one-dimensional spectrum information of a target are detected, and continuous and narrow wave band image data with hyperspectral resolution are obtained. The hyperspectral imaging technology integrates the advantages of the traditional imaging and spectrum technology, and can acquire the spatial information and the spectrum information of the detected object at the same time, so that the technology can detect the external quality of the object like the traditional imaging technology, and can detect the internal quality and the quality safety of the object like the spectrum technology. Therefore, the rapid development of the hyperspectral imaging technology enables the hyperspectral imaging technology to be widely applied to the fields of food safety and the like.
Based on this, in the technical scheme of this application, can adopt hyperspectral imaging technique to carry out the detection of water injection mutton, but, actually detect time measuring to water injection mutton, because can make the precision that detects to the water injection of mutton lower because of the interference of factors such as environmental factor and mutton surface blood water among the image of gathering. Moreover, the acquired images have more interference information, which brings difficulty to information extraction of mutton, and further brings difficulty to detection of the water-injected mutton. Therefore, in the technical scheme of the application, it is expected that the image noise of the hyperspectral cube map of the mutton is reduced by adopting an artificial intelligence technology based on machine vision so as to remove the interference of external factors, and multi-scale associated feature information among the spectral features under different wavelengths in the cube map after noise reduction is further extracted, namely the multi-scale associated features of spatial implicit features of the mutton under different sections are used for detecting and judging whether the mutton is water-injected mutton. That is, an artificial intelligence technology is combined with a hyperspectral imaging technology to construct an intelligent food detection scheme for detecting water-injected mutton. Therefore, whether the mutton is water-injected mutton or not can be accurately detected, so that the food quality and eating health of the mutton are ensured. Specifically, in the technical scheme of the application, firstly, a hyperspectral cube map of the mutton to be detected is collected through a hyperspectral analyzer. And in the process of collecting the hyperspectral cube map, placing the mutton to be detected in the hyperspectral analyzer.
In the above intelligent food detection system 100, the denoising module 120 is configured to pass the hyperspectral cube map through an automatic codec-based image denoiser to obtain a generated hyperspectral cube map. In the process of actually collecting the hyperspectral cube map of the mutton to be detected, the fact that the interference of factors such as external environment factors and mutton surface blood causes image blurring is considered, and the accuracy of detecting the water-injected mutton is low. Therefore, in the technical scheme of the application, the hyperspectral cube map of the mutton to be detected is further input into an image noise reducer based on an automatic coder and decoder to be subjected to image noise reduction so as to obtain the generated hyperspectral cube map. In particular, the image noise reducer based on the automatic codec comprises an encoder and a decoder, wherein the encoder uses a convolution layer to perform explicit spatial coding on the hyperspectral cube map of the mutton to be detected to obtain image features, and the decoder uses an deconvolution layer to perform deconvolution processing on the image features to obtain the generated hyperspectral cube map.
Specifically, in this embodiment, the denoising module 120 firstly inputs the hyperspectral cube map into an encoder of the image denoising device through an encoding unit, where the encoder explicitly and spatially encodes the hyperspectral cube map by using convolutional layers to obtain hyperspectral cube map image features. Then, inputting the hyperspectral cube map image features into a decoder of the image noise reducer through a decoding unit, wherein the decoder performs deconvolution processing on the hyperspectral cube map image features by using a deconvolution layer to obtain the generated hyperspectral cube map.
In the above intelligent food detection system 100, the spatial attention coding module 130 is configured to obtain a plurality of image feature matrices by passing the spectral images at the respective wavelengths of the spectral images at the plurality of wavelengths in the generated hyperspectral cube map through a first convolution neural network model using a spatial attention mechanism. For the hyperspectral cube map, it should be noted that the hyperspectral cube map has a three-dimensional data structure, and the data of each section of the mutton to be detected is image information under each wavelength, that is, the hyperspectral cube map has a wavelength hierarchical structure on the data structure. It should be understood that since the hyperspectral cube map includes spectral images at multiple wavelengths, the spectral image information at different wavelengths will contain different amounts of information and have different hidden features at different spatial locations. Therefore, in the technical solution of the present application, the spectral image is used as image data, and a first convolution neural network model with a spatial attention mechanism is used as a feature extractor to extract high-dimensional local implicit feature distribution information based on spatial positions of the image data generated under each wavelength in the hyperspectral cube map, so as to obtain a plurality of image feature matrices.
Specifically, in this embodiment of the present application, the spatial attention coding module 130 is further configured to: depth convolution coding is carried out on the spectral image by using a convolution coding part of the first convolution neural network model so as to obtain an initial convolution characteristic map; inputting the initial convolution feature map into a spatial attention portion of the first convolutional neural network model to obtain a spatial attention map; passing the spatial attention map through a Softmax activation function to obtain a spatial attention feature map; calculating the multiplication of the spatial attention feature map and the initial convolution feature map according to position points to obtain an image feature map; and carrying out global mean pooling along the channel dimension on the image feature map to obtain the image feature matrix.
In the above-mentioned intelligent food detection system 100, the three-dimensional arrangement module 140 is configured to arrange the plurality of image feature matrices into a three-dimensional feature tensor along a channel dimension. Further, in order to capture the correlation between the spectral features at different wavelengths, the plurality of image feature matrixes are further input into a convolutional neural network as a feature detector for feature extraction. In the technical solution of the present application, a dual-flow network model including a second convolutional neural network and a third convolutional neural network is adopted as a convolutional neural network of a feature detector, and the second convolutional neural network and the third convolutional neural network use three-dimensional convolution kernels with different scales, so that here, the plurality of image feature matrices need to be arranged into a three-dimensional feature tensor along a channel dimension, that is, data is structured, so as to facilitate calculation of a subsequent model.
In the above-mentioned intelligent food detection system 100, the multi-scale associated feature extraction module 150 is configured to pass the three-dimensional feature tensor through a dual-stream network model including a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map, where the second convolutional neural network uses a three-dimensional convolution kernel having a first scale, and the third convolutional neural network uses a three-dimensional convolution kernel having a second scale. Considering that there are correlation characteristic information of different degrees between the spectral characteristics under different wavelengths, in order to fully extract the correlation of the spectral characteristics under different wavelengths to more accurately extract the characteristic information of the mutton to be detected to detect the water-injected mutton, a dual-flow network model including a second convolutional neural network and a third convolutional neural network is further used to perform feature mining of the three-dimensional characteristic tensor so as to obtain a multi-scale correlation characteristic diagram. In particular, here, the second convolutional neural network uses a three-dimensional convolutional kernel having a first scale, and the third convolutional neural network uses a three-dimensional convolutional kernel having a second scale, the first scale being different from the second scale. It should be understood that by using the convolution neural network of the three-dimensional convolution kernels with different scales to perform feature extraction of the three-dimensional feature tensor, multi-scale relevance feature distribution information among the spectral features under different wavelengths in the three-dimensional feature tensor, namely multi-scale relevance features on different section space features of the mutton to be detected, can be extracted, so as to obtain the multi-scale relevance feature map.
Specifically, in this embodiment of the present application, the multi-scale associated feature extraction module 150 includes: a first scale feature extraction unit, configured to perform, on the input data in forward pass of the layers, using the second convolutional neural network using the three-dimensional convolutional kernel having the first scale: performing three-dimensional convolution processing, mean pooling processing and nonlinear activation processing on the input data based on the three-dimensional convolution kernel with the first scale to obtain a first feature map; and a second scale feature extraction unit configured to perform, on the input data in forward transfer of layers, using the third convolutional neural network using the three-dimensional convolutional kernel having the second scale, respectively: and performing three-dimensional convolution processing, mean pooling processing and nonlinear activation processing on the input data based on the three-dimensional convolution kernel with the second scale to obtain a second feature map.
Here, the second convolutional neural network and the third convolutional neural network include a plurality of neural network layers cascaded to each other, wherein each neural network layer includes a convolutional layer, a pooling layer, and an activation layer, and each layer may output a feature map.
In the above-mentioned intelligent food detection system 100, the characteristic correction module 160 is configured to perform relative angle probability information representation correction on the first characteristic diagram and the second characteristic diagram respectively to obtain a first corrected characteristic diagram and a second corrected characteristic diagram. Particularly, in the technical solution of the present application, when the three-dimensional feature tensor is obtained as the classification feature map by using a dual-flow network model including a second convolutional neural network and a third convolutional neural network to obtain the multi-scale associated feature map, the three-dimensional feature tensor needs to be fused by using a first feature map and a second feature map obtained by using the second convolutional neural network and the third convolutional neural network respectively to obtain the classification feature map. And because the second convolutional neural network and the third convolutional neural network use three-dimensional convolutional kernels with different scales, the feature distribution of the first feature map and the second feature map has a spatial position error in a high-dimensional feature space, thereby affecting the fusion effect of the first feature map and the second feature map.
The applicant of the present application considers that the first feature map and the second feature map are both obtained from the three-dimensional feature tensor, and therefore, they have a certain correspondence in feature distribution as homologous feature maps, and therefore, the first feature map and the second feature map can be corrected for the relative angle-like probability information representation, respectively.
Specifically, in the embodiment of the present application, the feature correction module 160 includes: a first feature map correcting unit, configured to perform relative angle-like probability information representation correction on the first feature map based on the second feature map by using the following formula to obtain the first corrected feature map; wherein the formula is:
Figure BDA0004003780050000191
Figure BDA0004003780050000192
wherein F 1 Showing the first characteristic diagram, F 2 A second characteristic diagram is shown, which represents the second characteristic diagram,
Figure BDA0004003780050000193
and &>
Figure BDA0004003780050000194
Is the characteristic value of the (i, j, k) -th position of the first characteristic map and of the second characteristic map, respectively, and->
Figure BDA0004003780050000195
And &>
Figure BDA0004003780050000196
Is the mean of all characteristic values of the first characteristic map and the second characteristic map, is/are>
Figure BDA0004003780050000197
Represents the aboveThe eigenvalues of the (i, j, k) th position of the first corrected profile, log representing the base-2 logarithmic function values; the second characteristic diagram correction unit is used for carrying out relative angle probability information representation correction on the second characteristic diagram based on the first characteristic diagram by the following formula so as to obtain a second correction characteristic diagram; wherein the formula is:
Figure BDA0004003780050000201
Figure BDA0004003780050000202
wherein F 1 Showing the first characteristic diagram, F 2 A second characteristic diagram is shown, which represents the second characteristic diagram,
Figure BDA0004003780050000203
and &>
Figure BDA0004003780050000204
Is the characteristic value of the (i, j, k) -th position of the first characteristic map and of the second characteristic map, respectively, and->
Figure BDA0004003780050000205
And &>
Figure BDA0004003780050000206
Is the mean of all characteristic values of the first characteristic map and the second characteristic map, is/are>
Figure BDA0004003780050000207
Representing the eigenvalues of the (i, j, k) th position of the second correction profile, log representing the base 2 logarithmic function value.
Here, the relative angle probability information indicates that the correction is performed by the first feature map F 1 And said second characteristic diagram F 2 Relative class angle probability information representation between the first feature map F and the second feature map F 1 And saidSecond characteristic diagram F 2 Geometric dilution of spatial position error of feature distribution in high-dimensional feature space, thereby obtaining the first feature map F 1 And said second characteristic diagram F 2 Has a certain correspondence between them, based on the first characteristic diagram F 1 And said second characteristic diagram F 2 The first feature map F is improved by performing implicit context correspondence correction of features by point-by-point regression of positions, as compared with the distribution constraint of the respective feature value distributions at the respective positions with respect to each other as a whole 1 And said second characteristic diagram F 2 The fusion effect of (2) and then the accuracy of classification is improved.
In the above-mentioned intelligent food detection system 100, the feature fusion module 170 is configured to fuse the first corrected feature map and the second corrected feature map to obtain a multi-scale associated feature map. The multi-scale associated feature map comprises multi-scale associated features on different section space features of the mutton to be detected, so that the classification accuracy is improved.
Specifically, in this embodiment of the present application, the feature fusion module 170 is further configured to: fusing the first corrected feature map and the second corrected feature map to obtain a multi-scale associated feature map in the following formula; wherein the formula is:
Figure BDA0004003780050000208
wherein, F c For the multi-scale associated feature map, F a For the first corrected feature map, F b In order to correct the characteristic map for the second,
Figure BDA0004003780050000211
representing addition of elements at corresponding positions of the first correction feature map and the second correction feature map, α and β being weighting parameters for controlling a balance between the first correction feature map and the second correction feature map in the multi-scale associated feature map.
In the above-mentioned intelligent food detection system 100, the detection result generation module 180 is configured to use the multi-scale associated feature map as a classification feature map to obtain a classification result through a classifier, where the classification result is used to indicate whether the mutton to be detected is water-injected mutton. Namely, class boundary division and determination are carried out on the high-dimensional data manifold of the classification characteristic diagram by the classifier so as to obtain a classification result for indicating whether the mutton to be detected is water-injected mutton. Like this, can carry out intellectual detection system to whether the mutton carries out intellectual detection system for the water injection mutton to guarantee the food quality and the edible health of mutton.
Fig. 4 is a block diagram of a detection result generation module in the intelligent food detection system according to the embodiment of the application. As shown in fig. 4, the detection result generating module 180 includes: an unfolding unit 181, configured to unfold each classification feature matrix in the classification feature map into a one-dimensional feature vector according to a row vector or a column vector, and then perform cascade processing to obtain a classification feature vector; a full-concatenation encoding unit 182, configured to perform full-concatenation encoding on the classification feature vector using a full-concatenation layer of the classifier to obtain an encoded classification feature vector; and a classification result generating unit 183, configured to input the encoded classification feature vector into a Softmax classification function of the classifier to obtain the classification result.
In conclusion, the intelligent food detection system 100 based on the embodiment of the application is clarified, and combines artificial intelligence and hyperspectral imaging technology to construct an intelligent food detection scheme for detecting water-injected mutton. Specifically, image denoising of a hyperspectral cube map of mutton is carried out to remove external factor interference, multi-scale correlation characteristic information among spectral characteristics under different wavelengths in the cube map after denoising, namely multi-scale correlation characteristics of spatial implicit characteristics of mutton under different sections, is extracted, and detection and judgment of the mutton are carried out according to the multi-scale correlation characteristics. Thus, whether the mutton is water-injected mutton is accurately detected.
As described above, the intelligent food detection system 100 according to the embodiment of the present application can be implemented in various terminal devices, such as a server for intelligent food detection. In one example, the intelligent food detection system 100 according to embodiments of the present application may be integrated into a terminal device as one software module and/or hardware module. For example, the intelligent food detection system 100 may be a software module in the operating system of the terminal device, or may be an application developed for the terminal device; of course, the intelligent food detection system 100 may also be one of many hardware modules of the terminal device.
Alternatively, in another example, the intelligent food detection system 100 and the terminal device may be separate devices, and the intelligent food detection system 100 may be connected to the terminal device through a wired and/or wireless network and transmit the interactive information according to an agreed data format.
Exemplary method
Fig. 5 is a flowchart of a smart food detection method according to an embodiment of the application. As shown in fig. 5, the intelligent food detection method according to the embodiment of the present application includes: s110, acquiring a hyperspectral cube map of mutton to be detected, wherein the hyperspectral cube map comprises spectral images under multiple wavelengths; s120, enabling the hyperspectral cube map to pass through an image noise reducer based on an automatic coder-decoder to obtain a generated hyperspectral cube map; s130, enabling the spectral images under the multiple wavelengths in the generated hyperspectral cube map to pass through a first convolution neural network model using a space attention mechanism so as to obtain multiple image feature matrixes; s140, arranging the image feature matrixes into a three-dimensional feature tensor along a channel dimension; s150, enabling the three-dimensional feature tensor to pass through a dual-flow network model comprising a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map, wherein the second convolutional neural network uses a three-dimensional convolutional kernel with a first scale, and the third convolutional neural network uses a three-dimensional convolutional kernel with a second scale; s160, relative angle probability information representation correction is carried out on the first feature map and the second feature map respectively to obtain a first corrected feature map and a second corrected feature map; s170, fusing the first correction feature map and the second correction feature map to obtain a multi-scale associated feature map; and S180, taking the multi-scale associated feature map as a classification feature map, and passing the classification feature map through a classifier to obtain a classification result, wherein the classification result is used for indicating whether the mutton to be detected is water-injected mutton.
In one example, in the above intelligent food detection method, the passing the hyperspectral cube map through an automatic codec based image noise reducer to obtain a generated hyperspectral cube map includes: inputting the hyperspectral cube map into an encoder of the image noise reducer, wherein the encoder uses a convolutional layer to perform explicit spatial encoding on the hyperspectral cube map to obtain hyperspectral cube map image features; and inputting the hyperspectral cube map image features into a decoder of the image noise reducer, wherein the decoder performs deconvolution processing on the hyperspectral cube map image features by using a deconvolution layer to obtain the generated hyperspectral cube map.
In one example, in the above intelligent food detection method, the passing the spectral images at the respective wavelengths of the spectral images at the plurality of wavelengths in the generated hyperspectral cube map through a first convolutional neural network model using a spatial attention mechanism to obtain a plurality of image feature matrices includes: depth convolution coding is carried out on the spectral image by using a convolution coding part of the first convolution neural network model so as to obtain an initial convolution characteristic map; inputting the initial convolution feature map into a spatial attention portion of the first convolutional neural network model to obtain a spatial attention map; passing the spatial attention map through a Softmax activation function to obtain a spatial attention feature map; calculating the multiplication of the spatial attention feature map and the initial convolution feature map according to position points to obtain an image feature map; and carrying out global mean pooling along the channel dimension on the image feature map to obtain the image feature matrix.
In one example, in the above intelligent food detection method, the passing the three-dimensional feature tensor through a dual-flow network model including a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map includes: performing, using the second convolutional neural network using a three-dimensional convolution kernel having a first scale, in forward pass of layers, respectively: performing three-dimensional convolution processing, mean pooling processing and nonlinear activation processing on the input data based on the three-dimensional convolution kernel with the first scale to obtain a first feature map; and performing in a forward pass of the layers the input data separately using the third convolutional neural network using a three-dimensional convolution kernel having a second scale: and performing three-dimensional convolution processing, mean pooling processing and nonlinear activation processing on the input data based on the three-dimensional convolution kernel with the second scale to obtain a second feature map.
In an example, in the above intelligent food detection method, the passing the multi-scale associated feature map as a classification feature map through a classifier to obtain a classification result, where the classification result is used to indicate whether the mutton to be detected is water-injected mutton, including: expanding each classification feature matrix in the classification feature map into a one-dimensional feature vector according to a row vector or a column vector, and then performing cascade processing to obtain a classification feature vector; performing full-concatenation coding on the classification feature vectors by using a full-concatenation layer of the classifier to obtain coded classification feature vectors; and inputting the encoding classification feature vector into a Softmax classification function of the classifier to obtain the classification result.
In summary, the intelligent food detection method disclosed by the embodiment of the application is clarified, and an intelligent food detection scheme for detecting the water-injected mutton is constructed by combining artificial intelligence and a hyperspectral imaging technology. Specifically, image denoising of a hyperspectral cube map of mutton is carried out to remove external factor interference, multi-scale correlation characteristic information among spectral characteristics under different wavelengths in the cube map after denoising, namely multi-scale correlation characteristics of spatial implicit characteristics of mutton under different sections, is extracted, and detection and judgment of the mutton are carried out according to the multi-scale correlation characteristics. Thus, whether the mutton is water-injected mutton is accurately detected.
Exemplary electronic device
Next, an electronic apparatus according to an embodiment of the present application is described with reference to fig. 6. Fig. 6 is a block diagram of an electronic device according to an embodiment of the application.
As shown in fig. 6, the electronic device 10 includes one or more processors 11 and memory 12.
The processor 11 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.
Memory 12 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium and executed by processor 11 to implement the functions of the intelligent food detection methods of the various embodiments of the present application described above and/or other desired functions. Various contents such as a hyperspectral cube map of mutton to be detected and the like can also be stored in the computer readable storage medium.
In one example, the electronic device 10 may further include: an input device 13 and an output device 14, which are interconnected by a bus system and/or other form of connection mechanism (not shown).
The input device 13 may include, for example, a keyboard, a mouse, and the like.
The output device 14 can output various information including the classification result to the outside. The output devices 14 may include, for example, a display, speakers, a printer, and a communication network and its connected remote output devices, among others.
Of course, for simplicity, only some of the components of the electronic device 10 relevant to the present application are shown in fig. 6, and components such as buses, input/output interfaces, and the like are omitted. In addition, the electronic device 10 may include any other suitable components depending on the particular application.
Exemplary computer program product and computer-readable storage Medium
In addition to the above-described methods and apparatus, embodiments of the present application may also be a computer program product comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in the functions of the intelligent food detection method according to various embodiments of the present application described in the "exemplary methods" section of this specification above.
The computer program product may be written with program code for performing the operations of embodiments of the present application in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present application may also be a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform steps in functions in the intelligent food detection method according to various embodiments of the present application described in the "exemplary methods" section above in this specification.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing describes the general principles of the present application in conjunction with specific embodiments, however, it is noted that the advantages, effects, etc. mentioned in the present application are merely examples and are not limiting, and they should not be considered essential to the various embodiments of the present application. Furthermore, the foregoing disclosure of specific details is for the purpose of illustration and description and is not intended to be limiting, since the foregoing disclosure is not intended to be exhaustive or to limit the disclosure to the precise details disclosed.
The block diagrams of devices, apparatuses, systems referred to in this application are only given as illustrative examples and are not intended to require or imply that the connections, arrangements, configurations, etc. must be made in the manner shown in the block diagrams. These devices, apparatuses, devices, systems may be connected, arranged, configured in any manner, as will be appreciated by those skilled in the art. Words such as "including," "comprising," "having," and the like are open-ended words that mean "including, but not limited to," and are used interchangeably therewith. The words "or" and "as used herein mean, and are used interchangeably with, the word" and/or, "unless the context clearly dictates otherwise. The word "such as" is used herein to mean, and is used interchangeably with, the phrase "such as but not limited to".
It should also be noted that in the devices, apparatuses, and methods of the present application, the components or steps may be decomposed and/or recombined. These decompositions and/or recombinations should be considered as equivalents of the present application.
The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the application. Thus, the present application is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, the description is not intended to limit embodiments of the application to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize certain variations, modifications, alterations, additions and sub-combinations thereof.

Claims (10)

1. An intelligent food detection system, comprising:
the hyperspectral data acquisition module is used for acquiring a hyperspectral cube map of mutton to be detected, and the hyperspectral cube map comprises spectral images under a plurality of wavelengths;
the noise reduction module is used for enabling the hyperspectral cube map to pass through an image noise reducer based on an automatic coder-decoder to obtain a generated hyperspectral cube map;
the spatial attention coding module is used for enabling the spectral images under the wavelengths in the generated spectral image under the multiple wavelengths in the hyperspectral cube map to pass through a first convolution neural network model using a spatial attention mechanism so as to obtain multiple image feature matrixes;
the three-dimensional arrangement module is used for arranging the image feature matrixes into a three-dimensional feature tensor along a channel dimension;
a multi-scale associated feature extraction module, configured to pass the three-dimensional feature tensor through a dual-flow network model including a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map, where the second convolutional neural network uses a three-dimensional convolution kernel with a first scale, and the third convolutional neural network uses a three-dimensional convolution kernel with a second scale;
the characteristic correction module is used for respectively carrying out relative angle probability information representation correction on the first characteristic diagram and the second characteristic diagram to obtain a first corrected characteristic diagram and a second corrected characteristic diagram;
the feature fusion module is used for fusing the first correction feature map and the second correction feature map to obtain a multi-scale associated feature map; and
and the detection result generation module is used for taking the multi-scale association characteristic diagram as a classification characteristic diagram to pass through a classifier so as to obtain a classification result, and the classification result is used for indicating whether the mutton to be detected is water-injected mutton or not.
2. The smart food product detection system of claim 1 wherein the noise reduction module comprises:
the encoding unit is used for inputting the hyperspectral cube map into an encoder of the image noise reducer, wherein the encoder uses a convolutional layer to perform explicit spatial encoding on the hyperspectral cube map so as to obtain hyperspectral cube map image characteristics; and
and the decoding unit is used for inputting the hyperspectral cube map image features into a decoder of the image noise reducer, wherein the decoder uses a deconvolution layer to perform deconvolution processing on the hyperspectral cube map image features so as to obtain the generated hyperspectral cube map.
3. The intelligent food detection system of claim 2, wherein the spatial attention coding module is further configured to:
depth convolution coding is carried out on the spectral image by using a convolution coding part of the first convolution neural network model so as to obtain an initial convolution characteristic map;
inputting the initial convolution feature map into a spatial attention portion of the first convolutional neural network model to obtain a spatial attention map;
passing the spatial attention map through a Softmax activation function to obtain a spatial attention feature map;
calculating the multiplication of the spatial attention feature map and the initial convolution feature map according to position points to obtain an image feature map; and
and carrying out global mean pooling along the channel dimension on the image feature map to obtain the image feature matrix.
4. The intelligent food detection system of claim 3, wherein the multi-scale associative feature extraction module comprises:
a first scale feature extraction unit, configured to perform, on the input data in forward pass of the layers, using the second convolutional neural network using the three-dimensional convolutional kernel having the first scale: performing three-dimensional convolution processing, mean pooling processing and nonlinear activation processing on the input data based on the three-dimensional convolution kernel with the first scale to obtain a first feature map; and
a second scale feature extraction unit, configured to perform, on the input data in the forward direction transfer of the layer, using the third convolutional neural network using the three-dimensional convolutional kernel having the second scale, respectively: and performing three-dimensional convolution processing, mean pooling processing and nonlinear activation processing on the input data based on the three-dimensional convolution kernel with the second scale to obtain a second feature map.
5. The intelligent food detection system of claim 4, wherein the signature correction module comprises:
a first feature map correction unit, configured to perform relative angle-like probability information representation correction on the first feature map based on the second feature map according to the following formula to obtain the first corrected feature map;
wherein the formula is:
Figure FDA0004003780040000031
Figure FDA0004003780040000032
wherein F 1 Showing the first characteristic diagram, F 2 A second characteristic diagram is shown, which represents the second characteristic diagram,
Figure FDA0004003780040000033
and
Figure FDA0004003780040000034
is the characteristic value of the (i, j, k) th position of the first characteristic map and the second characteristic map, respectively, and
Figure FDA0004003780040000035
and
Figure FDA0004003780040000036
is the average of all feature values of the first feature map and the second feature map,
Figure FDA0004003780040000037
(ii) a feature value representing the (i, j, k) th position of the first corrected feature map, log representing a base-2 logarithmic function value; and
a second feature map correcting unit, configured to perform relative angle-like probability information representation correction on the second feature map based on the first feature map by using the following formula to obtain the second corrected feature map;
wherein the formula is:
Figure FDA0004003780040000038
Figure FDA0004003780040000039
wherein F 1 Showing the first characteristic diagram, F 2 A second characteristic diagram is shown, which represents the second characteristic diagram,
Figure FDA00040037800400000310
and
Figure FDA00040037800400000311
is the characteristic value of the (i, j, k) th position of the first characteristic map and the second characteristic map, respectively, and
Figure FDA00040037800400000313
and
Figure FDA00040037800400000314
is the average of all feature values of the first feature map and the second feature map,
Figure FDA00040037800400000312
representing the eigenvalues of the (i, j, k) th position of the second correction profile, log representing the base-2 logarithmic function values.
6. The smart food detection system of claim 5, wherein the feature fusion module is further configured to:
fusing the first corrected feature map and the second corrected feature map to obtain a multi-scale associated feature map in the following formula;
wherein the formula is:
Figure FDA0004003780040000041
wherein, F c For the multi-scale associated feature map, F a For the first corrected feature map, F b For the purpose of the second correction feature map,
Figure FDA0004003780040000042
representing addition of elements at corresponding positions of the first correction feature map and the second correction feature map, α and β being weighting parameters for controlling a balance between the first correction feature map and the second correction feature map in the multi-scale associated feature map.
7. The intelligent food detection system of claim 6, wherein the detection result generation module comprises:
the expansion unit is used for expanding each classification feature matrix in the classification feature map into a one-dimensional feature vector according to a row vector or a column vector and then performing cascade processing to obtain a classification feature vector;
a full-concatenation encoding unit, configured to perform full-concatenation encoding on the classification feature vector using a full-concatenation layer of the classifier to obtain an encoded classification feature vector; and
a classification result generating unit, configured to input the encoded classification feature vector into a Softmax classification function of the classifier to obtain the classification result.
8. An intelligent food detection method, comprising:
acquiring a hyperspectral cube map of mutton to be detected, wherein the hyperspectral cube map comprises spectral images under multiple wavelengths;
passing the hyperspectral cube map through an automatic codec based image noise reducer to obtain a generated hyperspectral cube map;
obtaining a plurality of image feature matrices by passing the spectral images at each wavelength of the spectral images at a plurality of wavelengths in the generated hyperspectral cube map through a first convolutional neural network model using a spatial attention mechanism;
arranging the plurality of image feature matrices into a three-dimensional feature tensor along a channel dimension;
passing the three-dimensional feature tensor through a dual-stream network model comprising a second convolutional neural network and a third convolutional neural network to obtain a first feature map and a second feature map, wherein the second convolutional neural network uses a three-dimensional convolution kernel with a first scale, and the third convolutional neural network uses a three-dimensional convolution kernel with a second scale;
respectively carrying out relative angle probability information representation correction on the first feature map and the second feature map to obtain a first corrected feature map and a second corrected feature map;
fusing the first correction feature map and the second correction feature map to obtain a multi-scale associated feature map; and
and taking the multi-scale association characteristic diagram as a classification characteristic diagram, and passing the classification characteristic diagram through a classifier to obtain a classification result, wherein the classification result is used for indicating whether the mutton to be detected is water-injected mutton.
9. The intelligent food detection method according to claim 8, wherein the passing the hyperspectral cube map through an automatic codec based image noise reducer to obtain a generated hyperspectral cube map comprises:
inputting the hyperspectral cube map into an encoder of the image noise reducer, wherein the encoder uses a convolutional layer to perform explicit spatial encoding on the hyperspectral cube map to obtain hyperspectral cube map image features; and
inputting the hyperspectral cube map image features into a decoder of the image noise reducer, wherein the decoder performs deconvolution processing on the hyperspectral cube map image features by using an deconvolution layer to obtain the generated hyperspectral cube map.
10. The intelligent food detection method according to claim 9, wherein the passing the spectral images at the respective wavelengths of the spectral images at the plurality of wavelengths in the generated hyperspectral cube map through a first convolution neural network model using a spatial attention mechanism to obtain a plurality of image feature matrices comprises:
depth convolution coding is carried out on the spectral image by using a convolution coding part of the first convolution neural network model so as to obtain an initial convolution characteristic map;
inputting the initial convolution feature map into a spatial attention portion of the first convolutional neural network model to obtain a spatial attention map;
passing the spatial attention map through a Softmax activation function to obtain a spatial attention feature map;
calculating the multiplication of the spatial attention feature map and the initial convolution feature map according to position points to obtain an image feature map; and
and carrying out global mean pooling along the channel dimension on the image feature map to obtain the image feature matrix.
CN202211624870.7A 2022-12-16 2022-12-16 Intelligent food detection system and method thereof Pending CN115839923A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211624870.7A CN115839923A (en) 2022-12-16 2022-12-16 Intelligent food detection system and method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211624870.7A CN115839923A (en) 2022-12-16 2022-12-16 Intelligent food detection system and method thereof

Publications (1)

Publication Number Publication Date
CN115839923A true CN115839923A (en) 2023-03-24

Family

ID=85578739

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211624870.7A Pending CN115839923A (en) 2022-12-16 2022-12-16 Intelligent food detection system and method thereof

Country Status (1)

Country Link
CN (1) CN115839923A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116106457A (en) * 2023-04-13 2023-05-12 天津海河标测技术检测有限公司 Air sampling and detecting integrated device
CN116858509A (en) * 2023-05-24 2023-10-10 车金喜汽配股份有限公司 Processing system and method for automobile parts

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116106457A (en) * 2023-04-13 2023-05-12 天津海河标测技术检测有限公司 Air sampling and detecting integrated device
CN116858509A (en) * 2023-05-24 2023-10-10 车金喜汽配股份有限公司 Processing system and method for automobile parts

Similar Documents

Publication Publication Date Title
CN115839923A (en) Intelligent food detection system and method thereof
Dai et al. Advances in feature selection methods for hyperspectral image processing in food industry applications: A review
Cheng et al. Integration of classifiers analysis and hyperspectral imaging for rapid discrimination of fresh from cold-stored and frozen-thawed fish fillets
Pu et al. Using wavelet textural features of visible and near infrared hyperspectral image to differentiate between fresh and frozen–thawed pork
Yang et al. Fusion of spectra and texture data of hyperspectral imaging for the prediction of the water-holding capacity of fresh chicken breast filets
Jiang et al. Application of hyperspectral imaging for detecting and visualizing leaf lard adulteration in minced pork
Jiang et al. Feasibility of identifying the authenticity of fresh and cooked mutton kebabs using visible and near-infrared hyperspectral imaging
Zhang et al. Feasibility of the detection of carrageenan adulteration in chicken meat using visible/near-infrared (vis/nir) hyperspectral imaging
CN110321943B (en) CT image classification method, system and device based on semi-supervised deep learning
Hu et al. A rapid, low-cost deep learning system to classify squid species and evaluate freshness based on digital images
Zhang et al. Rapid identification of lamb freshness grades using visible and near-infrared spectroscopy (Vis-NIR)
Feng et al. Hyperspectral imaging in tandem with R statistics and image processing for detection and visualization of pH in Japanese big sausages under different storage conditions
US20240104900A1 (en) Fish school detection method and system thereof, electronic device and storage medium
CN116012837A (en) Food quality detection system based on nondestructive detection and detection method thereof
Ye et al. NIR hyperspectral imaging technology combined with multivariate methods to identify shrimp freshness
Qi et al. Moldy peanut kernel identification using wavelet spectral features extracted from hyperspectral images
CN116858789A (en) Food safety detection system and method thereof
Chen et al. Application of artificial fish swarm algorithm for synchronous selection of wavelengths and spectral pretreatment methods in spectrometric analysis of beef adulteration
CN115861887A (en) Fungus detection method for black garlic
Tian et al. Research on apple origin classification based on variable iterative space shrinkage approach with stepwise regression–support vector machine algorithm and visible‐near infrared hyperspectral imaging
Jiang et al. Chemometrics in tandem with hyperspectral imaging for detecting authentication of raw and cooked mutton rolls
Yang et al. Detection of starch in minced chicken meat based on hyperspectral imaging technique and transfer learning
León-Ecay et al. Classification of beef longissimus thoracis muscle tenderness using hyperspectral imaging and chemometrics
Sun et al. Quantitative detection of myoglobin content in tan mutton during cold storage by near-infrared hyperspectral imaging
Huang et al. Detection of early bruises in Gongcheng persimmon using hyperspectral imaging

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20230324