Mutton staphylococcus aureus pollution concentration detection method based on combination of 2DCOS and 1DCNN-LSTM-Self-Attention
By combining shortwave infrared hyperspectral technology with 2DCOS and improved 1DCNN-LSTM-Self-Attention network model, the complexity and low accuracy of mutton Staphylococcus aureus pollution detection are solved, and fast, lossless and accurate pollution concentration prediction is achieved.
Patent Information
- Application Number
- CN202411287090.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-08-26
AI Technical Summary
The existing mutton Staphylococcus aureus pollution detection technology has complex operation, long detection cycle, expensive instruments, and the traditional identification model has complex pre-processing and low accuracy, making it difficult to achieve fast, lossless and accurate pollution concentration prediction.
Combining short-wave infrared hyperspectral technology and 2DCOS, using the improved 1DCNN-LSTM-Self-Attention network model, a characteristic wavelength related to the concentration of mutton Staphylococcus aureus was extracted, and a prediction model for contamination concentration of mutton Staphylococcus aureus was constructed, and rapid and non-destructive detection was performed by collecting hyperspectral image data.
It realizes fast, non-destructive and accurate detection of mutton Staphylococcus aureus contamination concentration, simplifies the operation process, reduces dependence on professional and technical personnel, and improves the accuracy and robustness of the detection.
Smart Images

