A method, device and equipment for rapidly predicting pork color value and a storage medium
By combining the SE-ResMLP deep learning model with SG-D2 preprocessing, the limitations of traditional colorimeter measurement methods and the high computational resource consumption of deep learning models are solved, enabling fast, non-destructive, and accurate prediction of pork color values, which is suitable for online deployment on resource-constrained devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUN YAT SEN UNIV
- Filing Date
- 2026-03-09
- Publication Date
- 2026-05-29
AI Technical Summary
Traditional colorimeter measurement methods are destructive, slow, and difficult to meet the needs of online large-scale pork quality control. Existing machine learning models have insufficient feature extraction capabilities in high-dimensional spectral data processing, and deep learning models consume a lot of computational resources and are difficult to deploy on resource-constrained devices.
By employing the SE-ResMLP deep learning model combined with the SG-D2 preprocessing algorithm, key spectral features are automatically selected through feature extraction and residual connection to suppress noise interference, enabling rapid and lossless prediction of pork color values.
It significantly improves the predictive relevance and accuracy of pork color values, reduces computational complexity, and is suitable for online deployment in portable testing equipment.
Smart Images

Figure CN122108976A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of deep learning technology, and in particular to a method, apparatus, device and storage medium for rapid prediction of pork color values. Background Technology
[0002] The color of pork is a core indicator of its sensory quality and consumer acceptance. In pork color determination, a traditional colorimeter serves as the standard reference tool, quantifying the light reflected from the meat surface into L, a, and b values by simulating human eye perception. L value (lightness): reflects the brightness of the meat color. A high L value may indicate PSE meat (pale, soft, watery), while a low L value leads to DFD meat (dark, hard, dry). a value (redness): determines the freshness and sensory acceptance of the meat. A high a value results in bright red meat; prolonged storage causes oxidation and browning, at which point the a value decreases. b value (yellow-blue tint): Normal pork has a low b value; an elevated b value usually indicates fat oxidation and spoilage (producing yellow carbonyl compounds), suggesting a decline in meat freshness.
[0003] Traditionally, these values are obtained through physical contact measurement on the surface of meat samples using a colorimeter. While accurate, this method has significant limitations: 1) it is a destructive or semi-destructive test, affecting the value of the product; 2) the measurement speed is slow, making it difficult to meet the real-time quality control requirements of online, high-volume production lines; and 3) single-point measurements are easily affected by the unevenness of the meat sample surface, resulting in insufficient representativeness. Summary of the Invention
[0004] The main objective of this application is to provide a method, apparatus, device, and storage medium for rapid prediction of pork color values, so as to improve the measurement efficiency and accuracy of pork color values.
[0005] To achieve the above objectives, one aspect of this application proposes a method for rapid prediction of pork color values, the method comprising the following steps: Obtain the raw spectral data of the pork to be tested; Baseline drift and linear background interference are removed from the original spectral data, and overlapping peaks are separated to obtain preprocessed spectral data; The predicted chromaticity value of the pork to be tested is determined using a pre-trained deep learning model based on the preprocessed spectral data; wherein the pre-trained deep learning model is trained from pork spectral data labeled with chromaticity values.
[0006] In some embodiments, the deep learning model includes the SE-ResMLP deep learning model; The SE-ResMLP deep learning model includes an input layer, an SE attention module, a residual module, and an output layer. The input layer structure includes a fully connected layer, batch normalization, and an activation function. The input layer is used to map the dimension of the input spectral data to a feature space of a set dimension. The SE attention module is used to introduce a Squeeze-and-Excitation mechanism in the early stage of feature extraction. Squeeze is used to compress features into a global feature descriptor through adaptive average pooling. Excitation is used to learn the weights of each feature channel through two fully connected layers and a sigmoid activation function. ScaLe is used to multiply the learned weights by the original features. The residual module comprises two cascaded residual blocks: Resblock 1 and Resblock 2; wherein, the main path of the residual module includes: Linear, bN, ReLU, Dropout, Linear, BN; the shortcut of the residual module is set as follows: if the input and output dimensions are inconsistent, 1x1 convolution is used for dimension matching; if the input and output dimensions are consistent, the input and output are directly added; the final output of the residual module is the output of the main path plus the shortcut; ReLU is used to introduce residual connections; The output layer is a fully connected layer, used to map the features output by the residual module to the target dimension output as the predicted chromaticity value.
[0007] In some embodiments, the pre-trained deep learning model is trained through the following steps: A standard colorimeter was used to measure the colorimetric values at multiple different locations on each pork sample, and the actual colorimetric values were recorded. The average value of each actual chromaticity value is calculated as the chromaticity value label of the pork sample; The spectral data of the pork sample were acquired using a spectral acquisition device; The chromaticity value labels are annotated onto the sample spectral data to obtain training data; The deep learning model is trained based on the training data to obtain the pre-trained deep learning model.
[0008] In some embodiments, training the deep learning model based on the training data includes the following steps: When training the deep learning model, the mean squared error loss is used as the loss function, and the Adam optimizer is used for optimization. The coefficient of determination, root mean square error, mean absolute error, mean absolute percentage error, and Pearson correlation coefficient are calculated to evaluate the training effect.
[0009] In some embodiments, obtaining the raw spectral data of the pork to be tested includes the following steps: The raw spectral data of the pork to be tested are obtained using a spectral acquisition device.
[0010] In some embodiments, removing baseline drift and linear background interference from the original spectral data and separating overlapping peaks to obtain preprocessed spectral data includes the following steps: The baseline drift and linear background interference of the original spectral data are removed by using Savitzky-GoLay smoothing filter combined with the second derivative algorithm, and overlapping peaks are separated to obtain the preprocessed spectral data.
[0011] To achieve the above objectives, another aspect of this application proposes a rapid prediction device for pork color values, the device comprising: The spectral acquisition unit is used to acquire the raw spectral data of the pork to be tested. The spectral preprocessing unit is used to remove baseline drift and linear background interference from the original spectral data and separate overlapping peaks to obtain preprocessed spectral data. A chromaticity prediction unit is used to determine the predicted chromaticity value of the pork to be tested based on the preprocessed spectral data using a pre-trained deep learning model; wherein the pre-trained deep learning model is trained from pork spectral data labeled with chromaticity values.
[0012] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method.
[0013] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0014] To achieve the above objectives, another aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0015] The embodiments of this application include at least the following beneficial effects: This application provides a method, apparatus, device, and storage medium for rapid prediction of pork chromaticity values. The solution involves acquiring the original spectral data of the pork to be tested; removing baseline drift and linear background interference from the original spectral data and separating overlapping peaks to obtain preprocessed spectral data; and using a pre-trained deep learning model to determine the predicted chromaticity values of the pork based on the preprocessed spectral data. The pre-trained deep learning model is trained on pork spectral data labeled with chromaticity values. This application addresses the problems of significant background interference and severe feature overlap in the original spectral data by combining specific preprocessing methods with an attention mechanism, thereby significantly improving the relevance, accuracy, and efficiency of the deep learning model in predicting pork chromaticity values. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart illustrating a method for rapid prediction of pork color values provided in an embodiment of this application; Figure 2 An example flowchart of a method for rapid prediction of pork color values provided in this application embodiment; Figure 3 A schematic diagram of the architecture of the SE-ResMLP deep learning model provided in the embodiments of this application; Figure 4 A scatter plot of the predicted L*, a*, and b* values provided in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of a rapid prediction device for pork color value provided in an embodiment of this application; Figure 6 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0020] Before providing a detailed description of the embodiments of this application, some related technologies involved in the embodiments of this application will be described first, as follows: In recent years, near-infrared (NIR) or visible-near-infrared (Vis-NIR) spectroscopy has been widely studied for meat quality prediction due to its advantages such as speed, non-destructiveness, and online capability. Building predictive models from spectral data using machine learning models (such as PLSR, SVM, and CNN) has become the mainstream approach. However, existing models still face challenges when processing high-dimensional, redundant, and noisy spectral data: ordinary machine learning models struggle to effectively capture the complex dependencies between spectral channels; while complex convolutional neural network models incur high computational costs, making them unsuitable for deployment on resource-constrained embedded detection devices.
[0021] The paper, "Quantification and Visualization of Meat Qualitative Traits in Pork Using Hyperspectral Imaging," uses 1091 Duroc × Landrace × Large White (DLY) pork tenderloin samples. Hyperspectral reflectance images were acquired in the 400–1000 nm band using a SpecimIQ hyperspectral camera, and the L, a, and b values measured by a colorimeter were used as ground truth labels. The study employs artificial neural networks (ANNs) for modeling and innovatively fuses hyperspectral data with gray-level co-occurrence matrix (GLCM) texture features extracted from principal component images. The results show that the predicted L, a, and b values have a high R-value. 2 The values are 0.56, 0.43, and 0.45, respectively.
[0022] The paper, "Research on a Rapid and Non-destructive Detection Method for the Freshness of Lean Pork Based on Raman Spectroscopy," focuses on the prediction of color indicators L, a, and b in pork. Spectral data from 121 lean pork samples were collected using a portable Raman spectrometer, and their colorimetric values were simultaneously measured as references. In the spectral preprocessing methods, SNV (Standard Normative Variation), DFa (Detrended Filtration Analysis), and MSC (Multi-Literative Scatter Correction) were combined with partial least squares regression (PLSR) to construct full-band prediction models. The optimal results are as follows: L: SNV-PLSR model, prediction correlation coefficient (RP) of 0.827; a: DFa-PLSR model, RP of 0.858; b: MSC-PLSR model, RP of 0.900.
[0023] The paper "Predicting pork quaLity using Vis / NIR spectroscopy" uses visible / near-infrared spectroscopy (Vis / NIRS) to predict the L, a, and b color values of pork. The study collected reflectance spectra from 134 intact pork longissimus dorsi muscle samples in the wavelength range of 400–1495 nm, and simultaneously measured their colorimetric reference values; 89 samples were used for calibration, and 45 were used for validation. A partial least squares regression (PLSR) model was established, and different preprocessing methods were applied to the spectra (L was obtained using the original spectrum, while a and b were obtained using multivariate scattering correction (MSC)). The final model performed well: L(R 2 = 0.77, RPD = 2.3), a(R 2 =0.84, RPD = 2.2) and b(R 2 = 0.81, RPD = 2.1).
[0024] The shortcomings of existing technology: Limitations of traditional testing methods: While traditional colorimeter measurements are accurate, they are contact measurements, carrying risks of destructive or semi-destructive testing, and are slow, failing to meet the demands of modern production lines for real-time, online quality control of large quantities of pork. Furthermore, single-point measurements are insufficient to represent the overall quality of the meat sample and are easily affected by surface unevenness.
[0025] Traditional machine learning models lack sufficient feature extraction capabilities: Existing spectral prediction schemes mostly employ traditional machine learning algorithms (such as PLSR, SVM, etc.). However, visible-near-infrared spectral data is characterized by high dimensionality, redundancy, and noise. Ordinary machine learning models struggle to effectively capture the complex nonlinear dependencies between spectral channels, resulting in limited prediction accuracy in complex real-world applications (e.g., some existing studies use ANN models to predict the R-values of L, a, and b). 2 It is only between 0.43 and 0.56.
[0026] Deep learning models consume a lot of computational resources: Although complex deep learning models such as convolutional neural networks (CNNs) can improve feature extraction capabilities, their computational overhead is huge and they have many parameters, making them difficult to deploy on resource-constrained embedded detection devices or portable terminals, which limits their practical application and promotion in industrial fields.
[0027] Insufficient spectral preprocessing and feature mining: Variations in pork color (L, a, b) often correspond to weak spectral responses. Existing techniques, with their simple preprocessing methods, often struggle to effectively separate overlapping peaks and enhance key feature bands while removing baseline drift and noise, resulting in insufficient model sensitivity to changes in meat color.
[0028] The technical problem that this application aims to solve is: Solving the challenges of online non-destructive testing: To address the issue that traditional colorimeters cannot perform online, full-scale inspection, this application aims to provide a non-contact detection method based on visible / near-infrared spectroscopy to achieve rapid, non-destructive prediction of pork color values.
[0029] Addressing the contradiction between the difficulty of feature extraction from high-dimensional spectral data and lightweight model design: To address the issues of high computational cost and low accuracy in existing deep learning models, this application aims to design a lightweight and efficient deep learning model (SE-ResMLP). This model needs to be able to automatically select key spectral feature channels, suppress noise interference, and reduce computational complexity while ensuring high prediction accuracy (solving the problem of predicting L, a, and b values), making it suitable for subsequent hardware deployment.
[0030] Improve the accuracy and robustness of pork color index (L, a, b) prediction: By combining a specific preprocessing algorithm (SG-D2) with an attention mechanism, the problems of large background interference and severe feature overlap in the original spectral data are solved, thereby significantly improving the model's prediction relevance and accuracy of pork color values.
[0031] This application provides a method, apparatus, device, and storage medium for rapid prediction of pork chromaticity values, relating to the field of deep learning technology. The method, apparatus, device, and storage medium for rapid prediction of pork chromaticity values provided in this application can be applied to a terminal, a server, or software running on a terminal or server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc., but is not limited thereto; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application implementing a rapid prediction method for pork chromaticity values, etc., but is not limited to the above forms.
[0032] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0033] Reference Figure 1 This application provides a method for rapid prediction of pork color value, which may include, but is not limited to, steps S100 to S120, as follows: S100: Acquire the raw spectral data of the pork to be tested; S110: Remove baseline drift and linear background interference from the original spectral data, and separate overlapping peaks to obtain preprocessed spectral data; S120: Determine the predicted chromaticity value of the pork to be tested based on the preprocessed spectral data using a pre-trained deep learning model; wherein the pre-trained deep learning model is trained from pork spectral data labeled with chromaticity values.
[0034] Optionally, the deep learning model includes the SE-ResMLP deep learning model; The SE-ResMLP deep learning model includes an input layer, an SE attention module, a residual module, and an output layer. The input layer structure includes a fully connected layer, batch normalization, and an activation function. The input layer is used to map the dimension of the input spectral data to a feature space of a set dimension. The SE attention module is used to introduce a Squeeze-and-Excitation mechanism in the early stage of feature extraction. Squeeze is used to compress features into a global feature descriptor through adaptive average pooling. Excitation is used to learn the weights of each feature channel through two fully connected layers and a sigmoid activation function. ScaLe is used to multiply the learned weights by the original features. The residual module comprises two cascaded residual blocks: Resblock 1 and Resblock 2; wherein, the main path of the residual module includes: Linear, bN, ReLU, Dropout, Linear, BN; the shortcut of the residual module is set as follows: if the input and output dimensions are inconsistent, 1x1 convolution is used for dimension matching; if the input and output dimensions are consistent, the input and output are directly added; the final output of the residual module is the output of the main path plus the shortcut; ReLU is used to introduce residual connections; The output layer is a fully connected layer, used to map the features output by the residual module to the target dimension output as the predicted chromaticity value.
[0035] Optionally, the pre-trained deep learning model is trained through the following steps: A standard colorimeter was used to measure the colorimetric values at multiple different locations on each pork sample, and the actual colorimetric values were recorded. The average value of each actual chromaticity value is calculated as the chromaticity value label of the pork sample; The spectral data of the pork sample were acquired using a spectral acquisition device; The chromaticity value labels are annotated onto the sample spectral data to obtain training data; The deep learning model is trained based on the training data to obtain the pre-trained deep learning model.
[0036] Optionally, training the deep learning model based on the training data includes the following steps: When training the deep learning model, the mean squared error loss is used as the loss function, and the Adam optimizer is used for optimization. The coefficient of determination, root mean square error, mean absolute error, mean absolute percentage error, and Pearson correlation coefficient are calculated to evaluate the training effect.
[0037] Optionally, obtaining the raw spectral data of the pork to be tested includes the following steps: The raw spectral data of the pork to be tested are obtained using a spectral acquisition device.
[0038] Optionally, removing baseline drift and linear background interference from the original spectral data and separating overlapping peaks to obtain preprocessed spectral data includes the following steps: The baseline drift and linear background interference of the original spectral data are removed by using Savitzky-GoLay smoothing filter combined with the second derivative algorithm, and overlapping peaks are separated to obtain the preprocessed spectral data.
[0039] The following sections will provide a detailed description and explanation of some optional embodiments of this application, using specific application examples.
[0040] Reference Figure 2 In this embodiment, visible / near-infrared spectral data of pork samples are collected, preprocessed using the SG-D2 algorithm, and then input into a specially designed SE-ResMLP deep learning model. This model uses the SE attention module to automatically weight key feature channels and combines a residual block to deepen the network to extract deep features, ultimately outputting the colorimetric indices (L, a, b values) of the pork.
[0041] Specific implementation steps: Step 1: Data collection and sample preparation.
[0042] After collecting pork samples, colorimetric and spectral data were acquired. Colorimetric measurement: A standard colorimeter was used to measure three different locations on each meat sample, recording the L, a, and b values. The average of these three values was taken as the true label for that sample. Spectral acquisition: Spectral reflectance data for the corresponding meat samples were acquired using a spectral acquisition device. Dataset partitioning: To verify the reliability of the model, 5-fold cross-validation was used.
[0043] Step 2: Data preprocessing (SG-D2).
[0044] Because spectral data is easily affected by ambient light and instrument conditions, this embodiment uses Savitzky-GoLay smoothing filtering combined with second derivative (SG-D2) to process the original spectrum. Specific parameters: window length (window_Length) is 11, polynomial order (poLyorder) is 2, and derivative order (deriv) is 2. Effect: Effectively removes baseline drift and linear background interference from the spectrum, while separating overlapping peaks and significantly enhancing spectral characteristic peaks related to flesh color.
[0045] Standardization: StandardScaler standardization is applied to the preprocessed data to make its mean 0 and variance 1, which accelerates model convergence.
[0046] Step 3: Construct the SE-ResMLP prediction model.
[0047] Reference Figure 3 This embodiment designs a novel deep neural network structure, which mainly consists of an input layer, an SE attention module, stacked residual modules, and an output layer.
[0048] Input Layer: Structure: Fully connected layer (Linear) + batch normalization (batchNorm1d) + activation function (ReLU). Function: Maps the spectral dimension of the input to a 128-dimensional feature space.
[0049] SE Attention Module (SE block): Innovation: Introducing a Squeeze-and-Excitation mechanism in the early stages of feature extraction. Squeeze (compression): Compresses features into a global feature descriptor using adaptive average pooling (adaptiveavgPooL1d). Excitation (activation): Learns the weights (between 0 and 1) for each feature channel through two fully connected layers (with a reduction ratio of 4 in the middle layer) and a sigmoid activation function. ScaLe (recalibration): Multiplies the learned weights by the original features, enabling the model to "focus" on key bands that contribute significantly to the predicted chromaticity value while "suppressing" useless or noisy bands.
[0050] Residual Blocks: The deep learning model in this embodiment includes two cascaded residual blocks: Resblock 1: 128-dimensional input, 128-dimensional output. Resblock 2: 128-dimensional input, 64-dimensional output. Internal Structure: Main Path: Linear, Batch Normalization (bN), ReLU, Dropout, Linear, Batch Normalization (BN). Shortcut: If the input and output dimensions are inconsistent, a 1x1 convolution (Linear) is used for dimension matching; otherwise, they are directly added. Final Output: Main Path + Shortcut, ReLU. Function: Introducing residual connections solves the gradient vanishing problem in deep networks, and the Dropout layer effectively prevents overfitting, improving the robustness of the model.
[0051] Output Layer: Structure: Fully connected (Linear) layer, mapping 64-dimensional features to a 1-dimensional output. Output: Predicted chromaticity value (L, a, or b).
[0052] Model training and evaluation loss function: Mean Squared Error Loss (MSELoss). Optimizer: Adam optimizer, learning rate set to 0.001. Evaluation metric: Calculate R... 2 (Coefficient of determination), RMSE (Root Mean Square Error), MaE (Mean Absolute Error), MaPE (Mean Absolute Percentage Error), and Pearson correlation coefficient.
[0053] To verify the effectiveness of the pork color prediction method based on SG-D2 preprocessing and SE-ResMLP model proposed in this embodiment, the following specific experiments were conducted.
[0054] (1) Experimental materials and data collection.
[0055] This embodiment selected 1700 pork samples as the research subjects. Spectral acquisition: The Fig Spec® FS1X series hyperspectral imaging system (wavelength range 400-1000nm) was used to acquire the reflectance spectral data of the meat sample surface. True value determination: The L, a, and b values of each pork sample were simultaneously measured using a standard colorimeter. The average value was calculated after measuring three different locations for each sample, and this average was used as the true label for model training and validation.
[0056] (2) Data preprocessing (SG-D2).
[0057] For the 1700 raw spectral data points collected, the following preprocessing steps were performed: Smoothing and Differentiation: The Savitzky-GoLay (SG) filtering algorithm was applied. The window length (window_Length) was set to 11, the polynomial fitting order (poLyorder) to 2, and the derivative order (deriv) to 2. Results: This processing effectively eliminated baseline drift during spectral acquisition, separated overlapping peaks, and significantly enhanced weak spectral features related to flesh-colored chemical components.
[0058] Standardization: StandardScaLer standardization is applied to the data after SG-D2 processing to unify the data distribution and accelerate the convergence of subsequent models.
[0059] (3) Model construction and parameter setting.
[0060] The SE-ResMLP model is constructed with the following network parameter configurations: Input layer: Receives preprocessed spectral vectors and maps them to a 128-dimensional feature space through a fully connected layer. SE attention module: Sets the reduction ratio to 4. That is, in the excitation path, the intermediate layer has a dimension of 32, generating 128 channel weight coefficients through the Sigmoid activation function to recalibrate the feature channels. Residual module (Residual bLocks): bLock 1: 128-dimensional input, 128-dimensional output. bLock 2: 128-dimensional input, 64-dimensional output. Dropout ratio is set to 0.2 to prevent overfitting. Training configuration: Uses a 5-fold cross-validation strategy. The loss function is MSELoss, the optimizer is Adam, and the initial learning rate is 0.001. (4) Analysis of experimental results.
[0061] Reference Figure 4 Based on 5-fold cross-validation results of 1700 samples, the method proposed in this embodiment achieves extremely high prediction accuracy for the three chromaticity indices L*, a*, and b*. Specific statistical data are as follows: L* value (luminance) prediction results: average coefficient of determination (R²) of the model in 5-fold validation. 2 The correlation coefficient reached 0.87, and the average correlation coefficient (Pearson r) was 0.94. The data indicates that the model can accurately capture changes in the lightness and darkness of pork, and has important reference value for screening PSE or DFD meat. a* value prediction results: The model performed best in predicting a* values, with an average R... 2 The correlation coefficient reached 0.90, with an average correlation coefficient of 0.95. This indicates that the model has extremely high reproducibility for the redness index, which is most sensitive to meat freshness. b* value prediction results: Average Rb 2The correlation coefficient was 0.83, and the average correlation coefficient was 0.91. This indicates that the model can effectively predict changes in yellowness related to lipid oxidation.
[0062] In summary, this embodiment includes the following key technical solutions: 1. A method for rapid prediction of pork chromaticity values based on visible / near-infrared spectroscopy, including data acquisition, SG-D2 second derivative preprocessing, and prediction steps based on the SE-ResMLP deep learning model.
[0063] 2. SE-ResMLP Model Architecture: This paper protects a one-dimensional spectral regression network structure that integrates the Squeeze-and-Excitation (SE) channel attention mechanism with multi-layer residual blocks (ResiduaL bLocks), particularly for its application in predicting meat quality indicators (L*, a*, b*).
[0064] Compared with existing pork color detection technologies, this embodiment has the following significant advantages: (1) Strong feature extraction capability (introducing SE attention mechanism): To address the characteristics of spectral data—numerous bands, strong correlations, and redundancy—this embodiment innovatively introduces a Squeeze-and-Excitation (SE) attention module into the MLP front-end. This module automatically learns and amplifies the weights of key bands that contribute significantly to chromaticity prediction, while suppressing interference from noise or irrelevant bands. Experiments demonstrate that this results in prediction correlation coefficients exceeding 0.9, significantly outperforming ordinary models.
[0065] (2) Solved the problem of deep network degradation (residual structure): By introducing residual connections, this embodiment constructs a deeper model structure than traditional shallow neural networks (SE-ResMLP), effectively solving the gradient vanishing problem and enabling the model to extract deeper nonlinear spectral features while maintaining training stability.
[0066] (3) The preprocessing algorithm is highly targeted (SG-D2): SG filtering combined with second derivative (SG-D2) was used as a specific preprocessing scheme. Compared with ordinary normalization or first derivative, second derivative can more effectively separate overlapping spectral peaks and remove background interference, which is crucial for extracting the spectral fingerprints of complex chemical components (such as myoglobin and oxymyoglobin) in pork tissue.
[0067] (4) The model is lightweight and efficient, and suitable for online deployment: The SE-ResMLP model in this embodiment is based on one-dimensional spectral data, which significantly reduces computational cost and eliminates the need for complex image texture feature extraction, resulting in faster prediction speed. Combined with the high accuracy results of this embodiment (R² for L* / a* / b* is above 0.87), this method perfectly balances "detection accuracy" and "detection speed," making it highly suitable for deployment in portable detectors or online grading systems in slaughterhouses.
[0068] Reference Figure 5 This application also provides a device for rapid prediction of pork color values, which can realize the above-mentioned method for rapid prediction of pork color values. The device includes: The spectral acquisition unit is used to acquire the raw spectral data of the pork to be tested. The spectral preprocessing unit is used to remove baseline drift and linear background interference from the original spectral data and separate overlapping peaks to obtain preprocessed spectral data. A chromaticity prediction unit is used to determine the predicted chromaticity value of the pork to be tested based on the preprocessed spectral data using a pre-trained deep learning model; wherein the pre-trained deep learning model is trained from pork spectral data labeled with chromaticity values.
[0069] It is understood that the content of the above method embodiments is applicable to the present device embodiments. The specific functions implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0070] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method of this application. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0071] It is understood that the content of the above method embodiments is applicable to the device embodiments. The specific functions implemented by the device embodiments are the same as those of the methods of this application, and the beneficial effects achieved are the same as those achieved by the methods of this application.
[0072] Figure 6 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 101 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 102 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 102 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 102 and is called and executed by the processor 101. Input / output interface 103 is used to implement information input and output; The communication interface 104 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 105 transmits information between various components of the device (e.g., processor 101, memory 102, input / output interface 103, and communication interface 104); The processor 101, memory 102, input / output interface 103 and communication interface 104 are connected to each other within the device via bus 105.
[0073] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method of this application.
[0074] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0075] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0076] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0077] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0078] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0079] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0080] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0081] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0082] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0083] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0084] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0085] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0086] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0087] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A method for rapid prediction of pork color value, characterized in that, The method includes the following steps: Obtain the raw spectral data of the pork to be tested; Baseline drift and linear background interference are removed from the original spectral data, and overlapping peaks are separated to obtain preprocessed spectral data; The predicted chromaticity value of the pork to be tested is determined using a pre-trained deep learning model based on the preprocessed spectral data; wherein the pre-trained deep learning model is trained from pork spectral data labeled with chromaticity values.
2. The method for rapid prediction of pork color value according to claim 1, characterized in that, The deep learning model includes the SE-ResMLP deep learning model; The SE-ResMLP deep learning model includes an input layer, an SE attention module, a residual module, and an output layer. The input layer structure includes a fully connected layer, batch normalization, and an activation function. The input layer is used to map the dimension of the input spectral data to a feature space of a set dimension. The SE attention module is used to introduce a Squeeze-and-Excitation mechanism in the early stage of feature extraction. Squeeze is used to compress features into a global feature descriptor through adaptive average pooling. Excitation is used to learn the weights of each feature channel through two fully connected layers and a sigmoid activation function. ScaLe is used to multiply the learned weights by the original features. The residual module comprises two cascaded residual blocks: Resblock 1 and Resblock 2; wherein, the main path of the residual module includes: Linear, bN, ReLU, Dropout, Linear, BN; the shortcut of the residual module is set as follows: if the input and output dimensions are inconsistent, 1x1 convolution is used for dimension matching; if the input and output dimensions are consistent, the input and output are directly added; the final output of the residual module is the output of the main path plus the shortcut; ReLU is used to introduce residual connections; The output layer is a fully connected layer, used to map the features output by the residual module to the target dimension output as the predicted chromaticity value.
3. The method for rapid prediction of pork color value according to claim 2, characterized in that, The pre-trained deep learning model is obtained through the following steps: A standard colorimeter was used to measure the colorimetric values at multiple different locations on each pork sample, and the actual colorimetric values were recorded. The average value of each actual chromaticity value is calculated as the chromaticity value label of the pork sample; The spectral data of the pork sample were acquired using a spectral acquisition device; The chromaticity value labels are annotated onto the sample spectral data to obtain training data; The deep learning model is trained based on the training data to obtain the pre-trained deep learning model.
4. The method for rapid prediction of pork color value according to claim 3, characterized in that, Training the deep learning model based on the training data includes the following steps: When training the deep learning model, the mean squared error loss is used as the loss function, and the Adam optimizer is used for optimization. The coefficient of determination, root mean square error, mean absolute error, mean absolute percentage error, and Pearson correlation coefficient are calculated to evaluate the training effect.
5. The method for rapid prediction of pork color value according to claim 1, characterized in that, The process of obtaining the raw spectral data of the pork to be tested includes the following steps: The raw spectral data of the pork to be tested are obtained using a spectral acquisition device.
6. A method for rapid prediction of pork color value according to any one of claims 1 to 5, characterized in that, The process of removing baseline drift and linear background interference from the original spectral data and separating overlapping peaks to obtain preprocessed spectral data includes the following steps: The baseline drift and linear background interference of the original spectral data are removed by using Savitzky-GoLay smoothing filter combined with the second derivative algorithm, and overlapping peaks are separated to obtain the preprocessed spectral data.
7. A rapid prediction device for pork color value, characterized in that, The device includes: The spectral acquisition unit is used to acquire the raw spectral data of the pork to be tested. The spectral preprocessing unit is used to remove baseline drift and linear background interference from the original spectral data and separate overlapping peaks to obtain preprocessed spectral data. A chromaticity prediction unit is used to determine the predicted chromaticity value of the pork to be tested based on the preprocessed spectral data using a pre-trained deep learning model; wherein the pre-trained deep learning model is trained from pork spectral data labeled with chromaticity values.
8. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.