Near infrared spectrum detection method and system for pork
Through the Vis/NIR spectral sensing system, flexible adhesion on the pork surface, combined with multivariate linear regression and self-designed classification algorithm, the complexity and high cost problems of traditional pork quality detection are solved, and the synchronous rapid detection and low-cost detection of multiple pork quality parameters are realized.
Patent Information
- Application Number
- CN202511001783.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-08-19
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing pork quality detection methods have problems such as long detection cycle, complex operation, high cost, difficulty in real-time on-site inspection, limited applicability and expensive equipment, especially traditional near-infrared spectrometers are difficult to adapt to irregular surface and ambient light interference.
Vis/NIR spectral sensing system is used to attach it to the pork surface, and abnormal samples are removed through principal component analysis and confidence interval method, and a multivariate linear regression model and self-designed classification algorithm are established. Combined with the intrinsic coupling relationship between spectral data and pork quality parameters, synchronous and rapid detection of multiple quality parameters is achieved.
It realizes synchronous and rapid detection of multiple quality parameters of pork, adapts to irregular surfaces, reduces equipment costs, improves detection accuracy and anti-interference ability, and meets the needs of real-time on-site inspection.
Smart Images

Figure CN120507308A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of food safety detection, and in particular to a near-infrared spectroscopy detection method and system for pork. Background Art
[0002] Currently, pork quality testing mainly relies on laboratory chemical analysis methods (such as HPLC, GC) or traditional near-infrared spectroscopy technology; although laboratory chemical analysis methods such as high-performance liquid chromatography (HPLC) and gas chromatography (GC) have high detection accuracy, they have disadvantages such as long detection cycle, complex operation, high cost, and the need to destroy samples, making it difficult to meet real-time, on-site detection needs; traditional near-infrared spectrometers require fixed equipment, and samples need to be placed in a specific position during testing. The operation is complex and difficult to adapt to irregular surfaces.
[0003] Traditional near-infrared detection is easily affected by ambient light, resulting in a low signal-to-noise ratio of spectral data; Poor real-time performance: Existing systems rely on complex preprocessing steps, such as spectral smoothing and baseline correction, making it difficult to achieve rapid on-site detection; Limited applicability: Most methods only target a single indicator, such as fat content, and cannot simultaneously detect multiple quality parameters such as protein content and water content; High cost: Traditional spectroscopy equipment is large and expensive, making it difficult to popularize.
[0004] Therefore, there is an urgent need for a detection system and method that can improve the accuracy and anti-interference ability of near-infrared spectroscopy detection, realize the simultaneous and rapid detection of multiple quality parameters of pork, simplify the detection process, and have low equipment cost. Summary of the Invention
[0005] In order to solve the defects of the above-mentioned prior art, the purpose of the present invention is to provide a near-infrared spectroscopy detection method and system for pork that can improve the accuracy and anti-interference ability of near-infrared spectroscopy detection, realize simultaneous and rapid detection of multiple quality parameters of pork, simplify the detection process and have low equipment cost.
[0006] The present invention adopts the following technical solutions: A near infrared spectroscopy detection method for pork, comprising the following steps: S1: Obtain the measured values of pork maturity quality indicators and the corresponding Vis / NIR spectral sensing system dataset: The Vis / NIR spectral sensing system is flexibly attached to the surface of a pork sample, and uniformly irradiates the pork muscle tissue from the complex surface to obtain reflectance spectrum data of the pork; the color sensory indicators of L*, a*, and b* and the measured values of the physical and chemical indicators of fat, protein, moisture, and pH value of the pork are obtained; S2: Eliminate abnormal samples and obtain a standard data set: Abnormal samples were eliminated through principal component analysis (PCA) and confidence interval method; S3: Divide the dataset into a calibration set and a validation set: Pork samples stored under the same refrigeration conditions were divided into several storage days. The pork samples at each storage day were tested to obtain physical and chemical indicators, sensory quality data sets, and corresponding spectral data sets. A stratified random sampling method was used, and the data at each storage time point were divided into 80% and 20% of the data were allocated to the calibration set and the validation set respectively. S4: Standardize and preprocess the sample data to eliminate the dimension effect: Set the standardized parameter mean and standard deviation SD, standardize the row vector dc of the calibration set, and standardize the row vector dv of the validation set to eliminate the dimensional differences and scale effects between the values of each band; S5: Establishing a mature quality prediction model: A numerical prediction model for spectra and pork quality parameters was established using multiple linear regression (MLR). The constructed MLR model was independently developed for sensory and physicochemical indicators of pork maturity quality. Multiple regression was performed on the spectral data from all channels of the Vis / NIR spectral sensing system to predict the corresponding maturity quality values. S6: Establish a mature quality classification model: A classification model is constructed based on the self-designed classification algorithm of the Vis / NIR spectral sensing system, as shown in formula (1), for the grade determination of pork quality. Based on the inherent coupling relationship between pork spectral data and mature quality characteristics, spectral parameter classification is performed: (1) Among them, D i is the spectrum level of the i-th band; I by is the predicted band spectrum of the level sample to be predicted; T iby is the mean value of the spectrum in the i-th band; s is the number of spectral parameters of the modeling samples; i=1, ..., 12; Using the minimum value of the above maturity index as the actual maturity index, as shown in formula (2), (2) Where, L i is the maturity index actually calculated for the i-th time; The solution category is as follows: (3) Pork samples are divided into four grades D1, D2, D3 and D4 based on physical, chemical and sensory indicators, corresponding to the quality levels of excellent, good, qualified and unqualified.
[0007] S7: Evaluate model accuracy and stability: The model was evaluated by determining the coefficient of determination (R²), the root mean square error (RMSEC) / RMSECV, the residual prediction deviation (RPD), and the relative standard deviation (RSD). When the following conditions are met: R² ≥ 0.90; RMSEC ≤ 10%; RMSECV ≤ 10%; RPD ≥ 3; RSD ≤ 10%, the model is accurate and stable. If any of these conditions do not meet the requirements, the existing model is inaccurate and needs to be retrained until it passes.
[0008] In some embodiments, in S1, the spectral data of the i-th sample is set to X i =[x i1 ,……, x i12 ], x i1 to x i12 They represent the spectral data of 12 independent channels of the Vis / NIR spectral sensing system respectively; the true value of the mature quality index is set to Y i =[y i1 , …, y i7 ], where i∈[1, m] represents the sample number and m is the total number of samples; i1 to y i7 They represent the actual measured values of seven maturity qualities: L*, a*, b*, fat, protein, moisture, and pH.
[0009] In some embodiments, in S2, the steps of removing abnormal samples using principal component analysis (PCA) and confidence interval method are as follows: performing PCA dimensionality reduction on the spectral data of all samples, extracting the first two principal components PC1 and PC2 for two-dimensional visualization; constructing an elliptical envelope with a 95% confidence interval to determine whether the sample falls within the normal distribution range, and any sample falling within the ellipse is considered a normal value, and any sample falling outside the ellipse is considered an abnormal value, and the abnormal samples are removed.
[0010] In some embodiments, S3 also includes storing pork samples under refrigerated conditions at 4°C, and the detection cycles are the 1st day, the 3rd day, the 5th day, and the 7th day, with a total of four storage time points; a number of samples are collected at each time point and the corresponding physical and chemical indicators and sensory quality measurements are completed.
[0011] In some embodiments, in S4, the row vector dc of the calibration set is normalized according to formula (4) to obtain dsc i ; (4) Where, dsc i is the spectral data of the calibration set sample of the i-th sample, the unit is relative reflectance, and it is a unitless and dimensionless value after normalization; dc i is the spectral reading of the original calibration set of the i-th sample; Mean (dc) is the mean of each band in the calibration set, which is a dimensionless reflectance value; SD (dc) is the standard deviation of each band in the calibration set, which is a dimensionless reflectance value.
[0012] The row vector dv of the validation set is normalized according to formula (5) to obtain dsv i ; (5) Where, dsv i : is the spectral data of the validation set sample of the i-th sample, the unit is relative reflectance, and it is a unitless and dimensionless value after normalization; dv i is the spectral reading of the original validation set of the i-th sample; Mean (dv) is the mean of each band in the validation set, which is a dimensionless reflectance value; SD(dv) is the standard deviation of each band in the validation set and is a dimensionless reflectance value.
[0013] In some embodiments, in S5, the MLR model construction step is as shown in formula (6); (6) Where, Y(a) is the predicted a-th maturity quality index, ds i is the reflectivity value of the i-th band (i = 1 to 12), the unit is dimensionless reflectivity; n is the number of bands; is the random error; x i is the regression coefficient obtained by least squares training, where i = 0, ..., n, and x0 is the intercept term.
[0014] In some embodiments, when there are n+1 coefficients and n sensor readings, the complete set of n reflectivity values can be written in matrix algebraic notation as shown in Equations (7) and (8): (7) (8) Where, ds mn represents the reflectivity value of the mth observation; The estimation of x is as follows: (9) Where, ds Tis the transpose of the spectral data matrix, X is the regression coefficient vector, and m is the number of samples. Batch modeling is performed accordingly.
[0015] In some embodiments, in S7, the coefficient of determination R 2 It indicates the degree to which the model explains the total variation of the target variable. The value is between 0 and 1. The closer the value is to 1, the stronger the explanatory power of the model. 2 According to formula (10), (10) Where y c represents the model's predicted value for a certain pork maturity quality; a is the true value of the experiment; m is the true mean value; The root mean square error (RMSEC) of the correction is calculated according to formula (11): (11) Where n is the number of effective samples for modeling; The cross-validation corrected root mean square error RMSECV is calculated according to formula (12): (12) Where y p It represents the model's prediction value for a certain pork maturity quality; The residual prediction deviation RPD is the ratio of the standard deviation of the response variable to the RMSEP or RMSECV; The relative standard deviation (RSD) refers to the ratio of the standard deviation of the predicted value to its mean value, which measures the degree of dispersion of the predicted results.
[0016] The present invention also discloses a system for near-infrared spectral detection of pork, which is used to implement a near-infrared spectral detection method for pork. The system is flexibly attached to a pork sample to be tested and includes: a microcontroller, a visible light sensor and a near-infrared spectral sensor electrically connected to the microcontroller respectively, a first white LED light source and a second white LED light source located adjacent to the visible light sensor and the near-infrared spectral sensor respectively. The microcontroller is provided with a main control module, a data processing module and a remote communication module connected to the ONENET platform for remote communication, and also includes a power supply module for powering the microcontroller.
[0017] Beneficial effects:
[0018] The present invention discloses a near-infrared spectroscopy detection method and system for pork, which has the following advantages over the prior art: The present invention flexibly attaches the Vis / NIR spectral sensing system to the surface of pork samples, evenly irradiates the pork muscle tissue from the complex surface, adapts to irregular surface detection to obtain pork reflectance spectrum data, and achieves simultaneous and rapid detection of multiple quality classifications of pork, meeting the needs of real-time, on-site detection. The Vis / NIR spectral sensing system used is low-cost and smaller than traditional spectral equipment, making it more accessible. Obtaining the true values of the sensory indicators L*, a*, b* and the physical and chemical indicators of fat, protein, moisture, and pH value of the mature quality of the pork by artificial methods, and matching the true values of the pork with the measured reflectance spectrum data; By standardizing the sample data and preprocessing it, the dimension differences and scale effects between the values of each band are eliminated to improve the fitting stability of the regression and classification models; A numerical prediction model of spectrum and pork quality parameters is established through multivariate linear regression (MLR). A classification model is constructed through a self-designed classification algorithm using the Vis / NIR spectral sensing system to determine the grade of pork quality and evaluate the accuracy and stability of the model. When the model meets the requirements, the Vis / NIR spectral sensing system can be attached to pork on complex surfaces to achieve simultaneous and rapid detection of multiple pork quality parameters, achieving not only high detection accuracy and efficiency but also low equipment cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments, which constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are intended to explain the present invention and do not constitute improper limitations on the present invention. Figure 1 A flow chart of a near-infrared spectroscopy method for detecting pork provided by an embodiment of the present invention; Figure 2 A schematic structural diagram of a system for near-infrared spectroscopy detection of pork provided in an embodiment.
[0020] In the figure: microcontroller 1; main control module 11; data processing module 12; wireless communication module 13; power supply module 2; VIS sensor 3; NIR sensor 4; first white LED light source 5; second white LED light source 6; ONENET platform 7; pork sample 8. DETAILED DESCRIPTION
[0021] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0022] In the description of the present invention, it should be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc., indicating directions or positional relationships, are based on the directions or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction. Therefore, they cannot be understood as limiting the present invention.
[0023] like Figure 1-Figure 2 As shown, the technical solution of the present invention: A near infrared spectroscopy detection method for pork, comprising the following steps: S1: Obtaining manually measured values of the maturity quality index of the pork sample 8 and the microcontroller 1 obtaining the corresponding Vis / NIR spectral sensing system data set: A Vis / NIR spectral sensing system is flexibly attached to the surface of a pork sample 8, and a main control module 11 of a microcontroller 1 controls the VIS sensor 3, the NIR sensor 4, the first white LED light source 5, and the second white LED light source 6 to start working, uniformly irradiating the pork muscle tissue from the complex surface to obtain reflectance spectrum data of the pork sample 8; and manually measured values of the mature quality sensory indicators of L*, a*, and b*, and the physical and chemical indicators of fat, protein, moisture, and pH value of the pork are obtained corresponding to the reflectance spectrum data. S2: Eliminate abnormal samples and obtain a standard data set: The data processing module 12 removes abnormal samples through principal component analysis PCA and confidence interval method; S3: Divide the dataset into a calibration set and a validation set: The pork samples 8 under the same refrigeration conditions are divided into several preset storage days, and the pork samples 8 of each storage day are tested to obtain physical and chemical indexes and sensory quality data sets, and the microcontroller 1 obtains the corresponding spectral data sets; The data processing module 12 uses a stratified random sampling method to divide the data of each storage time point into 80% of the calibration set and 20% of the validation set; S4: Standardize and preprocess the sample data to eliminate the dimension effect: The data processing module 12 sets the standardized parameter mean and standard deviation, performs standardization on the row vector dc of the calibration set, and performs standardization on the row vector dv of the validation set to eliminate the dimensional differences and scale effects between the values of each band; S5: Establishing a mature quality prediction model: The data processing module 12 establishes a numerical prediction model for spectral data and pork quality parameters through multiple linear regression (MLR). The main control module 11 controls the constructed MLR model to independently establish seven sensory and physical and chemical indicators of pork maturity quality. The data processing module 12 predicts the corresponding maturity quality value by performing multiple regression on the spectral data of all channels of the Vis / NIR spectral sensing system. S6: Establish a mature quality classification model: The data processing module 12 constructs a classification model based on the self-designed classification algorithm of the Vis / NIR spectral sensing system, such as formula (1), which is used to determine the grade of pork quality. According to the inherent coupling relationship between pork spectral data and mature quality characteristics, spectral parameter classification is performed: (1) Among them, D i is the spectrum level of the i-th band; I by is the predicted band spectrum of the level sample to be predicted; T iby is the mean value of the spectrum in the i-th band; s is the number of spectral parameters of the modeling samples; i=1, ..., 12; The minimum value of the above maturity index is used as the actual maturity index, as shown in formula (2): (2) Where, L i is the maturity index actually calculated for the i-th time; The solution category is as follows: (3) Pork samples are divided into four grades D1, D2, D3 and D4 based on physical, chemical and sensory indicators, corresponding to the quality levels of excellent, good, qualified and unqualified.
[0024] S7: Evaluate model accuracy and stability: The data processing module 12 calculates the coefficient of determination R², the root mean square error RMSEC / RMSECV, the residual prediction deviation RPD, and the relative standard deviation RSD to jointly evaluate the model; When the following conditions are met: R²≥0.90; RMSEC≤10%; RMSECV≤10%; RPD≥3; RSD≤10%, the main control module 11 determines that the model is accurate and stable. When any one of the conditions is not met, the main control module 11 determines that the model is inaccurate and controls the training to start again from step 5 until it is qualified.
[0025] The first preferred embodiment disclosed by the present invention is as follows Figure 2 As shown: A system for near-infrared spectroscopy detection of pork, which executes a near-infrared spectroscopy detection method for pork and performs classification detection on pork, includes a connected microcontroller 1, a power module 2, a VIS sensor 3, a NIR sensor 4, a first white LED light source 5, a second white LED light source 6, and a ONENET platform 7.
[0026] The microcontroller 1 is electrically connected to the VIS sensor 3 and the NIR sensor 4 respectively, the VIS sensor 3 is connected to the first white LED light source 5, and the NIR sensor 4 is connected to the second white LED light source 6, and the VIS sensor 3, the NIR sensor 4, the first white LED light source 5, and the second white LED light source 6 are all flexibly attached to the surface of the pork sample 8 to be tested. The power module 2 is connected to the microcontroller 1 for power supply. The microcontroller 1 also includes a main control module 11, a data processing module 12, and a wireless communication module 13; the microcontroller 1 is remotely connected to the ONENET platform 7 through the wireless communication module 13, and the MQTT protocol is used to complete data transmission and analysis.
[0027] In this embodiment, the VIS sensor 3 selects the AS7262 visible light sensor. The AS7262 visible light sensor integrates six channels, with central wavelengths of 450 nm, 500 nm, 550 nm, 570 nm, 600 nm, and 650 nm as the center, and a bandwidth of ±40 nm. It is used in conjunction with the first white LED light source 5. The first white LED light source 5 adopts a 5700K white LED light source, which can form uniform illumination on the surface of the pork sample 8 and collect reflectance spectrum data with a high signal-to-noise ratio, and is suitable for capturing the spectral characteristics of pork muscle tissue on complex surfaces.
[0028] NIR sensor 4 uses the AS7263 near-infrared spectroscopy sensor, which integrates six independent channels centered at wavelengths of 610 nm, 680 nm, 730 nm, 760 nm, 810 nm, and 860 nm. Each channel has a bandwidth of ±33 nm. It is used in conjunction with a second white LED light source 6, which uses a high-intensity 1500 μW / cm² LED light source to collect deep reflected light from pork sample 8 and enhance the detection signal strength of near-infrared sensitive components such as moisture and fat. The AS7263 near-infrared spectroscopy sensor has fast response, low-noise output, and good environmental adaptability, making it suitable for near-infrared detection of multi-parameter pork quality.
[0029] The main control module 11 is set to ESP32-S, which is used to control the operation of the VIS sensor 3, the NIR sensor 4, the first white LED light source 5, and the second white LED light source 6. The data processing module 12 is used for data processing during the model establishment process.
[0030] The second preferred embodiment disclosed by the present invention is as follows Figure 1-Figure 2 As shown: A near infrared spectroscopy detection method for pork, comprising the following steps: S1: Obtaining manually measured values of maturity quality indicators of pork samples 8 and the microcontroller 1 obtaining corresponding Vis / NIR spectral sensing system data sets, which include reflectance spectrum data obtained by the VIS sensor 3 and the NIR sensor 4.
[0031] The Vis / NIR spectral sensing system is flexibly attached to the surface of the pork sample 8. The main control module 11 of the microcontroller 1 controls the VIS sensor 3, NIR sensor 4, first white LED light source 5, and second white LED light source 6 to start working. The system evenly irradiates the pork muscle tissue from the complex surface to obtain reflectance spectrum data of the pork sample 8. In this embodiment, the VIS sensor 3 is an AS7262 visible light sensor, the NIR sensor 4 is an AS7263 near-infrared spectrum sensor, the first white LED light source 5 is a 5700K white LED light source, and the second white LED light source 6 is a 1500μW / cm² high-intensity LED light source.
[0032] The microcontroller 1 obtains the measured values of the L*, a*, b* color sensory indicators and the fat, protein, moisture, and pH value physical and chemical indicators of the pork maturity quality measured manually corresponding to the reflectance spectrum data; wherein the L*, a*, and b* values are obtained by measuring with a colorimeter, and they jointly describe the characteristics of the meat color, the brightness component L* ranges from 0 to 100, and the larger the value, the higher the brightness; the value ranges of a* and b* are both from +127 to -128, representing the range from magenta to green and from yellow to blue, respectively.
[0033] Spectral data and maturity quality indicators are expressed as: The spectral data of the i-th sample is set to X i =[x i1 ,……, x i12 ], x i1 to x i12 represents the spectral data of 12 independent channels of the Vis / NIR spectral sensing system; the true value of the maturity quality index of pork sample 8 is set to Y i =[y i1 , ……,y i7 ], where i∈[1, m] represents the sample number and m is the total number of samples; i1 to y i7 They represent the actual measured values of seven maturity qualities: L*, a*, b*, fat, protein, moisture, and pH.
[0034] It should be noted that the spectral data of the pork sample 8 was measured three times using the Vis / NIR spectral sensing system, and the average value was calculated.
[0035] S2: Eliminate abnormal samples and obtain a standard data set: The data processing module 12 removes abnormal samples through principal component analysis PCA and confidence interval method; The steps for eliminating abnormal samples using principal component analysis (PCA) and confidence interval method are as follows: perform PCA dimensionality reduction on the spectral data of all samples, extract the first two principal components (PC1 and PC2) for two-dimensional visualization; construct an ellipse envelope (confidence ellipse) with a 95% confidence interval to determine whether the sample falls within the normal distribution range. Samples falling within the ellipse are considered normal values, and samples falling outside the ellipse are considered outliers, and abnormal samples are eliminated.
[0036] S3: Divide the dataset into a calibration set and a validation set: The pork samples 8 were all stored under refrigerated conditions at 4°C, and the detection cycles were the 1st day, the 3rd day, the 5th day, and the 7th day, with a total of four storage time points. At each time point, a preset number of pork samples 8 were collected and the corresponding physical and chemical indicators and sensory quality measurements were completed, and the microcontroller 1 obtained the corresponding spectral data set.
[0037] Spectrum: The spectral reflectance values in the medium- and long-wavelength regions (600-860nm) showed a pattern of first significantly decreasing from Day 1 to Day 5 during storage, and then significantly recovering on Day 7. The largest changes were observed near 680nm and 610nm. The short-wavelength region (450-570nm) showed large fluctuations with no clear trend, as shown in Table 1. Table 1
[0038] Physical and chemical indicators: The changing trend of physical and chemical indicators (continuous linear change) is not completely synchronized with the changing trend of medium and long wave spectral reflectance (nonlinear change that first decreases and then increases). Color: Lightness (L*) rises slightly and then becomes brighter, redness (a*) is basically stable but rises slightly later, and yellowness (b*) decreases significantly and continuously. Composition: Fat and protein content continue to decline slowly, while moisture content continues to rise steadily. pH value continues to rise steadily, which is a typical chemical signal of meat spoilage, as shown in Table 2: Table 2
[0039] This suggests that the spectral response may be more sensitive to capture the significant changes in certain physical states (such as cell structure, moisture distribution, and pigment state) of pork during the middle storage period (Day 3-Day 5), while the physical and chemical indicators more reflect the chemical degradation process that accumulates linearly over time.
[0040] The continuous rise in pH value and the continuous increase in moisture content are important chemical bases for judging the decline in pork freshness.
[0041] The data processing module 12 adopts a stratified random sampling method, dividing the data of each storage time point into 80% calibration set and 20% validation set, to ensure that the samples in each time period are representative and avoid model bias.
[0042] S4: Standardize and preprocess the sample data to eliminate the dimension effect: The data processing module 12 sets the standardized parameters Mean (mean) and Standard Deviation (SD), and performs standardized processing on the row vector dc of the calibration set and the row vector dv of the validation set to eliminate the dimensional differences and scale effects between the values of each band, so as to improve the fitting stability of the regression and classification models; The row vector dc of the calibration set is normalized according to formula (4) to obtain dsc i ; (4) Where, dsc i , represents the spectral data of the calibration set sample of the i-th sample (standardized calibration), the unit is relative reflectance, and after standardization, it is a unitless and dimensionless value; dc i , represents the spectral reading of the original calibration set of the i-th sample; Mean (dc) represents the mean value of each band in the calibration set, which is a dimensionless reflectance value; SD (dc) represents the standard deviation of each band in the calibration set and is a dimensionless reflectance value.
[0043] The row vector dv of the validation set is standardized according to formula (5) to obtain dsv i ; (5) Where, dsv i , represents the spectral data of the validation set sample of the i-th sample (standardized validation), the unit is relative reflectance, and after standardization, it becomes a unitless and dimensionless value; dv i , represents the spectral readings of the original validation set of the i-th sample; Mean (dv) represents the mean of each band in the validation set, which is a dimensionless reflectance value; SD (dv) represents the standard deviation of each band in the validation set and is a dimensionless reflectance value.
[0044] S5: Establishing a mature quality prediction model: The data processing module 12 establishes a numerical prediction model for spectral data and pork quality parameters through multiple linear regression (MLR). The main control module 11 controls the constructed MLR model to independently establish seven sensory and physical and chemical indicators of pork maturity quality. The data processing module 12 predicts the corresponding maturity quality value by performing multiple regression on the spectral data of all channels of the Vis / NIR spectral sensing system. The steps of constructing the MLR model are as follows: (6) Where, Y(a) represents the predicted a-th maturity quality index; ds i, represents the reflectivity value of the i-th band, and the unit is dimensionless reflectivity; n, represents the number of bands; , represents random error; x i , represents the regression coefficient obtained by least squares training, where i = 0, ..., n; x0, represents the intercept term; When there are n+1 coefficients and n sensor readings, the complete set of n reflectivity values can be written in matrix algebraic notation as in Equations (7) and (8): (7) (8) Where, ds mn represents the reflectivity value of the mth observation; The estimation of x is as follows: (9) Where, ds T , represents the transpose of the spectral data matrix, x, represents the regression coefficient vector; m, represents the number of samples; A total of m samples are collected and batch modeling is performed accordingly.
[0045] The constructed MLR models were independently established for seven pork maturity quality indicators (L*, a*, b*, fat, protein, moisture, and pH), and the corresponding quality values were predicted by performing multiple regression on 12-channel spectral data.
[0046] S6: Establish a mature quality classification model: The data processing module 12 constructs a classification model based on a self-designed classification algorithm of the Vis / NIR spectral sensing system for determining the grade of pork quality; The Vis / NIR sensing system self-designs the classification algorithm preprocessing, as shown in formula (1), (1) Where D i , represents the spectrum level of the i-th band; I by , represents the predicted band spectrum of the level sample to be predicted; T iby , represents the mean value of the spectrum of band i; S, represents the number of spectral parameters of the modeled samples; i∈[1,…,12]; Using the minimum value of the above maturity index as the actual maturity index, as shown in formula (2), (2) Where, L i , represents the maturity index actually calculated for the i-th time; Solving category, such as formula (3), (3) Pork sample 8 was divided into four grades, D1, D2, D3, and D4, based on physical, chemical, and sensory indicators, corresponding to the quality levels of superior, good, qualified, and unqualified.
[0047] Based on the intrinsic coupling relationship between pork spectral data and mature quality characteristics, and the law that the absorption intensity of specific bands changes with the extension of pork storage time, spectral parameter classification, namely pork mature quality index classification, is carried out.
[0048] S7: Evaluate model accuracy and stability: The data processing module 12 evaluates the model by calculating the determination coefficient R², the root mean square error RMSEC / RMSECV, the residual prediction deviation RPD, and the relative standard deviation RSD; When the following conditions are met: R²≥0.90; RMSEC≤10%; RMSECV≤10%; RPD≥3; RSD≤10%, the main control module 11 determines that the accuracy and stability of the model are qualified. When one of the conditions does not meet the threshold requirement, the main control module 11 determines that the model is unqualified, and the control starts training again from step 5 until it is qualified.
[0049] Coefficient of determination R 2 It indicates the degree to which the model explains the total variation of the target variable. The value is between 0 and 1. The closer the value is to 1, the stronger the explanatory power of the model. 2 According to formula (10), (10) Where y c , represents the model's predicted value for a certain pork maturity quality; y a , represents the true value of the experiment; y m , represents the true value mean; The root mean square error (RMSEC) of the correction is calculated according to formula (11): (11) Where n represents the number of effective samples for modeling; The cross-validation corrected root mean square error RMSECV is calculated according to formula (12): (12) Where y p , represents the model's predicted value for a certain pork maturity quality; The residual prediction deviation RPD is the ratio of the standard deviation of the response variable to the RMSEP or RMSECV; The relative standard deviation (RSD) refers to the ratio of the standard deviation of the predicted value to its mean value, which measures the degree of dispersion of the predicted results.
[0050] After the model is verified to be qualified, the Vis / NIR spectral sensing system can be directly and flexibly attached to the pork to be tested, that is, the main control module 11 of the microcontroller 1 controls the VIS sensor 3, the NIR sensor 4, the first white LED light source 5, and the second white LED light source 6 to start working, and evenly irradiates the pork muscle tissue from the complex surface to obtain the reflection spectrum data of the pork sample 8. Then the data processing module 12 processes it to form one of the preset quality levels of excellent, good, qualified, and unqualified. The data information is transmitted to electronic devices such as computers, mobile phones, etc. through the ONENET platform 7 through the wireless communication module 13, so that the testing personnel can know the status of the pork to be tested.
[0051] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.
Claims
1. A near infrared spectroscopy method for pork, characterized by: The steps include: S1: Obtain the measured values of pork maturity quality indicators and the corresponding Vis / NIR spectral sensing system dataset: The Vis / NIR spectral sensing system is flexibly attached to the surface of a pork sample, and the pork muscle tissue is uniformly illuminated from the complex surface to obtain the reflectance spectrum data of the pork; the color sensory indicators of L*, a*, and b* and the measured values of the physical and chemical indicators of fat, protein, moisture, and pH value of the pork are obtained; S2: Eliminate abnormal samples and obtain a standard data set: Abnormal samples were eliminated through principal component analysis (PCA) and confidence interval method; S3: Divide the dataset into a calibration set and a validation set: Pork samples stored under the same refrigeration conditions were divided into several storage days. The pork samples at each storage day were tested to obtain physical and chemical indicators, sensory quality data sets, and corresponding spectral data sets. A stratified random sampling method was used, and the data at each storage time point were divided into 80% and 20% of the data were allocated to the calibration set and the validation set respectively. S4: Standardize and preprocess the sample data to eliminate the dimension effect: Set the standardized parameter mean and standard deviation SD, standardize the row vector dc of the calibration set, and standardize the row vector dv of the validation set to eliminate the dimensional differences and scale effects between the values of each band; S5: Establishing a mature quality prediction model: A numerical prediction model for spectra and pork quality parameters was established using multiple linear regression (MLR). The constructed MLR model was independently developed for sensory and physicochemical indicators of pork maturity quality. Multiple regression was performed on the spectral data from all channels of the Vis / NIR spectral sensing system to predict the corresponding maturity quality values. S6: Establish a mature quality classification model: A classification model is constructed based on the self-designed classification algorithm of the Vis / NIR spectral sensing system, as shown in formula (1), which is used to determine the grade of pork quality. The spectral parameters are classified based on the intrinsic coupling relationship between pork spectral data and mature quality characteristics: (1) Among them, D i is the spectrum level of the i-th band; I by is the predicted band spectrum of the level sample to be predicted; T iby is the mean value of the spectrum in the i-th band; s is the number of spectral parameters of the modeling samples; i=1, ..., 12; Using the minimum value of the above maturity index as the actual maturity index, as shown in formula (2), (2) Where, L i is the maturity index actually calculated for the i-th time; The solution category is as follows: (3) Pork samples are divided into four grades, D1, D2, D3, and D4, based on physical, chemical, and sensory indicators, corresponding to the quality levels of excellent, good, qualified, and unqualified; S7: Evaluate model accuracy and stability: The model was evaluated by determining the coefficient of determination (R²), the root mean square error (RMSEC) / RMSECV, the residual prediction deviation (RPD), and the relative standard deviation (RSD). When the following conditions are met: R² ≥ 0.90; RMSEC ≤ 10%; RMSECV ≤ 10%; RPD ≥ 3; RSD ≤ 10%, the model is accurate and stable. If any of these conditions do not meet the requirements, the existing model is inaccurate and needs to be retrained until it passes.
2. The near-infrared spectroscopy method for pork according to claim 1, characterized in that: In S1, the spectral data of the i-th sample is set to X i =[x i1 ,……, x i12 ], x i1 to x i12 They represent the spectral data of 12 independent channels of the Vis / NIR spectral sensing system respectively; the true value of the mature quality index is set to Y i =[y i1 , …, y i7 ], where i∈[1, m] represents the sample number and m is the total number of samples; i1 to y i7 They represent the actual measured values of seven maturity qualities: L*, a*, b*, fat, protein, moisture, and pH.
3. The near-infrared spectroscopy method for pork according to claim 1, wherein: In S2, the steps of principal component analysis (PCA) and confidence interval method to eliminate abnormal samples are as follows: perform PCA dimensionality reduction on the spectral data of all samples, extract the first two principal components (PC1 and PC2) for two-dimensional visualization; construct an elliptical envelope with a 95% confidence interval to determine whether the sample falls within the normal distribution range. Samples falling within the ellipse are considered normal values, and samples falling outside the ellipse are considered outliers, and abnormal samples are eliminated.
4. The near-infrared spectroscopy method for pork according to claim 1, characterized in that: S3 also includes pork samples stored under refrigerated conditions at 4°C, with the testing cycles being the 1st day, 3rd day, 5th day, and 7th day, with a total of four storage time points. Several samples are collected at each time point and the corresponding physical and chemical indicators and sensory quality measurements are completed.
5. The near-infrared spectroscopy method for pork according to claim 1, characterized in that: In S4, the row vector dc of the calibration set is normalized according to formula (4) to obtain dsc i ; (4) Where, dsc i is the spectral data of the calibration set sample of the i-th sample, the unit is relative reflectance, and it is a unitless and dimensionless value after normalization; dc i is the spectral reading of the original calibration set of the i-th sample; Mean (dc) is the mean of each band in the calibration set, which is a dimensionless reflectance value; SD (dc) is the standard deviation of each band in the calibration set, which is the dimensionless reflectance value; The row vector dv of the validation set is standardized according to formula (5) to obtain dsv i ; (5) Where, dsv i is the spectral data of the validation set sample of the i-th sample, the unit is relative reflectance, and it is a unitless and dimensionless value after normalization; dv i is the spectral reading of the original validation set of the i-th sample; Mean (dv) is the mean of each band in the validation set, which is a dimensionless reflectance value; SD(dv) is the standard deviation of each band in the validation set and is a dimensionless reflectance value.
6. The near-infrared spectroscopy method for pork according to claim 1, characterized in that: In S5, the steps of constructing the MLR model are as shown in formula (6); (6) Where, Y(a) is the predicted a-th maturity quality index, ds i is the reflectivity value of the i-th band (i = 1 to 12), the unit is dimensionless reflectivity; n is the number of bands; is the random error; x i is the regression coefficient obtained by least squares training, where i = 0, ..., n, and x0 is the intercept term.
7. The near-infrared spectroscopy method for pork according to claim 6, characterized in that: When there are n+1 coefficients and n sensor readings, the complete set of n reflectivity values can be written in matrix algebraic notation as in Equations (7) and (8): (7) (8) Where, ds mn is the reflectivity value of the mth observation; The estimation of x is as follows: (9) Where, ds T is the transpose of the spectral data matrix, X is the regression coefficient vector, and m is the number of samples. Batch modeling is performed accordingly.
8. The near infrared spectroscopy detection method for pork according to claim 1, characterized in that: In S7, the coefficient of determination R 2 It indicates the degree to which the model explains the total variation of the target variable. The value is between 0 and 1. The closer the value is to 1, the stronger the explanatory power of the model. 2 According to formula (10), (10) Where y c is the model's predicted value for a certain pork maturity quality; a is the true value of the experiment; m is the true mean value; The root mean square error (RMSEC) of the correction is calculated according to formula (11): (11) Where n is the number of effective samples for modeling; The cross-validation corrected root mean square error RMSECV is calculated according to formula (12): (12) Where y p is the model's predicted value for a certain pork maturity quality; The residual prediction deviation RPD is the ratio of the standard deviation of the response variable to the RMSEP or RMSECV; The relative standard deviation (RSD) refers to the ratio of the standard deviation of the predicted value to its mean value, which measures the degree of dispersion of the predicted results.
9. A system for near infrared spectroscopy detection of pork, characterized in that: Used to implement the near-infrared spectroscopy detection method for pork according to any one of claims 1 to 8, it is flexibly attached to the pork sample to be tested, and includes: a microcontroller, a visible light sensor and a near-infrared spectroscopy sensor electrically connected to the microcontroller respectively, a first white LED light source and a second white LED light source located adjacent to the visible light sensor and the near-infrared spectroscopy sensor respectively, the microcontroller is provided with a main control module, a data processing module and a remote communication module connected to the ONENET platform for remote communication, and also includes a power module for powering the microcontroller.
Citation Information
Patent Citations
Method for quickly detecting nutritional ingredients in camel meat at different parts based on near infrared spectroscopy
CN113125378A
Rapid detection method for nutritional quality and freshness of fresh pig meat
CN115901760A
Method and system for determining content of crude fat in mutton
CN117871459A
Forestry soil detection sampling system and method
CN118688127A
Non-destructive detection method and system for Conopomorpha sinensis Bradley
US12228529B1