Figure CN120539079A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of nondestructive detection of the safety and quality of meat microbial contamination, and specifically relates to a method for predicting the contamination concentration of Staphylococcus aureus in mutton by combining short-wave infrared hyperspectral technology with 2DCOS and then using an improved 1DCNN-LSTM-Self-Attention network model. Background Art
[0002] Staphylococcus aureus is the main cause of food safety issues in meat. Mutton is rich in nutrients and is prone to breeding S. aureus. According to the national standard GB 29921-2021 "National Food Safety Standard Limits of Pathogenic Bacteria in Pre-packaged Foods", the content of S. aureus in fresh meat shall not exceed 3 lgCFU / g. Therefore, rapid detection of S. aureus in mutton is of great significance to ensuring consumer safety and reducing the outbreak rate of foodborne diseases. At present, traditional culture detection methods for pathogenic bacteria in mutton have problems such as complex detection operation and long detection cycle. It is necessary to further develop its rapid detection method and detection system. At present, the detection technology of S. aureus contamination concentration in mutton in the projects disclosed by Chinese patents mainly includes four categories: traditional culture method, immunology, molecular biology and biosensor. These three detection technologies have disadvantages such as complex sample pretreatment, damage to samples, requirement of professional operators, and difficulty in promotion and application. Because hyperspectral imaging technology allows for rapid, green, non-destructive detection of pathogens based on their spectral differences, this paper attempts to combine shortwave infrared hyperspectral technology with 2DCOS and deep learning to develop a method for predicting Staphylococcus aureus contamination concentration in mutton using an improved convolutional neural network model. Convolutional neural networks, as a deep learning algorithm, can automatically extract features, offering high accuracy and robustness compared to existing traditional analysis methods. They are an effective spectral statistics and analysis method. However, no method combining shortwave infrared hyperspectral technology with 2DCOS and deep learning for predicting Staphylococcus aureus contamination concentration in mutton has been reported. Summary of the Invention
[0003] The purpose of the present invention is to provide a method for detecting the contamination concentration of Staphylococcus aureus in mutton based on 2DCOS combined with 1DCNN-LSTM-Self-Attention. Based on the fact that mutton contaminated with different concentrations of Staphylococcus aureus has certain differences in chemical composition, the short-wave infrared hyperspectral image data of mutton samples contaminated with different concentrations of Staphylococcus aureus are collected, the 2DCOS method is used to extract characteristic wavelengths closely related to the concentration of Staphylococcus aureus in mutton, and the 1DCNN-LSTM-Self-Attention network is used to predict the contamination concentration of Staphylococcus aureus in mutton based on spectral data. The present invention aims to solve the problems of complex operation, expensive instruments, complex preprocessing and low accuracy of traditional recognition models for the contamination concentration of Staphylococcus aureus in mutton, and the large number of characteristic wavelengths and low model accuracy when using spectral data for detection.
[0004] The technical solution adopted in the present invention is as follows: A method for detecting Staphylococcus aureus contamination concentration in mutton based on 2DCOS combined with 1DCNN-LSTM-Self-Attention is characterized by first extracting hyperspectral characteristic wavelengths based on the 2DCOS method to establish a 1DCNN-LSTM-Self-Attention model for predicting Staphylococcus aureus contamination concentration in mutton, and then using this model to predict the Staphylococcus aureus contamination concentration in mutton; The specific steps of establishing the Staphylococcus aureus contamination concentration detection model on mutton are as follows: Step 1: Sample preparation, 10 1 , 10 2 , 10 3 , 10 4 , 10 5 , 10 6 , 10 7 Lamb meat samples contaminated with Staphylococcus aureus at seven concentrations of 1g CFU / mL were stored at 4°C to prepare model samples contaminated with different concentrations of Staphylococcus aureus; Step 2: Place the modeled sample in a sample dish and place it on a placement rack of a hyperspectral imaging system to collect hyperspectral image data of samples with different concentrations of Staphylococcus aureus; Step 3: Perform black and white correction on all collected sample hyperspectral image data; Step 4: Use the threshold segmentation method to remove background information such as the culture dish and the rack, and extract the mutton sample area as the region of interest. Extract 10 representative spectra from each sample region of interest for modeling; Step 5: Construct a 1DCNN-LSTM-Self-Attention convolutional neural network model, whose architecture consists of 2 1D convolutional layers, 2 maximum pooling layers, 1 LSTM layer, 1 Self-Attention layer, and 1 FC layer. The kernel size and step size are set to 1 and 1, the number of convolution kernels of the optimal model is (32, 16), the activation function is ReLU, and the number of LSTM hidden units is 64. The remaining parameters are set as follows: the batch size is set to 256, the maximum number of iterations is 200, the initial learning rate is 0.001, the optimizer is Adam, the L2Regularization parameter is 0.01, the learning rate drop is piecewise, the learning rate drop factor is 0.1, and the LearnRateDropPeriod is 200. The model is trained using the training set sample data set. During the training process, convolutional neural networks with different numbers of convolution kernels and activation functions are established, and tested using the sample test set data. By comparing the determination coefficient of the model R 2 , root mean square error RMSE and relative prediction bias RPD Parameters are optimized based on evaluation indicators such as self-attention, and the model is improved to establish the best convolutional neural network prediction model based on the optimized parameters; Step 6: Using the concentration of Staphylococcus aureus as external interference, 2DCOS was used to extract seven characteristic wavelengths closely related to the concentration of Staphylococcus aureus on mutton, namely, wavelengths at 1185.73, 1457.16, 1305.07, 1837.47, 2038.88, 2286.04, and 2400.11 nm; The specific steps of using the prediction model to predict the concentration of Staphylococcus aureus on mutton are as follows: Step A, preparing mutton samples contaminated with Staphylococcus aureus at different concentrations into test samples; Step B: placing the test sample into a sample dish on a culture dish placement rack of a hyperspectral imaging system, and collecting hyperspectral image data of samples with different concentrations of Staphylococcus aureus; Step C: performing black and white correction on all collected sample hyperspectral image data according to formula 1; Step D: Using the threshold segmentation method to remove background information such as the culture dish and the rack, the mutton sample area was extracted as the region of interest. Ten representative spectra were extracted from each sample region of interest for modeling; Step E: extracting information of seven characteristic wavelengths screened by 2DCOS for model prediction, namely wavelengths at 1185.73, 1457.16, 1305.07, 1837.47, 2038.88, 2286.04, and 2400.11 nm; Step F: inputting a single or multiple spectral data of the sample region of interest into the optimally established prediction model, and determining the contamination result of the sample by directly predicting a single spectral data of the sample or comprehensively analyzing the prediction of multiple spectral data.
[0005] In the above steps 1 and A, when preparing the sample, a concentration range of Staphylococcus aureus is selected to cover the common contamination range. In order to produce samples with basically consistent quality and shape, obvious fascia and tissue are removed and weighed and divided.
[0006] In steps 2 and B above, the wavelength of the hyperspectral imaging system is 907.92–22711.59 nm, and a total of 288 bands can be obtained within this wavelength range. The hyperspectral image of the sample is collected in diffuse reflectance mode with a spectral resolution of 12 nm, a sampling interval of 5.6 nm, a distance between the upper surface of the sample and the lens of 25 cm, an exposure time of 3.5 ms, and a translation stage speed of 70.3813 mm / s.
[0007] In the above steps 4 and 5, there are multiple optional extraction methods for extracting representative spectral data from hyperspectral image data. The present invention selects the average spectrum of 20% of all pixels in the sample area of interest as the representative spectrum each time, selects 10 times for each sample, and obtains 10 representative spectral data.
[0008] In step 5 above, the optimal discriminant model established is a one-dimensional convolutional neural network, whose architecture consists of two 1D convolutional layers, two maximum pooling layers, one LSTM layer, one self-attention layer, and one FC layer. The kernel size and stride are set to 1 and 1 respectively. The optimal model has the following convolution kernels: (32, 16), the activation function is ReLU, the number of LSTM hidden units is 64, the batch size is set to 256, the maximum number of iterations is 200, the initial learning rate is 0.001, the optimizer is Adam, the L2Regularization parameter is 0.01, and a dropout layer is added after maxpooling to further reduce the risk of model overfitting. The learning rate drop is piecewise, the learning rate drop factor is 0.1, and the LearnRateDropPeriod is 200.
[0009] In the above steps 6 and E, when 2DCOS is used to extract characteristic wavelengths closely related to the concentration of Staphylococcus aureus on mutton, it can be obtained through two methods: synchronous correlation spectroscopy and asynchronous correlation spectroscopy. The present invention uses synchronous correlation spectroscopy, using the concentration of Staphylococcus aureus as external interference, and obtaining the automatic peak of the synchronous correlation spectrum as the characteristic wavelength.
[0010] In step 7 above, when using feature wavelengths to establish a 1DCNN-Self-Attention prediction model, the model performance was poor due to the small number of feature wavelengths. Introducing the LSTM module to construct a 1DCNN-LSTM-Self-Attention integrated model effectively improved the model's prediction performance.
[0011] The detection system used in steps 2 and 3 above includes a SWIR imaging spectrometer, a high-resolution camera, a 150 W halogen array light source and its associated fiber optic illumination unit, positioned at approximately 45° angles on either side of the imaging spectrometer, a motorized translation stage primarily driven by a stepper motor, a computer with data acquisition software, and a darkroom. All of this equipment is housed within a darkroom to minimize the impact of stray light on the data. Data acquisition is performed using Spectral Image System software, whose interface enables real-time display, automatic storage, and discriminant analysis of hyperspectral image data.
[0012] Compared with the prior art, the present invention has the following advantages: First, the identification method of the present invention has the advantages of being green, rapid, requiring no professional technicians, and being easy to implement high-throughput detection; Second, the discrimination method of the present invention effectively extracts characteristic wavelengths that are closely related to the concentration of Staphylococcus aureus contaminating mutton. The characteristic wavelengths have good interpretability. Combined with the independently built 1DCNN-LSTM-Self-Attention integrated model, a prediction model with the advantages of a small number of features, high accuracy, and strong robustness can be established. Third, the present invention provides technical support and reference for the prediction of the contamination concentration of Staphylococcus aureus and other meat-borne pathogens on mutton, and also provides new ideas and methods for the application of short-wave infrared hyperspectral imaging technology in the field of food microbial contamination detection. BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 Figure 1 is a summary of the present invention Figure 2 Schematic diagram of the hyperspectral image data acquisition system involved in Examples 1 and 2 of the present invention Figure 3 This is a diagram of a representative spectral data extraction process involved in Example 2 of the present invention. Figure 4The full spectrum and average spectral reflectance curves of mutton samples contaminated with different concentrations of Staphylococcus aureus involved in Example 2 of the present invention: (a) All sample curves; (b) Average spectral curves of different concentrations of Staphylococcus aureus Figure 5 The model architecture diagram for the improved 1DCNN-LSTM-Self-Attention model involved in Example 2 of the present invention is constructed Figure 6 This is a diagram of the convolutional neural network model training process under different learning rates involved in Example 2 of the present invention. Figure 7 This is the analysis result diagram of characteristic wavelength extraction using two-dimensional correlation spectroscopy involved in Example 2 of the present invention Figure 8 This is a distribution diagram of the results of the 1DCNN-LSTM-Self-Attention model for detecting Staphylococcus aureus contamination concentration on mutton based on the characteristic wavelengths screened by 2DCOS involved in Example 2 of the present invention.
Claims
1. A method for detecting Staphylococcus aureus contamination concentration in mutton based on 2DCOS combined with 1DCNN-LSTM-Self-Attention, characterized by: First, the 2DCOS method was used to extract the characteristic wavelengths related to the concentration of Staphylococcus aureus contamination in mutton. Based on the characteristic wavelengths, a detection model for Staphylococcus aureus contamination concentration in mutton was established in combination with 1DCNN-LSTM-Self-Attention. This model was then used to detect the contamination concentration of Staphylococcus aureus in mutton. The specific steps of establishing the Staphylococcus aureus contamination concentration detection model on mutton are as follows: Step 1: Sample preparation, 10 1 , 10 2 , 10 3 , 10 4 , 10 5 , 10 6 , 10 7 Lamb meat samples contaminated with Staphylococcus aureus at seven concentrations of 1g CFU / mL were stored at 4°C to prepare model samples contaminated with different concentrations of Staphylococcus aureus; Step 2: Place the modeled sample in a sample dish and place it on a placement rack of a hyperspectral imaging system to collect hyperspectral image data of samples with different concentrations of Staphylococcus aureus; Step 3: Perform black and white correction on all collected sample hyperspectral image data; Step 4: Use the threshold segmentation method to remove background information such as the culture dish and the rack, and extract the mutton sample area as the region of interest. Extract 10 representative spectra from each sample region of interest for modeling; Step 5: Construct a 1DCNN convolutional neural network model, which consists of 2 1D convolutional layers, 2 maximum pooling layers, and 1 FC layer. The spectrum of each sample contains 223 wavelengths, which are converted into a 223×1×1 vector. In addition, batch normalization is used for processing and used as the input of the 1D convolutional layer. The kernel size and step size are set to 5 and 1, the number of convolution kernels of the optimal model is (32, 16), the activation function is ReLU, the batch size is set to 256, the maximum number of iterations is 200, the initial learning rate is 0.001, the optimizer is Adam, the L2Regularization parameter is 0.01, the learning rate drop is piecewise, the learning rate drop factor is 0.1, and the LearnRateDropPeriod is 200; Step 6: Using the concentration of Staphylococcus aureus as external interference, 2DCOS was used to extract seven characteristic wavelengths closely related to the concentration of Staphylococcus aureus on mutton, namely 1185.73, 1457.16, 1305.07, 1837.47, 2038.88, 2286.04, and 2400.11 nm; Step 7. Use the characteristic wavelengths screened in step 6 to establish a 1DCNN model for predicting the concentration of Staphylococcus aureus contaminated on mutton, and improve the model by combining Self-Attention and LSTM. Based on the preferred parameters, establish the optimal convolutional neural network prediction 1DCNN-LSTM-Self-Attention model, which consists of 2 1D convolution layers, 2 maximum pooling layers, 1 LSTM layer, 1 Self-Attention and 1 FC layer. The kernel size and step size are set to 1 and 1, the number of convolution kernels of the optimal model is (32, 16), the activation function is ReLU, and the number of LSTM hidden units is 64. The remaining parameters are set as follows: the batch size is set to 256, the maximum number of iterations is 200, the initial learning rate is 0.001, the optimizer is Adam, the L2Regularization parameter is 0.01, the learning rate drop is piecewise, the drop factor is 0.1, the LearnRateDropPeriod is 200, and the coefficient of determination is used. R 2 , root mean square error RMSE and relative prediction bias RPD Evaluate the model effect with other evaluation indicators. If the model effect meets the requirements, it means the model is feasible; otherwise, expand the sample set and optimize the model and repeat steps 1 to 8 until the requirements are met; The specific steps of using the prediction model to predict the concentration of Staphylococcus aureus on mutton are as follows: Step A: preparing mutton samples contaminated with Staphylococcus aureus at different concentrations into test samples; Step B: placing the test sample into a sample dish on a culture dish placement rack of a hyperspectral imaging system, and collecting hyperspectral image data of samples with different concentrations of Staphylococcus aureus; Step C: performing black and white correction on all collected sample hyperspectral image data according to formula 1; in, I c This is the hyperspectral image after black and white correction; I s is the original hyperspectral image; I d is a dark reflectance image (approximately 0% reflectance), obtained by closing the camera lens; I w is a white reference image (approximately 99% reflectivity), obtained by diffuse reflection from a standard white board; Step D: Using the threshold segmentation method to remove background information such as the culture dish and the rack, and extracting the mutton sample area as the region of interest, 10 representative spectra were extracted from each sample region of interest for modeling; Step E: Using 2DCOS to screen seven characteristic wavelengths for model prediction, they are 1185.73, 1457.16, 1305.07, 1837.47, 2038.88, 2286.04, and 2400.11 nm; Step F: inputting a single or multiple spectral data at the characteristic wavelength of the sample into the prediction model established through optimization, and determining the contamination result of the sample by directly predicting the single spectral data of the sample or comprehensively analyzing the prediction of multiple spectral data.
2. The method for detecting Staphylococcus aureus contamination concentration in mutton based on 2DCOS combined with 1DCNN-LSTM-Self-Attention according to claim 1 is characterized by: In step 1 and step A, when preparing the sample, a concentration range of Staphylococcus aureus is selected to cover the common contamination range, and the sample is removed of obvious fascia and tissue and weighed and divided, and its mass and shape are basically consistent.
3. The method for detecting Staphylococcus aureus contamination concentration in mutton based on 2DCOS combined with 1DCNN-LSTM-Self-Attention according to claim 1 is characterized in that: In step 2 and step B, the wavelength of the hyperspectral imaging system is 907.92~2271.59 nm, and a total of 288 bands can be obtained within its wavelength range; the hyperspectral image of the sample is collected in diffuse reflectance mode with a spectral resolution of 12 nm, the distance between the upper surface of the sample and the lens is 25 cm, the exposure time is 3.5 ms, and the translation stage speed is 70.3813 mm / s.
4. The method for detecting Staphylococcus aureus contamination concentration in mutton based on 2DCOS combined with 1DCNN-LSTM-Self-Attention according to claim 1, characterized in that: In step 4 and step D, when extracting representative spectral data from the hyperspectral image data, there are multiple optional extraction methods such as random pixel points, average of all pixel points, and average of some pixel points. The present invention selects 20% of the average pixel spectra of all pixel points in the sample area of interest each time as the representative spectrum, selects 10 times for each sample, and obtains 10 representative spectral data.
5. The method for detecting Staphylococcus aureus contamination concentration in mutton based on 2DCOS combined with 1DCNN-LSTM-Self-Attention according to claim 1, characterized in that: In step 6 and step E, when 2DCOS is used to extract characteristic wavelengths closely related to the concentration of Staphylococcus aureus on mutton, the wavelengths can be obtained by synchronous correlation spectroscopy and asynchronous correlation spectroscopy. The present invention uses synchronous correlation spectroscopy, uses the concentration of Staphylococcus aureus as external interference, and obtains the automatic peak of the synchronous correlation spectrum as the characteristic wavelength. The seven characteristic wavelengths extracted are 1185.73, 1457.16, 1305.07, 1837.47, 2038.88, 2286.04 and 2400.11 nm, respectively.
6. The method for detecting Staphylococcus aureus contamination concentration in mutton based on 2DCOS combined with 1DCNN-LSTM-Self-Attention according to claim 1, characterized in that: In step 7, the optimal discriminant model established is a 1DCNN-LSTM-Self-Attention network, whose architecture consists of two 1D convolutional layers, two maximum pooling layers, one LSTM layer, one Self-Attention layer, and one FC layer. The kernel size and stride are set to 1 and 1 respectively. The optimal model has (32, 16) convolution kernels, a ReLU activation function, and 64 LSTM hidden units. The remaining parameters are set as follows: batch size is set to 256, maximum number of iterations is 200, initial learning rate is 0.001, Adam optimizer is selected, L2Regularization parameter is 0.01, piecewise learning rate descent is selected with a descent factor of 0.1, and LearnRateDropPeriod is 200.
7. The method for detecting Staphylococcus aureus contamination concentration in mutton based on 2DCOS combined with 1DCNN-LSTM-Self-Attention according to claim 1, characterized in that: In step 7, when the 1DCNN-Self-Attention prediction model is established using the characteristic wavelength, the performance of the 1DCNN model is poor due to the small number of characteristic wavelengths. The introduction of the LSTM module and the Self-Attention mechanism to construct a 1DCNN-LSTM-Self-Attention integrated model effectively improves the model prediction performance.
8. The method for detecting Staphylococcus aureus contamination concentration in mutton based on 2DCOS combined with D-CNN-LSTM-Self-Attention according to claim 1, characterized in that: The detection system used in the method described in this invention includes a SWIR imaging spectrometer, a high-resolution camera, a 150 W halogen array light source positioned at approximately 45° angles on either side of the imaging spectrometer, an adjustable motorized translation stage driven by a stepper motor, a computer, and a darkroom. All of these devices are housed within a darkroom to minimize the impact of stray light on the data. Data acquisition is performed using Spectral Image System software, whose interface enables real-time display, automatic storage, and discriminant analysis of hyperspectral image data.