CN113418889B - Real-time detection method for water content and total colony count of dried vegetables based on deep learning - Google Patents
Real-time detection method for water content and total colony count of dried vegetables based on deep learning Download PDFInfo
- Publication number
- CN113418889B CN113418889B CN202110531732.3A CN202110531732A CN113418889B CN 113418889 B CN113418889 B CN 113418889B CN 202110531732 A CN202110531732 A CN 202110531732A CN 113418889 B CN113418889 B CN 113418889B
- Authority
- CN
- China
- Prior art keywords
- sample
- laver
- moisture content
- samples
- dried
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 34
- 235000013311 vegetables Nutrition 0.000 title claims abstract description 26
- 238000013135 deep learning Methods 0.000 title claims abstract description 20
- 238000011897 real-time detection Methods 0.000 title claims abstract description 11
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 title description 6
- 241000206607 Porphyra umbilicalis Species 0.000 claims abstract description 59
- 238000001228 spectrum Methods 0.000 claims abstract description 37
- 238000002329 infrared spectrum Methods 0.000 claims abstract description 32
- 230000001580 bacterial effect Effects 0.000 claims abstract description 25
- 238000007781 pre-processing Methods 0.000 claims abstract description 9
- 230000002159 abnormal effect Effects 0.000 claims abstract description 7
- 239000000523 sample Substances 0.000 claims description 101
- 238000012360 testing method Methods 0.000 claims description 25
- 238000012549 training Methods 0.000 claims description 20
- 238000004422 calculation algorithm Methods 0.000 claims description 13
- 230000006870 function Effects 0.000 claims description 9
- -1 polytetrafluoroethylene Polymers 0.000 claims description 8
- 229920001343 polytetrafluoroethylene Polymers 0.000 claims description 8
- 239000004810 polytetrafluoroethylene Substances 0.000 claims description 8
- 238000011176 pooling Methods 0.000 claims description 8
- 230000004913 activation Effects 0.000 claims description 6
- 238000004519 manufacturing process Methods 0.000 claims description 6
- 238000012545 processing Methods 0.000 claims description 6
- 241000894006 Bacteria Species 0.000 claims description 4
- 238000001599 direct drying Methods 0.000 claims description 4
- 210000002569 neuron Anatomy 0.000 claims description 3
- 230000007480 spreading Effects 0.000 claims description 2
- 238000003892 spreading Methods 0.000 claims description 2
- 238000001514 detection method Methods 0.000 abstract description 21
- 238000013528 artificial neural network Methods 0.000 abstract description 6
- 238000005516 engineering process Methods 0.000 abstract description 3
- 230000010354 integration Effects 0.000 abstract description 3
- 235000013305 food Nutrition 0.000 description 5
- 241000206613 Pyropia yezoensis Species 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 3
- 239000011159 matrix material Substances 0.000 description 3
- 239000000126 substance Substances 0.000 description 3
- 230000003750 conditioning effect Effects 0.000 description 2
- 238000013527 convolutional neural network Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000011156 evaluation Methods 0.000 description 2
- 238000005259 measurement Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 102000004169 proteins and genes Human genes 0.000 description 2
- 108090000623 proteins and genes Proteins 0.000 description 2
- 239000002028 Biomass Substances 0.000 description 1
- 229920002488 Hemicellulose Polymers 0.000 description 1
- 238000004497 NIR spectroscopy Methods 0.000 description 1
- 241001520913 Phyllostachys edulis Species 0.000 description 1
- 235000003570 Phyllostachys pubescens Nutrition 0.000 description 1
- 238000010521 absorption reaction Methods 0.000 description 1
- 230000003042 antagnostic effect Effects 0.000 description 1
- 210000002421 cell wall Anatomy 0.000 description 1
- 229920002678 cellulose Polymers 0.000 description 1
- 239000001913 cellulose Substances 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000003745 diagnosis Methods 0.000 description 1
- 230000004069 differentiation Effects 0.000 description 1
- 239000006185 dispersion Substances 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000008030 elimination Effects 0.000 description 1
- 238000003379 elimination reaction Methods 0.000 description 1
- 238000000855 fermentation Methods 0.000 description 1
- 230000004151 fermentation Effects 0.000 description 1
- 150000004676 glycans Chemical class 0.000 description 1
- 229920005610 lignin Polymers 0.000 description 1
- 239000002207 metabolite Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000003909 pattern recognition Methods 0.000 description 1
- 229920001282 polysaccharide Polymers 0.000 description 1
- 239000005017 polysaccharide Substances 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 230000003595 spectral effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012706 support-vector machine Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/17—Systems in which incident light is modified in accordance with the properties of the material investigated
- G01N21/25—Colour; Spectral properties, i.e. comparison of effect of material on the light at two or more different wavelengths or wavelength bands
- G01N21/31—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry
- G01N21/35—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry using infrared light
- G01N21/3563—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry using infrared light for analysing solids; Preparation of samples therefor
-
- C—CHEMISTRY; METALLURGY
- C12—BIOCHEMISTRY; BEER; SPIRITS; WINE; VINEGAR; MICROBIOLOGY; ENZYMOLOGY; MUTATION OR GENETIC ENGINEERING
- C12Q—MEASURING OR TESTING PROCESSES INVOLVING ENZYMES, NUCLEIC ACIDS OR MICROORGANISMS; COMPOSITIONS OR TEST PAPERS THEREFOR; PROCESSES OF PREPARING SUCH COMPOSITIONS; CONDITION-RESPONSIVE CONTROL IN MICROBIOLOGICAL OR ENZYMOLOGICAL PROCESSES
- C12Q1/00—Measuring or testing processes involving enzymes, nucleic acids or microorganisms; Compositions therefor; Processes of preparing such compositions
- C12Q1/02—Measuring or testing processes involving enzymes, nucleic acids or microorganisms; Compositions therefor; Processes of preparing such compositions involving viable microorganisms
- C12Q1/04—Determining presence or kind of microorganism; Use of selective media for testing antibiotics or bacteriocides; Compositions containing a chemical indicator therefor
- C12Q1/06—Quantitative determination
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/17—Systems in which incident light is modified in accordance with the properties of the material investigated
- G01N21/25—Colour; Spectral properties, i.e. comparison of effect of material on the light at two or more different wavelengths or wavelength bands
- G01N21/31—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry
- G01N21/35—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry using infrared light
- G01N21/359—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry using infrared light using near infrared light
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/243—Classification techniques relating to the number of classes
- G06F18/2431—Multiple classes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Chemical & Material Sciences (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Spectroscopy & Molecular Physics (AREA)
- Evolutionary Computation (AREA)
- Molecular Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Biophysics (AREA)
- Organic Chemistry (AREA)
- Immunology (AREA)
- Biochemistry (AREA)
- Analytical Chemistry (AREA)
- Computing Systems (AREA)
- Proteomics, Peptides & Aminoacids (AREA)
- Bioinformatics & Computational Biology (AREA)
- Mathematical Physics (AREA)
- Biomedical Technology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Pathology (AREA)
- Zoology (AREA)
- Software Systems (AREA)
- Wood Science & Technology (AREA)
- Computational Linguistics (AREA)
- Microbiology (AREA)
- Biotechnology (AREA)
- Toxicology (AREA)
- Genetics & Genomics (AREA)
- Investigating Or Analysing Materials By Optical Means (AREA)
Abstract
The invention provides a real-time detection method for the moisture content and the total number of bacterial colonies of dried vegetables based on deep learning. The real-time detection method comprises the following steps: (1) collecting a dried vegetable sample; (2) collecting a near infrared spectrum of the sample; (3) calibrating the moisture content of the sample and the total colony count; (4) identifying and rejecting abnormal samples; (5) sample spectrum information preprocessing; (6) creating a sample dataset; (7) establishing a prediction model; (8) checking and correcting the prediction model; and (9) model integration. According to the invention, by combining the deep learning neural network with the near infrared spectrum technology, the characteristics of linear factors and nonlinear factors related to the moisture content and the total number of bacterial colonies in the laver are comprehensively utilized, and the real-time rapid detection of the sample is realized by combining the portable spectrum equipment.
Description
Technical Field
The invention belongs to the field of food safety detection, and particularly relates to a real-time detection method for the moisture content and the total number of bacterial colonies of dried vegetables based on deep learning.
Background
The moisture content and the total number of bacterial colonies are important factors influencing the quality of the dried laver, and have great influence on the sensory, safety and shelf life of the dried laver. The quality safety of dried laver becomes the focus of world laver trade competition and is also a decisive factor of transaction success or failure and transaction pricing. In the present stage, the indexes of the moisture content and the total colony count of the dry laver are still carried out by adopting the traditional detection means, but the evaluation period is too long, the additional cost is high, and the detection requirement of a large quantity in the trading period is difficult to meet. Therefore, a real-time rapid detection method for detecting the moisture content and the total number of bacterial colonies in the dried laver on site is not yet available.
Near infrared spectroscopy utilizes the optical properties of chemicals in the near infrared region of the spectrum to rapidly determine the content and identity of one or more chemical components in a sample. For example, the biomass and the component concentration in the fermentation process are detected by combining near infrared spectrum with a least square, a support vector machine and regression; hemicellulose, cellulose and lignin in phyllostachys pubescens are determined by combining near infrared spectrum with ANN and PLSR-SVM. However, the infrared spectrum wavelength number is far greater than the acquired sample number, so that the existing modeling method has the problems of poor collinearity, overfitting and the like, and meanwhile, the solving capability on nonlinear relation variables is poor. In order to solve these problems, complicated dimension reduction processing is often required for the spectrum data in modeling and detection, but the selection of the spectrum information is subjective, so that the characteristic spectrum information is difficult to effectively and comprehensively cover.
In addition, near infrared spectrum information is derived from the frequency multiplication and frequency combination of the internal vibration of the molecule, and mainly reflects the frequency multiplication and frequency combination vibration absorption of the C-H, N-H, O-H group in the molecule. The dried laver has therein components of sugar, protein, etc. containing a large amount of C-H, N-H, O-H chemical bonds, which interfere with the measurement of the moisture content mainly of O-H bonds. On the other hand, the total number of bacterial colonies in the laver is quantitatively calibrated by integrating the spectrum information of some unknown components such as cell wall polysaccharide, protein, metabolite and the like. Therefore, the interference among components and the uncertainty of characteristic components are also key factors for limiting the application of the existing method to the real-time and rapid detection of the moisture content and the total colony count of the dried laver.
The deep learning algorithm has multidimensional data processing capability and excellent feature learning capability, and has great influence in the fields of face recognition, intelligent diagnosis and the like. Establishing a real-time rapid detection model based on a deep learning method is a potential feasible scheme.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a real-time detection method for the moisture content and the total number of bacterial colonies of dried vegetables based on deep learning. The detection method provided by the invention avoids a complicated spectrum pretreatment process in the existing detection method, realizes real-time and rapid detection of the moisture content and the total number of bacterial colonies of the dried laver, shortens the detection period, effectively improves the use convenience of detection personnel, and can also meet the real-time detection requirements of a large number of on-site and improve the detection effect and accuracy.
In order to achieve the aim of the invention, the invention is realized by adopting the following technical scheme:
a real-time detection method for the moisture content and the total number of bacterial colonies of dried vegetables based on deep learning comprises the following steps:
(1) Collecting at least 500 dried vegetable samples of different manufacturers and different production places, covering the dried vegetable samples processed in various seasons, and carrying out conditioning and bacteria increasing treatment on at least 100 dried vegetable samples at random respectively;
(2) Collecting near infrared spectrum of the dried vegetable sample by using a near infrared spectrum analyzer, wherein the scanning range is 700 nm-2500 nm, the resolution is 2 nm-8 nm, and taking the average value as near infrared spectrum data of the dried vegetable sample after scanning for 10-100 times;
(3) Measuring the moisture content and the total number of bacterial colonies in each dried vegetable sample by adopting a direct drying method and a plate counting method, setting 3 groups of parallel tests for each sample, and taking the average value of the parallel tests as a sample calibration value of the moisture content and the total number of bacterial colonies;
(4) Identifying and removing the dried vegetable samples with abnormal sample calibration values in the step (3) by adopting a Markov distance method, and reserving the dried vegetable samples with normal sample calibration values;
(5) Preprocessing the near infrared spectrum in the step (2), and eliminating noise doping and baseline drift to obtain preprocessed spectrum information;
(6) Respectively carrying out data grouping on the sample calibration value of the dried vegetable sample reserved in the step (4) and the pretreatment spectrum information in the step (5), and establishing the correlation between the moisture content of the dried vegetable sample, the total number of bacterial colonies and the spectrum information; randomly dividing the sample data with the established association into a training set sample and a test set sample according to the number ratio of 9:1, wherein the training set sample comprises associated sample data with different moisture contents and different amounts of colony count;
(7) Utilizing the training set sample in the step (6) to establish a prediction model of the moisture content and the total number of bacterial colonies of the dried vegetable sample through a deep learning network;
(8) Using the test set sample in the step (6) as an unknown sample, checking the prediction capacity of the prediction model in the step (7), and adjusting the prediction model according to the checking result to obtain an optimal prediction model;
(9) And (3) integrating the near infrared spectrum pretreatment algorithm based on Python with the optimal prediction model in the step (8), and detecting the moisture content and the total colony number of the dried vegetable sample in real time through direct input of the near infrared spectrum.
Preferably, in the step (2), a near infrared spectrum analyzer is used to collect near infrared spectrum of the dried vegetable sample, the scanning range is 900nm-1700nm, the resolution is 6 nm-7 nm, and after 50-100 times of scanning, the average value is taken as near infrared spectrum data of the dried vegetable sample.
Further, in the step (4), identifying and removing the dried vegetable samples with the sample calibration values larger than the threshold value of the mahalanobis distance by adopting a mahalanobis distance method, and reserving the dried vegetable samples with the sample calibration values smaller than or equal to the threshold value of the mahalanobis distance.
Further, the threshold calculation formula of the mahalanobis distance is as follows: threshold value =+α standard deviation, wherein->The mean value of the mahalanobis distance is given, and α is the standard deviation weight.
Further, the standard deviation weight is 3.4.
Further, the calculation formula of the mahalanobis distance is as follows:wherein->For the mean vector of the sample spectral matrix X, +.>Is covariance matrix>Is the spectrum of the ith sample.
Further, the preprocessing method of the near infrared spectrum comprises at least one of differentiation, multi-element scattering correction MSC, standard normal transformation SNV and continuous projection algorithm SPA.
Preferably, the preprocessing method of the near infrared spectrum is a continuous projection algorithm SPA.
Further, in the step (7), a predictive model of the moisture content and the total number of colonies of the dried vegetable sample is established through a deep learning network by using the training set sample at a learning rate of 0.0001 and a lot number of 256.
Further, the deep learning network in the step (7) includes at least one of a residual network res net, a convolutional neural network CNN, a deep neural network DNN, a cyclic neural network RNN, an antagonistic neural network GAN, and a deep belief network DBN.
Preferably, the deep learning network is a residual network ResNet.
Further, the deep learning network comprises a one-dimensional convolution layer, a full connection layer, a batch standardization layer and an activation function layer between the one-dimensional convolution layers, a maximum pooling layer positioned behind the first-layer convolution layer and an average pooling layer positioned behind the full connection layer, wherein the number of the one-dimensional convolution layers is more than or equal to 12.
Further, the convolution kernel number of the one-dimensional convolution layer is 64-512, the convolution kernel size of the first one-dimensional convolution layer is 5-12, and the step is 2-8; the convolution kernel size of the one-dimensional convolution layers of other layers is 1-7; the activation function employed by each one-dimensional convolution layer is ReLU.
Further, the dried vegetable includes dried laver.
After scheme optimization, the invention provides a real-time detection method for the moisture content and the total number of bacterial colonies of dry laver based on deep learning, which comprises the following steps:
(1) Collecting 500 dry laver samples of different manufacturers and different production places, covering the dry laver samples processed in various seasons, randomly carrying out moisture regaining treatment on 100 dry laver samples, and carrying out bacteria increasing treatment on 100 dry laver samples;
(2) Spreading a Shan Zhanggan laver sample on a polytetrafluoroethylene plate by taking polytetrafluoroethylene as a reference background, placing the polytetrafluoroethylene plate under a portable near infrared spectrum analyzer probe to collect near infrared spectrum of a dried laver sample, scanning the dried laver sample for 100 times with a scanning range of 900nm-1700nm and a resolution of 6.0nm, and taking an average value as near infrared spectrum data of the dried laver sample;
(3) Measuring the moisture content and the total number of bacterial colonies in each dry laver sample by adopting a direct drying method and a plate counting method, setting 3 groups of parallel tests for each sample, and taking the average value of the parallel tests as a sample calibration value of the moisture content and the total number of bacterial colonies of the dry laver sample;
(4) Identifying and removing the dried laver sample with abnormal sample calibration value in the step (3) by using a Markov distance method, and reserving the dried laver sample with normal sample calibration value so as to improve the prediction accuracy and stability of the model;
(5) Preprocessing the near infrared spectrum in the step (2) by adopting a continuous projection algorithm SPA, eliminating noise doping and baseline drift, and analyzing characteristic variables of the noise doping and baseline drift to obtain preprocessed spectrum information;
(6) Respectively carrying out data grouping on the sample calibration value of the dried laver sample reserved in the step (4) and the pretreated spectrum information in the step (5), and establishing the correlation between the moisture content and the total colony number of the dried laver sample and the spectrum information; randomly distributing the sample data with the established association into 450 training set samples and 50 test set samples, wherein the training set samples comprise associated sample data with different moisture contents and different amounts of total bacterial colony numbers;
(7) Depending on a Python learning framework, establishing a ResNet-18 depth residual error network; the ResNet-18 depth residual error network consists of 17 one-dimensional convolution layers and 1 full-connection layer; the convolution kernel size of the first convolution layer is 7, the convolution kernel number is 64, and the first convolution layer is followed by the largest pooling layer; the other convolution layers are divided into 4 ResBlock structures except the first convolution layer, each ResBlock comprises 4 convolution layers, the number of convolution kernels from top to bottom is 64, 128, 256 and 512, and the convolution kernels are 3; a batch standardization layer and an activation function layer exist between convolution layers in the ResBlock structure; the neuron number of the full-connection layer is 1, and an average pooling layer exists behind the full-connection layer;
utilizing the training set sample in the step (6), wherein the training iteration times are 300 times, the learning rate is 0.0001, the loss function adopts L2 norm, and meanwhile, the early_stopping strategy is adopted to prevent overfitting training, and a prediction model of the moisture content and the total colony number of the dry laver sample is established;
(8) Using 35 test set samples in the step (6) as unknown samples to test the prediction capability of the prediction model in the step (7), adjusting the prediction model according to the test result, and predicting the rest 15 test set samples by the adjusted prediction model to finally obtain an optimal prediction model;
(9) And (3) integrating the SPA spectrum processing algorithm with the optimal prediction model in the step (8) through Python language, and detecting the moisture content and the total colony number of the dried laver sample in real time through direct input of a near infrared spectrum.
Compared with the prior art, the invention has the advantages that:
the invention provides a real-time rapid detection method for the moisture content and the total number of bacterial colonies of dried laver based on deep learning, which provides a method for rapidly predicting the moisture content and the total number of bacterial colonies in the laver by comprehensively utilizing the characteristics of linear factors and nonlinear factors related to the moisture content and the total number of bacterial colonies of the laver through a deep learning neural network combined near infrared spectrum technology. According to the detection method, a prediction model is built through deep learning, a computer programming integration model and a spectrum preprocessing algorithm are used, and the portable spectrum equipment is combined, so that real-time and rapid detection of samples is realized, the operation is convenient, the method is suitable for site batch detection requirements of site quality supervision, transaction, production management and the like, the gap of a rapid detection technology of dry laver quality and safety indexes is filled, and technical support is provided for site quality supervision, and production management and supervision level of laver industry in China is improved.
Drawings
FIG. 1 is a distribution diagram of near infrared spectrum characteristic variables of dried laver of example.
FIG. 2 is a diagram showing the construction of ResNet neural network for rapid detection of moisture content and total colony count of dried laver in example.
FIG. 3 is a graph showing the result of predicting water content of an unknown laver sample by using the dried laver rapid model according to the embodiment.
FIG. 4 is a graph showing the result of predicting the total number of colonies of unknown laver samples by using the dried laver rapid model according to the embodiment.
Detailed Description
The invention will be further described with reference to specific examples, but the scope of the invention is not limited thereto.
Example 1
The embodiment provides a real-time rapid detection method for the moisture content and the total number of bacterial colonies of dry laver based on deep learning, which comprises the following steps:
(1) Sample collection: and collecting Porphyra yezoensis samples of different manufacturers and different production places, wherein the samples need to cover the Porphyra yezoensis samples processed in different seasons, and carrying out conditioning and bacteria increasing treatment on part of the samples at random.
(2) Collecting a sample near infrared spectrum: a medium with stable properties such as polytetrafluoroethylene is selected as a reference background, a single laver sample is paved on a polytetrafluoroethylene plate, a sample spectrum is collected under an SR-1901PT/2501PT portable near infrared spectrometer probe, the spectrum scanning range is 900-1700 nm, the resolution is 6.0nm, the scanning is 100 times, and the average value is taken as near infrared spectrum data of the laver sample.
(3) Calibration of sample moisture content and total colony count: the measurement standard refers to national standard GB 5009.3-2016 (first method) for measuring moisture in food safety national standard food and GB 4789.2-2016 (total number of colony count for food safety national standard food microbiology) for measuring moisture content and colony count in a sample by adopting a direct drying method and a plate counting method. Each sample was subjected to 3 sets of parallel tests, and the average value thereof was taken as a calibration value of the moisture content of the sample and the total number of colonies, respectively. The total number of samples was 500, which contained 100 samples of enriched and rewet.
(4) Abnormal sample identification and elimination: and (3) identifying and removing the samples with abnormal calibration value data measured in the step (3) by adopting a Markov Distance (MD) method so as to improve the prediction accuracy and stability of the model. First, calculate the mean vector of the sample spectrum matrix XAnd covariance matrix->Then, the mahalanobis distance between each sample spectrum and the center spectrum is calculated, and the formula is as follows:
in the method, in the process of the invention,spectrum for the ith sample, +.>The mahalanobis distance for the i-th sample. The threshold calculation method is threshold = =>+α standard deviation,/->The mean value of the mahalanobis distance is the standard deviation of the mahalanobis distance, and the standard deviation weight is alpha, and the standard deviation is used for evaluating the dispersity among the spectra of the sample. And taking the weight alpha of the Markov distance algorithm as 3.4, removing abnormal sample spectrums exceeding the Markov distance threshold, and using the rest sample data for the establishment and test of a prediction model.
(5) Sample spectrum information preprocessing: preprocessing the sample spectrum acquired in the step (2) by adopting a continuous projection algorithm (SPA), eliminating noise doping and baseline drift, and analyzing characteristic variables of the sample spectrum, wherein the result is shown in figure 1.
(6) Establishing a sample data set: and (3) carrying out data grouping on the moisture content and the calibration value of the total number of the colonies of the sample reserved in the step (4) and the sample spectrum information preprocessed in the step (5), so that the data group of the same sample contains the moisture content data, the total number of the colonies and the infrared spectrum data, and further, the correlation between the sample spectrum information and the moisture content and the total number of the colonies is established. Randomly distributing the sample data sets which are associated into a training set and a testing set according to the proportion of 90% and 10%, wherein the training set has 450 samples, and the testing set has 50 samples; sample data in the training set should contain colony counts of different moisture content and different magnitudes.
(7) Establishing a prediction model: depending on the Python learning framework, a ResNet-18 depth residual error network is established, and as shown in fig. 2, the network structure is composed of 17 layers of one-dimensional convolution layers (conv 1 d) and 1 layer of full connection layers (dense). Except for the convolution layer with the top convolution kernel size of 7, the other convolution layers all belong to the special structure of ResBlock, and a short-circuit special structure is arranged in the structure so as to reduce gradient dispersion. The ResNet-18 comprises 4 ResBlock structures, each ResBlock comprises 4 convolution layers, batch standardization layers and activation function layers exist among layers, and the adopted activation functions are ReLU. The number of convolution kernels from top to bottom of each ResBlock is 64, 128, 256 and 512, and the convolution kernel size is 3. The maximum pooling layer and the average pooling layer are present after the first convolution layer and the last full connection layer, respectively, for magnifying the features. The number of neurons of the fully connected layer is 1 for outputting a continuous value. And (3) utilizing a training set, wherein the training iteration times are 300 times, the learning rate is 0.0001, the loss function adopts an L2 norm, and meanwhile, an early_stopping strategy is adopted to prevent overfitting training, so as to establish a prediction model of the water content and the total colony number of the Porphyra yezoensis.
(8) Checking and correcting a model: using 35 samples in the test set as unknown samples to test the prediction model; determining a coefficient R according to a correlation coefficient R of a model 2 And evaluating the model by indexes such as prediction error Root Mean Square (RMSE).
According to the evaluation result, in this embodiment, the network is adjusted, the convolution kernel size of the first convolution layer of the network structure is changed to 10, and the predicted average absolute deviation is reduced by 3%. The corrected model is adopted to predict the rest 15 samples of the test set, and the result is shown in fig. 3 and 4, and the model prediction has a deviation of less than 0.2% on the water content prediction and less than 0.3% on the total colony prediction, so that the porphyra yezoensis grade pattern recognition model has practical application value.
(9) Model integration: SPA spectrum processing algorithm is integrated with a water content and colony total number prediction model through Python language, and the SPA spectrum processing algorithm can be used for real-time detection of unknown samples.
The above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that modifications may be made to the technical solutions described in the foregoing embodiments, or equivalents may be substituted for some of the technical features thereof; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.
Claims (1)
1. A real-time detection method for the moisture content and the total number of bacterial colonies of dried vegetables based on deep learning is characterized by comprising the following steps: the method comprises the following steps:
(1) Collecting 500 dry laver samples of different manufacturers and different production places, covering the dry laver samples processed in various seasons, randomly carrying out moisture regaining treatment on 100 dry laver samples, and carrying out bacteria increasing treatment on 100 dry laver samples;
(2) Spreading a Shan Zhanggan laver sample on a polytetrafluoroethylene plate by taking polytetrafluoroethylene as a reference background, placing the polytetrafluoroethylene plate under a portable near infrared spectrum analyzer probe to collect near infrared spectrum of a dried laver sample, scanning the dried laver sample for 100 times with a scanning range of 900-1700 nm and a resolution of 6.0nm, and taking an average value as near infrared spectrum data of the dried laver sample;
(3) Measuring the moisture content and the total number of bacterial colonies in each dry laver sample by adopting a direct drying method and a plate counting method, setting 3 groups of parallel tests for each sample, and taking the average value of the parallel tests as a sample calibration value of the moisture content and the total number of bacterial colonies of the dry laver sample;
(4) Identifying and removing the dried laver sample with abnormal sample calibration value in the step (3) by using a Markov distance method, and reserving the dried laver sample with normal sample calibration value so as to improve the prediction accuracy and stability of the model;
(5) Preprocessing the near infrared spectrum in the step (2) by adopting a continuous projection algorithm SPA, eliminating noise doping and baseline drift, and analyzing characteristic variables of the noise doping and baseline drift to obtain preprocessed spectrum information;
(6) Respectively carrying out data grouping on the sample calibration value of the dried laver sample reserved in the step (4) and the pretreated spectrum information in the step (5), and establishing the correlation between the moisture content and the total colony number of the dried laver sample and the spectrum information; randomly distributing the sample data with the established association into 450 training set samples and 50 test set samples, wherein the training set samples comprise associated sample data with different moisture contents and different amounts of total bacterial colony numbers;
(7) Depending on a Python learning framework, establishing a ResNet-18 depth residual error network; the ResNet-18 depth residual error network consists of 17 one-dimensional convolution layers and 1 full-connection layer; the convolution kernel size of the first convolution layer is 7, the convolution kernel number is 64, and the first convolution layer is followed by the largest pooling layer; the other convolution layers are divided into 4 ResBlock structures except the first convolution layer, each ResBlock comprises 4 convolution layers, the number of convolution kernels from top to bottom is 64, 128, 256 and 512, and the convolution kernels are 3; a batch standardization layer and an activation function layer exist between convolution layers in the ResBlock structure; the neuron number of the full-connection layer is 1, and an average pooling layer exists behind the full-connection layer;
utilizing the training set sample in the step (6), wherein the training iteration times are 300 times, the learning rate is 0.0001, the loss function adopts L2 norm, and meanwhile, the early_stopping strategy is adopted to prevent overfitting training, and a prediction model of the moisture content and the total colony number of the dry laver sample is established;
(8) Using 35 test set samples in the step (6) as unknown samples to test the prediction capability of the prediction model in the step (7), adjusting the prediction model according to the test result, and predicting the rest 15 test set samples by the adjusted prediction model to finally obtain an optimal prediction model;
(9) And (3) integrating the SPA spectrum processing algorithm with the optimal prediction model in the step (8) through Python language, and detecting the moisture content and the total colony number of the dried laver sample in real time through direct input of a near infrared spectrum.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110531732.3A CN113418889B (en) | 2021-05-17 | 2021-05-17 | Real-time detection method for water content and total colony count of dried vegetables based on deep learning |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110531732.3A CN113418889B (en) | 2021-05-17 | 2021-05-17 | Real-time detection method for water content and total colony count of dried vegetables based on deep learning |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113418889A CN113418889A (en) | 2021-09-21 |
CN113418889B true CN113418889B (en) | 2023-05-26 |
Family
ID=77712435
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110531732.3A Active CN113418889B (en) | 2021-05-17 | 2021-05-17 | Real-time detection method for water content and total colony count of dried vegetables based on deep learning |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113418889B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118090648B (en) * | 2024-04-02 | 2024-06-21 | 常州建昊建筑鉴定检测有限公司 | Method and system for detecting water content of engineering material |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111103416A (en) * | 2019-12-30 | 2020-05-05 | 重庆商勤科技有限公司 | Water source pollution early warning method and system |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
IL157954A0 (en) * | 2001-03-16 | 2004-03-28 | Ewatertek Inc | Water quality monitoring and transmission system and method |
CN101968438B (en) * | 2010-09-25 | 2013-03-06 | 西北农林科技大学 | Method for distinguishing water injection of raw material muscles quickly |
CN107478598A (en) * | 2017-09-01 | 2017-12-15 | 广东省智能制造研究所 | A kind of near-infrared spectral analytical method based on one-dimensional convolutional neural networks |
CN107894408B (en) * | 2017-11-24 | 2021-04-13 | 中国农业科学院油料作物研究所 | Edible oil multi-element adulteration identification method based on near-infrared spectrometer |
CN108760647A (en) * | 2018-03-20 | 2018-11-06 | 南京财经大学 | A kind of wheat content of molds line detecting method based on Vis/NIR technology |
EP3620984B1 (en) * | 2018-09-06 | 2024-04-10 | Accenture Global Solutions Limited | Digital quality control using computer visioning with deep learning |
-
2021
- 2021-05-17 CN CN202110531732.3A patent/CN113418889B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111103416A (en) * | 2019-12-30 | 2020-05-05 | 重庆商勤科技有限公司 | Water source pollution early warning method and system |
Non-Patent Citations (2)
Title |
---|
A Non-Destructive System Based on Electrical Tomography and Machine Learning to Analyze the Moisture of Buildings;Tomasz Rymarczyk 等;Sensors;全文 * |
基于近红外光谱融合与深度学习的玉米成分定量建模方法;谈爱玲 等;分析与检测;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN113418889A (en) | 2021-09-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111141836B (en) | Method and device for nondestructive detection of early internal diseases of pome based on fusion of sound vibration multi-domain spectrum and near infrared spectrum information | |
Tian et al. | Online detection of apples with moldy core using the Vis/NIR full-transmittance spectra | |
CN102937575B (en) | Watermelon sugar degree rapid modeling method based on secondary spectrum recombination | |
CN107219184A (en) | A kind of meat discrimination method and device traced to the source applied to the place of production | |
CN113418889B (en) | Real-time detection method for water content and total colony count of dried vegetables based on deep learning | |
Liu et al. | Diagnosis of citrus greening using raman spectroscopy-based pattern recognition | |
Chang et al. | Detection of sugar content in food based on the electrochemical method with the assistance of partial least square method and deep learning | |
CN107247033B (en) | Identify the method for Huanghua Pear maturity based on rapid decay formula life cycle algorithm and PLSDA | |
Zhou et al. | Research on hyperspectral regression method of soluble solids in green plum based on one-dimensional deep convolution network | |
CN113310934A (en) | Method for quickly identifying milk cow milk mixed in camel milk and mixing proportion thereof | |
Huang et al. | Optimal wavelength selection for hyperspectral scattering prediction of apple firmness and soluble solids content | |
CN107796779A (en) | The near infrared spectrum diagnostic method of rubber tree LTN content | |
Wang et al. | Monitoring model for predicting maize grain moisture at the filling stage using NIRS and a small sample size | |
CN114062306B (en) | Near infrared spectrum data segmentation preprocessing method | |
CN100429501C (en) | Non-destructive detection method for quickly detecting brown core of pear | |
CN115586159A (en) | Method for evaluating aging association degree of white spirit based on mid-infrared spectrum detection technology | |
CN1789978A (en) | Non-destructive detection method for quickly detecting inner quality of apple | |
CN105651727B (en) | The method that near-infrared spectrum analysis based on JADE and ELM differentiates apple shelf life | |
Li et al. | SVM-based apple classification of soluble solids content by near-infrared spectroscopy | |
CN112801172A (en) | Chinese cabbage pesticide residue qualitative analysis method based on fuzzy pattern recognition | |
Zhang et al. | Analysis of moisture and total sugar content of Huizao based on surface images | |
Liu et al. | Retrieval of Water Parameters from Absorption Spectrum Based on Convolutional Neural Network | |
Yan et al. | Prediction Analysis of Soluble Solids Content in Apples Based on Wavelet Packet Analysis and BP Neural Network | |
CN117929356B (en) | LIBS quantitative analysis method based on Gaussian process regression | |
CN113791049B (en) | Method for rapidly detecting freshness of chilled duck meat by combining NIRS and CV |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |