A multi-index nondestructive detection method and system for meat freshness
By smoothing filtering, multivariate scattering correction and feature band extraction of the image spectrum data of cold fresh mutton, combined with the classification model, efficient and accurate non-destructive detection of the fresh mutton is achieved, and the problem of complex and low efficiency of detection methods in the prior art is solved.
Patent Information
- Application Number
- CN202210320040.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-29
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2042-03-29
AI Technical Summary
The freshness detection method for cold fresh mutton in the prior art is complex in operation, low efficiency and cannot realize non-destructive testing.
By obtaining the meat image spectral data, smooth filtering and multivariate scattering correction, the characteristic band data are extracted, and inputting them into the trained meat freshness level classification model to obtain the meat freshness detection results.
It realizes efficient and accurate non-destructive testing of meat freshness, solving the problems of complex operation and low efficiency.
Smart Images

Figure CN114739916B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of nondestructive freshness detection, and in particular to a multi-index nondestructive meat freshness detection method and system. Background Art
[0002] As an important component of meat products, fresh mutton has high protein content, low fat and cholesterol content, and contains many essential amino acids for the human body. It is also better than frozen meat in terms of safety, taste and flavor, and is increasingly favored by consumers. However, fresh mutton has high water content and is easily corrupted during processing, storage, transportation and sales, thus causing food safety problems.
[0003] Freshness reflects the sensory characteristics of meat, the quantity and characteristics of physical and chemical decomposition products, and the degree of microbial contamination and reproduction. It can be used to comprehensively evaluate the nutritional, safety, and palatability of fresh mutton. The change in freshness of fresh mutton is a complex process, in which the water, protein and fat content, the degree of microbial contamination and reproduction, and the storage environment will affect the freshness change process, and the products in the change process may inhibit or promote each other, resulting in different performances.
[0004] At present, traditional detection methods have the disadvantages of complex operation, low efficiency and inability to achieve non-destructive detection of meat freshness. Summary of the invention
[0005] The present invention solves the technical problems of complex operation, low efficiency and inability to realize nondestructive detection of meat freshness in the prior art by providing a multi-index nondestructive detection method and system for meat freshness, thereby enabling nondestructive detection of meat freshness efficiently and accurately.
[0006] The present invention provides a multi-index nondestructive detection method for meat freshness, comprising:
[0007] Obtaining meat image spectral data;
[0008] Performing smoothing filtering and multivariate scattering correction on the meat image spectral data to obtain processed spectral data;
[0009] Extracting characteristic band data from the processed spectral data;
[0010] The characteristic band data is input into a trained meat freshness grade classification model to obtain a meat freshness detection result.
[0011] Specifically, the smoothing filtering of the meat image spectral data includes:
[0012] For each piece of meat image spectral data, perform polynomial least squares fitting on each point to obtain the best estimated value of the smoothed points, and obtain the spectral data after smoothing filtering.
[0013] Specifically, the multivariate scattering correction of the meat image spectral data to obtain the processed spectral data includes:
[0014] Calculate the average spectrum through the formula ; where I j is the spectral data after the smoothing filter, and M is the number of samples;
[0015] Calculate the regression coefficients m and b j through the formula j ;
[0016] Calculate the spectral data after multivariate scattering correction through the formula .
[0017] Specifically, the extraction of the characteristic band data from the processed spectral data includes:
[0018] Assume that the first selected band is i(0), the number of selected bands is N, and the total number of bands is J;
[0019] (1) Before the iteration starts, assign each column of the processed spectral data to x j , j = 1, …, J;
[0020] (2) Define a set S to store the unselected bands,
[0021] (3) Use the first selected band i(0) as the normal and establish an orthogonal subspace. Calculate the projection Px of x j on the orthogonal subspace j ;
[0022] (4) Denote the band with the largest projection value as i(n), that is, i(n) = arg(max||Px j ||, j ∈ S);
[0023] (5) Assign the projection of each band to x j for the next iteration calculation, x j = Px j , j ∈ S;
[0024] (6) Let n = n + 1. If n < N, return to the second step;
[0025] Finally, the extracted variables are {i(n), n = 0, …, N - 1};
[0026] The lower limit N for N min and the upper limit N of N max For each N value within the range, the above steps (1) to (6) are calculated, and a multivariate linear regression analysis model is established based on the obtained i(n);
[0027] Taking the spectral data corresponding to the band in i(n) as the test set, the root mean square error RMSE is calculated based on the labels of the multivariate linear regression analysis model;
[0028] In N max -N min The smallest value among the RMSEs is the optimal value N*, and {i(n), n=0,…, N*-1 corresponding to N* is the selected feature band set;
[0029] Calculate the average spectral reflectance according to the spectral data after multivariate scattering correction, and then calculate the Pearson correlation coefficient between each band in the average spectral reflectance and the label;
[0030] A band corresponding to the Pearson correlation coefficient greater than a preset value is selected as the characteristic band.
[0031] Specifically, TVB-N, pH value, TBC and ANC content were used as labels for the multivariate linear regression analysis model.
[0032] The present invention also provides a multi-index nondestructive detection system for meat freshness, comprising:
[0033] A spectral data acquisition module, used for acquiring spectral data of meat images;
[0034] A spectral data smoothing filter module is used to perform smoothing filtering on the spectral data of the meat image to obtain spectral data after smoothing filtering;
[0035] A spectral data multivariate scatter correction module, used for performing multivariate scatter correction on the spectral data after the smoothing filter to obtain processed spectral data;
[0036] A characteristic band data extraction module, used to extract characteristic band data from the processed spectral data;
[0037] The freshness detection module is used to input the characteristic band data into the trained meat freshness grade classification model to obtain the meat freshness detection result.
[0038] Specifically, the spectral data smoothing filter module is specifically used to perform polynomial least squares fitting on each point of each meat image spectral data, obtain the best estimate of the smoothing point, and obtain the spectral data after smoothing filtering.
[0039] Specifically, the spectral data multiplicative scatter correction module includes:
[0040] An average spectrum acquisition unit, which is used to calculate the average spectrum through the formula ; where I j is the spectral data after the smoothing filter, and M is the number of samples;
[0041] A regression coefficient acquisition unit, which is used to calculate the regression coefficients m and b j ; j ;
[0042] A multiplicative scatter correction unit, which is used to calculate the spectral data after multiplicative scatter correction through the formula ;
[0043] Specifically, the characteristic band data extraction module is specifically used to assume that the first selected band is i(0), the number of selected bands is N, and the total number of bands is J; (1) Before the iteration starts, assign each column of the processed spectral data to x j , j = 1, …, J; (2) Define a set S to store the unselected bands, (3) Use the selected first band i(0) as the normal vector and establish an orthogonal subspace, and calculate the projection Px of x j on the orthogonal subspace j ; (4) Denote the band with the largest projection value as i(n), that is, i(n) = arg(max||Px j ||, j ∈ S); (5) Assign the projections of each band to x j for the next iteration calculation, x j = Px j , j ∈ S; (6) Let n = n + 1, if n < N, then return to the second step; the finally extracted variables are {i(n), n = 0, …, N - 1}; for each N value within the lower limit N min and the upper limit N max of the N value, perform the calculations of the above steps (1) to (6), and establish a multiple linear regression analysis model based on the obtained i(n); use the spectral data corresponding to the bands in i(n) as the test set, and calculate the root mean square error RMSE based on the labels of the multiple linear regression analysis model; the smallest value among the N max -N min RMSE values is the optimal value N*, and the {i(n), n = 0, …, N *-1} is a set of selected characteristic bands; the average spectral reflectance is calculated according to the spectral data after multivariate scattering correction, and then the Pearson correlation coefficient between each band in the average spectral reflectance and the label is calculated respectively; the band corresponding to the Pearson correlation coefficient greater than a preset value is selected as the characteristic band.
[0044] Specifically, TVB-N, pH value, TBC and ANC content were used as labels for the multivariate linear regression analysis model.
[0045] One or more technical solutions provided in the present invention have at least the following technical effects or advantages:
[0046] First, the spectral data of the meat image is obtained; then, the spectral data of the meat image is smoothed and filtered and multivariate scattering correction is performed to obtain the processed spectral data; then, the characteristic band data is extracted from the processed spectral data; finally, the characteristic band data is input into the trained meat freshness grade classification model to obtain the meat freshness detection result, which effectively solves the technical problems of complex operation, low efficiency and inability to realize non-destructive detection of meat freshness in the prior art, thereby enabling efficient and accurate non-destructive detection of meat freshness. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A flowchart of a multi-index nondestructive meat freshness detection method provided by an embodiment of the present invention;
[0048] Figure 2 is an exponential function curve in an embodiment of the present invention;
[0049] Figure 3 This is a live photo of the hyperspectral acquisition platform in an embodiment of the present invention;
[0050] Figure 4 This is the original spectrum of the mutton sample in the embodiment of the present invention;
[0051] Figure 5 This is a spectrum curve diagram after smoothing filtering and scattering correction in an embodiment of the present invention;
[0052] Figure 6 is the optimal characteristic wavelength extracted in the embodiment of the present invention;
[0053] Figure 7 A neural network topology diagram in an embodiment of the present invention;
[0054] Figure 8 The classification result of the improved BP neural network model provided by the embodiment of the present invention;
[0055] Fig. 9 is the classification result of the traditional BP neural network model;
[0056] Fig.10 The improved BP neural network global error proposed in the embodiment of the present invention;
[0057] Fig.11 is the global error of the traditional BP neural network;
[0058] Fig.12 This is a module diagram of a multi-index nondestructive meat freshness detection system provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0059] The embodiments of the present invention provide a multi-index meat freshness non-destructive detection method and system, which solves the technical problems of complex operation, low efficiency and inability to realize meat freshness non-destructive detection in the prior art, thereby enabling efficient and accurate non-destructive detection of meat freshness.
[0060] The technical solution in the embodiment of the present invention is to solve the above-mentioned crosstalk problem, and the overall idea is as follows:
[0061] The error function of multi-label feature learning was constructed, the neural network learning process was improved, the correlation between labels and between labels and spectra was mined, and a multi-index classification analysis model was established and used in the non-destructive detection of the freshness of chilled mutton. The improved algorithm can fully extract the freshness evaluation information of multiple indicators contained in the sample data, and the feature information has good intra-class compactness and inter-class separability. The algorithm improves the applicability and robustness of non-destructive detection of mutton freshness, and provides a new idea for multi-index non-destructive detection of meat.
[0062] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0063] See also Figure 1 The embodiment of the present invention provides a multi-index non-destructive detection method for meat freshness, comprising:
[0064] Step S110: Acquire meat image spectral data;
[0065] Step S120: performing smoothing filtering and multivariate scattering correction on the meat image spectral data to obtain processed spectral data;
[0066] This step is specifically described to perform smoothing filtering on the spectral data of the meat image, including:
[0067] For each piece of meat image spectral data, polynomial least squares fitting is performed on each point to obtain the best estimate of the smoothing point and obtain the smoothed and filtered spectral data.
[0068] Perform multivariate scatter correction on the spectral data of the meat image to obtain the processed spectral data, including:
[0069] Calculate the average spectrum through the formula ; where I j is the spectral data after smoothing filtering, and M is the number of samples;
[0070] Calculate the regression coefficients m and b j through the formula j ; where m and b are coefficient matrices of size M*1. Specifically, the regression coefficients m j and b j can be obtained by the least squares method.
[0071] Calculate the spectral data after multivariate scatter correction through the formula .
[0072] Step S130: Extract the characteristic band data from the processed spectral data;
[0073] Specifically explain this step. Extracting the characteristic band data from the processed spectral data includes:
[0074] Assume that the first selected band is i(0), the number of selected bands is N, and the total number of bands is J;
[0075] (1) Before the start of the iteration, assign each column of the processed spectral data to x j , j = 1, …, J;
[0076] (2) Define a set S to store the unselected bands,
[0077] (3) Use the first selected band i(0) as the normal and establish an orthogonal subspace. Calculate the projection Px of x j on the orthogonal subspace j ;
[0078] (4) Denote the band with the maximum projection value as i(n), that is, i(n) = arg(max||Px j ||, j ∈ S);
[0079] (5) Assign the projection of each band to x j for the next iteration calculation, x j = Px j , j ∈ S;
[0080] (6) Let n = n + 1. If n < N, return to the second step;
[0081] The variables finally extracted are {i(n), n=0,…,N-1};
[0082] The lower limit N for N min and the upper limit N of N max For each N value within the range, the above steps (1) to (6) are calculated, and a multivariate linear regression analysis model is established based on the obtained i(n);
[0083] The spectral data corresponding to the band in i(n) is used as the test set, and the root mean square error RMSE is calculated based on the labels of the multivariate linear regression analysis model;
[0084] In N max -N min The smallest value among the RMSEs is the optimal value N*, and {i(n), n=0,…, N*-1 corresponding to N* is the selected feature band set;
[0085] The average spectral reflectance is calculated based on the spectral data after multivariate scattering correction, and then the Pearson correlation coefficient between each band in the average spectral reflectance and the label is calculated respectively;
[0086] The band corresponding to the Pearson correlation coefficient greater than a preset value is selected as the characteristic band.
[0087] In this example, TVB-N, pH value, TBC and ANC content were used as labels for the multiple linear regression analysis model.
[0088] Step S140: input the characteristic band data into the trained meat freshness grade classification model to obtain the meat freshness detection result.
[0089] It should be noted that the embodiment of the present invention constructs and trains a meat freshness grade classification model by improving the BP neural network. The specific process is as follows:
[0090] Let Y be the label set, Y i For a sample x i Tags, Y i The complement of Y, then for sample x i , in Y i The labels in Y should be ranked higher than those not in Y i The label level in , so the improved error E for a single sample i The calculation formula (1) is as follows:
[0091]
[0092] Among them, Y i belongs to sample xi A collection of tags, is not part of the sample x i A collection of tags, The network calculates the i The output of the label (k∈Y i ), For not belonging to x i The output of the label
[0093] like Figure 2 As shown in the figure, from the change of the exponential function curve, for a certain sample, c k is the label of the sample, There are two cases, namely c k -c l >0 and c k -c l <0. When c k >c l When c k -c l >0, the independent variable is in the second quadrant, the exponential function value and the slope of the curve are small, and the error is small. k <c l When c k -c l <0, the independent variable is in the first quadrant, the exponential function value and slope are large, and the error is large.
[0094] According to formula (1), the total learning error E of the neural network can be obtained as:
[0095]
[0096] In the forward propagation learning process, the neural network calculates the final output result based on the given input and current weights. Assume that the output of the jth neuron in the output layer is c j , then:
[0097] c j =f(netc j +θ j ) (3)
[0098] Among them, θ j is the bias of the output layer, and the activation function f is the hyperbolic tangent function:
[0099]
[0100] Among them, x is the independent variable, corresponding to netc in formula (3) j +θ j .
[0101] netc jIs the input data of the output layer, that is, the output of the hidden layer:
[0102]
[0103] M is the number of neurons in the hidden layer, b s is the output of the hidden layer neurons, w sj is the output layer weight:
[0104] b s =f(netb s +γ s ) (6)
[0105] γ s is the bias of the hidden layer, netb s is the input data of the hidden layer, that is, the output of the input layer.
[0106]
[0107] a h is the hth element of the input data, v hs is the hidden layer weight.
[0108] In the error back propagation learning stage, the error is back propagated from the output layer layer by layer, and the weights of each layer are updated by the gradient descent method, that is, the partial derivative of the weight is calculated using the output error of each input sample. The weight update formula of the output layer and the hidden layer is:
[0109]
[0110] Among them, α is the learning rate, and its value range is 0 to 1. sj is the output layer weight, v hs is the hidden layer weight, and the weight is updated once each sample is input. The error of the jth output unit is defined as d j , then:
[0111]
[0112] From formula (3), we can derive:
[0113]
[0114] Since f′(netc j +θ j )=(1+c j )(1-c j ), calculate the error E of a single sample i Substituting into formula (10), we get the error d of the jth output unit j for:
[0115]
[0116] Among them, c j is the output of the jth neuron in the output layer; if j belongs to the set Y i , then calculate c j -c l The value of c l Output representing the label that does not belong to the sample If j belongs to the set Then calculate c k -c j The value of c k The output (k∈Y i ). The purpose of distinguishing j is to make the output of the label belonging to the sample always greater than the output of the label not belonging to the sample.
[0117] Similarly, the error of the sth unit in the hidden layer is defined as e s :
[0118]
[0119] Substituting formula (5) and formula (9) into formula (12), we get:
[0120]
[0121] For Δw in formula (8), sj Decompose it and combine it with equation (5) and equation (9) to obtain:
[0122]
[0123] Similarly, for Δv in formula (8) hs Decompose it and combine it with equation (12) and equation (7) to obtain:
[0124]
[0125] Finally, the bias of the hidden layer and the output layer are defined as θ j and γ s , set the updated value of the bias to:
[0126]
[0127] In the learning process, the sample data is input into the network in sequence. For each multi-label sample, the network will give a larger output to the label belonging to the sample. If the label that does not belong to the sample is larger than the label that belongs to the sample, it can be seen from formula (1) that Will be negative, and this value will be negatively fed back to the exponential function. According to the characteristics of the exponential function, a large error will be calculated to severely penalize the error term. The errors between all label pairs are accumulated and normalized by the total number of labels, and finally the error of a multi-label sample is obtained. The weights and biases of the network are continuously updated by the gradient descent method combined with the back propagation strategy of the error. After each iteration, the errors of each sample are added to obtain the global error E, thereby minimizing the global error. The learning process is stopped until the global error E no longer decreases or the number of iterations is reached. When the trained network model is used for prediction, the output value of the network will be used to sort the labels, and the output belonging to a certain sample label will be much larger than the output that does not belong to the sample label. In this way, the correlation problem between different labels of a certain sample can be better solved.
[0128] Experiment on freshness evaluation of cold mutton
[0129] 1. Acquisition of test samples
[0130] The chilled fresh mutton samples used in the experiment were taken from the farmers' market in Sunite Right Banner, Xilin Gol League, Inner Mongolia. The tenderloins of 5 sheep were selected after slaughter and acid removal. The fat and connective tissue were removed and evenly divided into 6cm×6cm×1cm slices. The slices were sealed and packaged in 3 groups with fresh-keeping bags and numbered. They were placed in a refrigerator at 4℃ without squeezing for 14 days. Samples were taken every 24 hours and placed indoors for 25 minutes to evaporate the moisture on the surface of the samples for the determination of total volatile basic nitrogen (TVB-N), pH value, total bacterial count (TBC), approximate number of coliforms (ANC) and spectral reflectance collection.
[0131] 2 Laboratory determination of freshness index
[0132] The TVB-N content of the samples in the test was determined according to the semi-micro Kjeldahl nitrogen determination method in GB / 5009.228-2016 "Analysis Methods for Hygienic Standards of Meat and Meat Products", the pH value was determined according to the non-averaged sample determination method in GB / 5009.237-2016, and the TBC content was determined according to the TBC standard value per unit mass in GB / 4789.2-2016. The ANC content was determined according to the ANC per unit mass in GB / 4789.3-2016.
[0133] According to the national food hygiene monitoring standards and the research results of predecessors, when TVB-N ≤ 15 mg / 100 g, it is fresh meat; when 15 mg / 100 g < TVB-N ≤ 25 mg / 100 g, it is sub-fresh meat; when TVB-N > 25 mg / 100 g, it is non-fresh meat. In the embodiments of the present invention, TVB-N is mainly used, and at the same time, the freshness grades of samples are jointly determined by comparing the measured values of TBC, pH value, and ANC indicators.
[0134] 3 Hyperspectral imaging data acquisition
[0135] The hyperspectral acquisition system mainly includes a hyperspectral imager (Hyperspec VNIR N-series), an illumination light source, a scanning platform, a reflection reference plate, and acquisition software. The wavelength range of the spectrometer is 400 - 1000 nm, with a total of 750 channels and a resolution of 2.8 nm. The acquisition platform is as Figure 3 shown.
[0136] Each time during the experiment, turn on the spectrometer 30 minutes in advance for preheating, place the sample about 40 cm away from the spectrometer lens, set the pixel mixing times to 6 times, the spectrometer exposure time is about 3 ms, and adjust the spectral pixel brightness (DN) value to be less than 8500. During the experiment, use the focusing plate to adjust the spectrometer, set the scanning direction, number of times, and moving speed of the spectrometer, and collect black-and-white calibration spectral images for obtaining the calibration spectral data of the sample. Using ENVI software, select a 100 * 100 pixel region of interest (ROI) without fat, connective, and tendon tissues and with clear images from each spectral image of the sample as the experimental data for feature extraction and calibration model establishment. Figure 4 It is the original spectral DN value curve graph of the experimental sample.
[0137] From Figure 4 it can be seen that there is some noise in the original spectral curve and there are differences in spectral intensity. Therefore, smoothing filtering is performed during the experiment, and the derivative order is set to 2. For each spectral data, polynomial least squares fitting is performed on each point with a window size of 15 to obtain the best estimated value of the smoothed points. By this method, the noise in the spectral data can be removed. On the image, the processed spectral curve is significantly smoother, which belongs to horizontal processing. Then, multiplicative scatter correction is used to perform vertical processing on the smoothed spectral data to eliminate the baseline shift or offset phenomenon in the spectrum. First, calculate the average spectrum of the sample according to Equation (17),
[0138]
[0139] where, I jis the spectral data after smoothing filtering, and M is the number of samples. The sum and average of all samples are calculated, and then the polynomial regression coefficients are calculated as shown in Equation (18).
[0140]
[0141] where m j and b j are the regression coefficients. Finally, the multiplicative scatter correction result of the spectrum is calculated using the regression coefficients as shown in Equation (19).
[0142]
[0143] This method improves the signal-to-noise ratio of the spectrum, and the corrected spectral data is used for later feature extraction and classification recognition. The spectral curve after smoothing filtering and scatter correction is as Figure 5 shown.
[0144] 5 Feature Spectrum Extraction
[0145] First, feature band selection is performed on 125 bands. Specifically, starting from one band, a new band is merged in each iteration until the specified number of bands is reached. This method can select the band with the smallest information content to solve the collinearity problem. First, assume that the first selected band is i(0), the number of selected bands is N, and the total number of bands is J.
[0146] (1) Before the iteration starts, assign each column of the processed spectral data to x j , j = 1, …, J.
[0147] (2) Define a set S to store the unselected bands.
[0148] (3) Take the selected first band i(0) as the normal and establish an orthogonal subspace. Calculate the projection Px of x j onto the orthogonal subspace. j .
[0149] (4) Denote the band with the largest projection value as i(n), that is, i(n) = arg(max||Px j ||, j ∈ S);
[0150] (5) Assign the projection of each band to x j for the next iteration calculation. x j = Px j , j ∈ S;
[0151] (6) Let n = n + 1. If n < N, return to the second step.
[0152] Finally, the variables extracted are {i(n), n=0,…,N-1}. A range is defined for N. Corresponding to each i(n) and N, a multivariate linear regression analysis model is established, and its root mean square error RMSE is calculated. The smallest RMSE corresponds to the optimal value of i(n) and N.
[0153] The experiment set the number of characteristic wavelengths in the range of 5 to 30, and used TVB-N, pH value, TBC and ANC content as labels for the multivariate linear regression analysis model, and 17, 28, 28 and 28 bands were extracted, respectively.
[0154] 33 repeated bands were deleted, and a total of 68 characteristic bands were extracted. Then the correlation between each band and the freshness index was calculated, and the bands with correlation greater than 0.85 with TVB-N, pH, TBC and ANC were selected as characteristic bands, and a total of 15 characteristic bands were extracted, such as Figure 6 shown.
[0155] 6 Evaluation of the freshness level of cold fresh mutton
[0156] The experiment used the improved BP neural network proposed in the embodiment of the present invention to classify and identify the spectral data of fresh mutton, and divided the 700 spectral samples into 500 and 200 sample sets of different freshness according to the training set and the test set, among which the number of fresh, sub-fresh and unfresh samples were 150, 300 and 250 respectively, as shown in Table 1.
[0157] Table 1 Division of sample sets with different freshness
[0158]
[0159] According to the error analysis method of the improved BP neural network model proposed in the embodiment of the present invention, it is necessary to transform the four index values of the measured fresh mutton samples from continuous data to discrete label data in accordance with the national food hygiene monitoring standards and previous research results. The transformation results are shown in Table 2.
[0160] Table 2 Discrete label data
[0161]
[0162] The rows in the table are spectral samples, which are listed as the high and low levels of the four freshness indicators TVB-N, pH, TBC and ANC. The low, slightly high and high levels of each indicator correspond to the three levels of fresh, sub-fresh and unfresh chilled mutton. The light-colored cells in each row of samples indicate that the label belongs to the sample, and the dark-colored cells indicate that the label does not belong to the sample. There are 4×3=12 types in total, so the number of nodes in the network output layer is set to 12. According to the 15 characteristic spectral bands extracted, the number of nodes in the neural network input layer is set to 15, and the number of hidden layers is set to 1. The network topology is as follows Figure 7 shown.
[0163] Sort the output values of the neural network from large to small, and the first four items correspond to the probabilities of high and low contents of the four indicators; if the contents of the four indicators are relatively low, it indicates that the sample is fresh; if one or more of them are in a slightly higher area, it indicates that the sample is second-fresh; if one or more of them are in a high area, it indicates that the sample is not fresh.
[0164] 7. Analysis of test results
[0165] This experiment uses four evaluation indicators, namely Hamming loss, one-error rate, ranking loss and coverage, to evaluate the multi-index classification model for freshness of chilled mutton proposed in the embodiment of the present invention. During the experiment, the number of neurons in the hidden layer was set to 20%, 40%, 60%, 80% and 100% of the number of neurons in the input layer, respectively, and the four evaluation index values of the model were obtained, as shown in Table 3.
[0166] Table 3 Multi-label neural network performance with different numbers of hidden layer neurons
[0167]
[0168] It can be seen from the table that when the number of hidden layer neurons is 20% of the number of input features, the experimental result values of One-error are basically consistent with those of other different numbers of hidden layer neurons, and the experimental result values of Hamming Loss, Ranking Loss and Coverage are all the smallest, indicating that the model performance is the best. Therefore, the number of hidden layer neurons is determined to be 15×0.2=3, and the classification effects of the improved BP neural network algorithm proposed in the embodiment of the present invention and the traditional BP neural network algorithm are further compared.
[0169] The experiment set the number of fresh samples in the test set to be 40, the number of sub-fresh samples to be 84, and the number of non-fresh samples to be 76. The statistics of the model classification results are shown in Table 4. The classification results of the three freshness level samples predicted by the improved BP neural network proposed in the embodiment of the present invention are 40, 75 and 75 respectively, and the prediction accuracy rates are 100%, 89.3% and 98.7% respectively, and the average prediction accuracy rate is 96%. The classification results of the three freshness level samples predicted by the traditional BP network model are 40, 70 and 74, and the prediction accuracy rates are 100%, 83.3% and 97.4% respectively, and the average prediction accuracy rate is 93.56%. Compared with the traditional BP neural network, the average classification accuracy of the BP neural network improved algorithm proposed in the embodiment of the present invention is improved by 2.44%.
[0170] Table 4 Statistics of model classification results
[0171]
[0172] Figure 8 and Fig. 9 The figures are respectively the test sample classification result diagrams of the improved BP neural network and the traditional BP neural network when the number of neurons in the hidden layer is 3 and the learning rate is 0.1, where "◇" represents the actual freshness level of the chilled mutton, and "|" represents the neural network classification result. It can be seen from the figure that the classification performance of the improved BP neural network model proposed in the embodiment of the present invention is better than that of the traditional BP neural network.
[0173] Fig.10 and Fig.11 The global error change diagrams of the improved BP neural network proposed in the embodiment of the present invention and the traditional BP neural network during the training process are shown in the figure. It can be seen from the figure that the improved BP neural network proposed in the embodiment of the present invention has reached basic convergence after about 10 iterations, while the traditional BP neural network has reached basic convergence after about 2500 iterations. Therefore, the improved BP neural network proposed in the embodiment of the present invention has a faster convergence speed.
[0174] See also Fig.12 The embodiment of the present invention provides a multi-index nondestructive meat freshness detection system, comprising:
[0175] The spectral data acquisition module 100 is used to acquire spectral data of meat images;
[0176] The spectral data smoothing filter module 200 is used to perform smoothing filtering on the spectral data of the meat image to obtain spectral data after smoothing filtering;
[0177] Specifically, the spectral data smoothing filter module 200 is specifically used to perform polynomial least squares fitting on each point of each meat image spectral data, obtain the best estimate of the smoothing point, and obtain the spectral data after smoothing filtering.
[0178] The multivariate scattering correction module 300 for spectral data is used to perform multivariate scattering correction on the smoothed spectral data to obtain the processed spectral data;
[0179] Specifically, the multivariate scattering correction module 300 for spectral data includes:
[0180] The average spectrum acquisition unit is used to calculate the average spectrum through the formula ; where I j is the smoothed spectral data, and M is the number of samples;
[0181] The regression coefficient acquisition unit is used to calculate the regression coefficients m and b j through the formula; where m and b are coefficient matrices of size M*1. Specifically, the regression coefficients m j and b j can be obtained by the least squares method. j .
[0182] The multivariate scattering correction unit is used to calculate the spectrally data after multivariate scattering correction through the formula .
[0183] The characteristic band data extraction module 400 is used to extract characteristic band data from the processed spectral data;
[0184] Specifically, the characteristic band data extraction module 400 is specifically used to assume that the first selected band is i(0), the number of selected bands is N, and the total number of bands is J; (1) Before the iteration starts, assign each column of the processed spectral data to x j , j = 1,..., J; (2) Define a set S to store the unselected bands, (3) Use the selected first band i(0) as the normal line and establish an orthogonal subspace, and calculate the projection Px of x on the orthogonal subspace through the formula j ; (4) Denote the band with the largest projection value as i(n), that is, i(n) = arg(max||Px j ||, j ∈ S); (5) Assign the projection of each band to x j for the next iteration calculation, x j = Px j , j ∈ S; (6) Let n = n + 1, if n < N, then return to the second step; the finally extracted variables are {i(n), n = 0,..., N - 1}; for the lower limit N j of the N value and the upper limit N min of the N value maxFor each N value within the range, the above steps (1) to (6) are calculated, and a multivariate linear regression analysis model is established based on the obtained i(n). The spectral data corresponding to the band in i(n) is used as the test set, and the root mean square error RMSE is calculated based on the labels of the multivariate linear regression analysis model. max -N min The smallest value among the RMSE is the optimal value N*, and the value corresponding to N* is {i(n),n=0,…,N * -1} is the selected characteristic band set; the average spectral reflectance is calculated according to the spectral data after multivariate scattering correction, and then the Pearson correlation coefficient between each band in the average spectral reflectance and the label is calculated respectively; the band corresponding to the Pearson correlation coefficient greater than the preset value is selected as the characteristic band.
[0185] In this example, TVB-N, pH value, TBC and ANC content were used as labels for the multiple linear regression analysis model.
[0186] The freshness detection module 500 is used to input the characteristic band data into the trained meat freshness grade classification model to obtain the meat freshness detection result.
[0187] Technical Effects
[0188] In order to find the correlation between the freshness of fresh mutton and multiple physical, chemical and microbiological indicators detected by laboratory methods, the embodiment of the present invention proposes to use an indirect optimization method, improve the BP neural network error function and the back propagation algorithm, and explore the multi-label BP neural network classification problem to obtain a multi-index fresh mutton freshness grade evaluation correction model. The experiment in the embodiment of the present invention uses a hyperspectral imager with a wavelength range of 400 to 1000nm to collect 0-14d cold fresh mutton sample spectral data, and uses a laboratory method to determine the volatile basic nitrogen (TVB-N), pH value, total bacterial count (TBC) and coliform group approximate number (ANC) index values. Select the region of interest to extract representative spectral data, perform smoothing filtering and multivariate scattering correction processing on the original spectral data of the fresh mutton sample, and then select 15 characteristic bands. Use the improved BP neural network model to construct a cold fresh mutton freshness grade classification model. Hamming loss, one-error, ranking loss and coverage are used as model evaluation indicators to compare with the traditional BP neural network model. The results show that the classification accuracy of the improved BP neural network proposed in the embodiment of the present invention for the test set is as high as 96%, and the recognition rates of the three freshness level samples are 100%, 89.28% and 98.68% respectively. It is evaluated using four multi-label model evaluation indicators: hamming loss, one-error, ranking loss and coverage, and the evaluation indicators are 0.008, 0.002, 0.0025 and 4.048 respectively. Compared with the traditional BP neural network, the accuracy and various model evaluation indicators of the improved BP neural network classification model proposed in the embodiment of the present invention are better than those of the traditional BP neural network, which proves the effectiveness and applicability of the improved BP neural network model provided in the embodiment of the present invention for non-destructive detection of the freshness of multi-index chilled mutton.
[0189] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0190] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0191] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0192] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0193] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0194] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A multi-index nondestructive detection method for meat freshness, characterized in that: Including: Obtaining spectral data of meat images; Performing smoothing filtering and multiplicative scatter correction on the spectral data of the meat images to obtain processed spectral data; Extracting characteristic band data from the processed spectral data; Inputting the characteristic band data into a trained meat freshness level classification model to obtain a meat freshness detection result; The extracting of the characteristic band data from the processed spectral data includes: Assuming that the first selected band is i(0), the number of selected bands is N, and the total number of bands is J; (1) Before the iteration begins, assign each column of the processed spectral data to x j , j = 1, ..., J; (2) Define a set S to store the unselected bands. (3) The first selected band i(0) is used as the normal and an orthogonal subspace is established. Calculate x j Projection Px on the orthogonal subspace j ; (4) The band with the largest projection value is recorded as i(n), that is, i(n) = arg(max‖Px j ‖,j∈S); (5) Assign the projection of each band to x j For the next iteration, x j =Px j ,j∈S; (6) Let n=n + 1. If n < N, then return to the second step; The finally extracted variables are {i(n), n = 0, …, N - 1}; The lower limit N for N min and the upper limit N of N max For each N value within the range, the above steps (1) to (6) are calculated, and a multivariate linear regression analysis model is established based on the obtained i(n); Taking the spectral data corresponding to the bands in i(n) as the test set, and calculating the root mean square error RMSE based on the labels of the multiple linear regression analysis model; In N max -N min The smallest value among the RMSE is the optimal value N*, and the value corresponding to N* is {i(n),n=0,…,N * -1} is the selected characteristic band set; Calculating the average spectral reflectance according to the spectrally multiplicatively scatter corrected data, and then calculating the Pearson correlation coefficient between each band in the average spectral reflectance and the label respectively; Selecting the bands corresponding to the Pearson correlation coefficients greater than a preset value as the characteristic bands.
2. The method according to claim 1, characterized in that The performing of the smoothing filtering on the spectral data of the meat images includes: For each spectral data of the meat images, performing polynomial least squares fitting on each point to obtain the best estimated value of the smoothed point, and obtaining the spectrally smoothed data.
3. The method according to claim 2, characterized in that The performing of the multiplicative scatter correction on the spectral data of the meat images to obtain the processed spectral data includes: By formula The average spectrum is calculated; where I j is the spectral data after smooth filtering, and M is the number of samples; By formula Calculate the regression coefficient m j and b j ; By formula The spectral data after multivariate scattering correction were calculated.
4. The method according to claim 1, characterized in that Using TVB-N, pH value, TBC, and ANC content as the labels of the multiple linear regression analysis model.
5. A multi-index non-destructive meat freshness detection system, characterized in that: Including: A spectral data acquisition module for obtaining spectral data of meat images; A spectral data smoothing filtering module for performing smoothing filtering on the spectral data of the meat images to obtain spectrally smoothed data; A spectral data multiplicative scatter correction module for performing multiplicative scatter correction on the spectrally smoothed data to obtain processed spectral data; A characteristic band data extraction module for extracting characteristic band data from the processed spectral data; A freshness detection module for inputting the characteristic band data into a trained meat freshness level classification model to obtain a meat freshness detection result; The characteristic band data extraction module is specifically used to assume that the first band selected is i(0), the number of selected bands is N, and the total number of bands is J; (1) before the iteration starts, assign each column of the processed spectral data to x j , j = 1,…, J; (2) define a set S to store the unselected bands, (3) The first selected band i(0) is used as the normal and an orthogonal subspace is established. Calculate x j Projection Px on the orthogonal subspace j ; (4) The band with the largest projection value is recorded as i(n), that is, i(n) = arg(max‖Px j ‖, j∈S); (5) Assign the projection of each band to x j For the next iteration, x j =Px j ,j∈S; (6) Let \(n=n + 1\). If \(n\lt N\), return to the second step. The finally extracted variables are \(\{i(n),n = 0,\cdots,N - 1\}\); for the lower limit \(N\) of the value of \(N\) min and the upper limit \(N\) of the value of \(N\) max For each value of \(N\) within the range, perform the calculations of the above steps (1) to (6), and establish a multiple linear regression analysis model based on the obtained \(i(n)\); use the spectral data corresponding to the bands in \(i(n)\) as the test set, and calculate the root mean square error RMSE based on the labels of the multiple linear regression analysis model; among the max - \(N\) min RMSE values, the minimum value is the optimal value \(N^*\), and \(\{i(n),n = 0,\cdots,N\) * - 1\} is the selected set of characteristic bands; calculate the average spectral reflectance based on the spectrally corrected data by multiplicative scatter correction, and then calculate the Pearson correlation coefficient between each band in the average spectral reflectance and the label; select the band corresponding to the Pearson correlation coefficient greater than the preset value as the characteristic band.
6. The system according to claim 5, characterized in that The spectral data smoothing filtering module is specifically configured to perform polynomial least squares fitting on each point for each spectral data of the meat images to obtain the best estimated value of the smoothed point, and obtaining the spectrally smoothed data.
7. The system according to claim 5, characterized in that The spectral data multiplicative scatter correction module includes: The average spectrum acquisition unit is used to obtain the average spectrum through the formula The average spectrum is calculated; where I j is the spectral data after smooth filtering, and M is the number of samples; The regression coefficients are obtained by the formula Calculate the regression coefficient m j and b j ; The multivariate scatter correction unit is used to correct the The spectral data after multivariate scattering correction were calculated.
8. The system according to claim 5, characterized in that Using TVB-N, pH value, TBC, and ANC content as the labels of the multiple linear regression analysis model.