A method, device, equipment and storage medium for nondestructively predicting water loss rate of meat
By using an adaptive spectral-Transformer model, utilizing a hyperspectral imaging system and an adaptive spectral gating layer, combined with a Transformer encoder and a gating residual fusion strategy, non-destructive, real-time, and high-precision detection of pork water loss rate was achieved, solving the problems of destructiveness and low efficiency of traditional detection methods.
Patent Information
- Application Number
- CN202610285355.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-10
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2046-03-10
AI Technical Summary
Existing technologies for detecting water loss in pork suffer from problems such as highly destructive detection methods, low efficiency, and insufficient model generalization ability, making it difficult to achieve non-destructive, real-time, and high-precision prediction.
An adaptive spectral-Transformer (AS-Trans) model is adopted to acquire spectral data through a hyperspectral imaging system. Key bands are automatically identified using an adaptive spectral gating layer, global features are captured by a Transformer encoder, and prediction is performed through a gating residual fusion strategy to establish a high-precision non-destructive testing scheme.
It achieves non-destructive, real-time, and high-precision monitoring of pork water loss rate, solving the problems of destructiveness and low efficiency of traditional detection methods, and improving the model's generalization ability and prediction accuracy.
Smart Images

Figure CN122196963B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of deep learning technology, and in particular to a non-destructive method, apparatus, equipment and storage medium for predicting the water loss rate of meat. Background Technology
[0002] Water loss rate (WHC) refers to the percentage of water lost by pork under external pressure relative to its original weight. It is a core indicator for measuring water holding capacity (WHC); a higher WHC indicates lower water holding capacity. Water holding capacity is one of the core indicators for evaluating meat quality, directly affecting the processing yield, tenderness, and consumer acceptance of meat products. Pork with low water holding capacity experiences significant water loss during processing, leading to economic losses and quality degradation. Summary of the Invention
[0003] The main objective of this application is to provide a non-destructive method, apparatus, equipment, and storage medium for predicting meat dehydration rate, so as to improve the accuracy and efficiency of meat dehydration rate prediction.
[0004] To achieve the above objectives, one aspect of this application proposes a non-destructive method for predicting the water loss rate of meat, the method comprising the following steps: Obtain the spectral data of the pork sample; Calculate the true water loss rate of the pork sample; Using the sample spectral data as training samples and the actual water loss rate as training labels, a water loss rate prediction model is trained to obtain the trained water loss rate prediction model. The spectral data of the pork to be tested are input into the trained water loss rate prediction model, and the trained water loss rate prediction model is used to output the predicted water loss rate of the pork to be tested.
[0005] In some embodiments, the step of inputting the spectral data of the pork to be tested into the trained water loss rate prediction model, and using the trained water loss rate prediction model to output the predicted water loss rate of the pork to be tested, includes the following steps: The first learnable gating parameter in the adaptive spectral gating layer is multiplied element-wise with the input spectral data to be measured, and L1 regularization is used to identify characteristic bands related to the hydrodynamics of the system. The feature bands are mapped to the embedding space using a Transformer encoder, and each feature band mapping is used as a token. A two-layer Transformer encoder is used to extract global context features related to the hydraulic system from each token. The fusion ratio of the global context features is adaptively adjusted by a second learnable gating parameter using a gated residual fusion strategy, and the global context features are fused to obtain fused features; The fused features are processed by the GELU activation function of the regression head and the fully connected network of Dropout to obtain the predicted water loss rate.
[0006] In some embodiments, the water loss rate prediction model is trained using the following configuration: AdamW was used as the optimizer. Set the learning rate to 0.0003; The hyperparameter Batch Size is set to 12, and the maximum number of training cycles is set to 200. Define a composite loss function that includes an L1 regularization term; If the validation set loss does not decrease within 30 epochs, training will be stopped early. Setting max_norm=1.0 for gradient clipping prevents gradient explosion during deep network training.
[0007] In some embodiments, obtaining the sample spectral data of the pork sample includes the following steps: The spectral data of the pork sample were obtained using a hyperspectral imaging system.
[0008] In some embodiments, acquiring the sample spectral data from the pork sample using a hyperspectral imaging system includes the following steps: The sample pork was sampled using a hyperspectral imaging system with a wavelength range of 400-1000 nm; sampling was performed every 2 nm, and a total of 300 spectral features were generated for each sample pork.
[0009] In some embodiments, calculating the true water loss rate of the sample pork includes the following steps: Subsamples were collected from several locations within the pork sample. Each of the sub-samples is weighed once, pressure is applied, and then weighed again in sequence to obtain the weight of each sub-sample before and after applying pressure. For each of the subsamples, calculate: Water loss rate = (W_before - W_after) / W_before; where W_before is the weight before pressure is applied, and W_after is the weight after pressure is applied; The average water loss rate of each of the sub-samples is calculated as the true water loss rate of the pork sample.
[0010] To achieve the above objective, a non-destructive prediction device for meat water loss rate is proposed in another aspect of the embodiments of this application, wherein the device includes: The spectral acquisition unit is used to acquire the spectral data of the pork sample. A water loss rate calculation unit is used to calculate the true water loss rate of the sample pork. The model training unit is used to train the water loss rate prediction model using the sample spectral data as training samples and the actual water loss rate as training labels, so as to obtain the trained water loss rate prediction model. The water loss rate prediction unit is used to input the spectral data of the pork to be tested into the trained water loss rate prediction model, and use the trained water loss rate prediction model to output the predicted water loss rate of the pork to be tested.
[0011] 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.
[0012] 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.
[0013] 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.
[0014] The embodiments of this application include at least the following beneficial effects: This application provides a non-destructive method, apparatus, equipment, and storage medium for predicting the water loss rate of meat. The solution involves acquiring sample spectral data of pork; calculating the true water loss rate of the pork sample; training a water loss rate prediction model using the sample spectral data as training samples and the true water loss rate as training labels; inputting the spectral data of the pork to be tested into the trained water loss rate prediction model; and outputting the predicted water loss rate of the pork to be tested using the trained water loss rate prediction model. This application achieves a high-precision, automated, logically clear, and completely non-destructive real-time monitoring solution for pork water loss rate through the water loss rate prediction model. Attached Figure Description
[0015] 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.
[0016] Figure 1 A flowchart illustrating a non-destructive method for predicting meat water loss rate provided in an embodiment of this application; Figure 2 An example flowchart of a non-destructive prediction method for meat water loss rate provided in this application embodiment; Figure 3 This is a structural example diagram of the AS-Trans model provided in the embodiments of this application; Figure 4 This is a band weight distribution diagram of the adaptive spectral gating layer provided in the embodiments of this application; Figure 5 A bar chart comparing the prediction accuracy of the AS-Trans model provided in the embodiments of this application with that of a traditional model; Figure 6 This is a schematic diagram of the structure of a non-destructive prediction device for meat water loss rate provided in an embodiment of this application; Figure 7 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0017] 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.
[0018] 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.
[0019] 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: Existing detection technologies mainly include: Traditional destructive testing methods employ the pressure gravimetric method (NY / T 821-2004 standard), using a meat hydration analyzer (such as RH1000) to apply 35 kg of pressure for 5 minutes, calculating the water loss rate by measuring the weight difference before and after pressure. While this method is considered the industry gold standard, it suffers from fatal flaws such as a long testing cycle (each sample requires more than 5 minutes to test), sample damage (meat cannot be further processed or sold after testing), and the inability to achieve online monitoring.
[0020] Spectroscopic detection technologies: Near-infrared spectroscopy (NIRS) and hyperspectral imaging (HSI) have been widely used in the field of non-destructive testing of meat products in recent years. Hyperspectral imaging can simultaneously acquire spatial and spectral information of samples, showing great potential in the detection of indicators such as meat freshness, tenderness, and color.
[0021] Existing machine learning methods: Currently, meat quality prediction based on hyperspectral imaging mainly employs traditional machine learning algorithms such as Partial Least Squares Regression (PLSR), Support Vector Machine (SVM), and Random Forest (RF), or simple Convolutional Neural Networks (CNN). These methods have the following limitations: Spectral feature selection relies on human experience and lacks adaptability; It is difficult to capture long-range dependencies between spectral bands; The model has insufficient generalization ability and is difficult to transfer between different batches of samples; The lack of interpretability makes it impossible to clearly identify the key bands that contribute the most to the prediction.
[0022] Related research: The paper "Research on the Detection of Water-Binding Capacity of Pork Based on Near-Infrared Spectroscopy" proposes a new method for detecting the water-binding capacity of vacuum-packed pork using near-infrared diffuse reflectance spectroscopy. The water-binding capacity of pork was calibrated using conventional drip loss and pressure methods. A quantitative detection model was established using partial least squares (PLS). The total sample size in this experiment was 106, and the samples were divided into a calibration set and a test set. The correlation coefficients between the surface calibration values and the predicted values from the near-infrared diffuse reflectance spectroscopy method were 0.73–0.79.
[0023] Disadvantages of existing technology: Currently, the detection of water loss rate in pork mainly relies on traditional physicochemical analysis methods and early spectroscopic analysis models, which have the following significant drawbacks: The testing method is destructive: traditional water-holding tests (such as the pressure method) rely on the meat water-holding tester (RH1000) to physically compress the sample. This method will permanently damage the physical structure of the sample, and the tested meat sample cannot be sold as fresh meat, resulting in resource waste and making it impossible to achieve full-scale testing on the production line.
[0024] The traditional method is inefficient and time-consuming, involving multiple steps such as sampling, weighing, pressurizing, re-weighing, and manual calculation. Multiple samples (e.g., three) need to be taken for each piece of meat to calculate the average value to ensure accuracy. The process is cumbersome and time-consuming, and cannot meet the real-time, rapid, and automated sorting requirements of modern slaughtering and processing lines.
[0025] Limitations of traditional modeling algorithms: Feature redundancy interference: Hyperspectral data contains hundreds of bands, which contain a large amount of background noise and redundant information that is unrelated to the hydrodynamics of the system. Traditional models (such as PLS) often have difficulty automatically removing these interferences, leading to model overfitting or limited prediction accuracy.
[0026] Long-range dependency missing: Fluctuations in different bands of the spectral curve often exhibit complex nonlinear relationships. Traditional models focus on local feature extraction, making it difficult to capture global long-range dependencies between spectral bands.
[0027] To address the shortcomings of the existing technologies, this application aims to provide a hyperspectral detection scheme based on the AS-Trans (Adaptive Spectroscopic Transformer) model, specifically solving the following core problems: Achieve completely non-destructive high-frequency detection: Utilize the non-contact characteristics of hyperspectral imaging to obtain internal biochemical information without damaging the meat structure.
[0028] Establish a precise prediction logic driven by "loss rate": Based on the physical logic that "the greater the weight loss after pressurization, the worse the water-holding capacity", the model output value directly predicts the ratio of (weight before pressurization - weight after pressurization) / weight before pressurization, thus establishing a precise correspondence between the value and the meat quality grade.
[0029] Overcoming the challenges of "curse of dimensionality" and "feature selection" in hyperspectral data: Adaptive band selection: By inventing an "adaptive spectral gating layer," which utilizes learnable weights and L1 regularization penalties, key bands sensitive to moisture loss are automatically identified and enhanced, implicitly completing feature extraction without manual intervention.
[0030] Global dependency modeling: The Transformer architecture is introduced, and a multi-head self-attention mechanism is used to capture feature correlations across the entire spectrum, which significantly improves the model's fitting accuracy for the water loss rate of complex meat samples.
[0031] Balancing original features with deep abstract features: addressing the problem that deep learning models easily lose original spectral physical information when extracting features.
[0032] This application employs a "Gated Residual Fusion" layer to adaptively adjust the ratio of original projected features to Transformer encoded features, ensuring that the prediction results possess both the nonlinear expressiveness of deep learning and the physical robustness of spectral data. Through these improvements, this application provides a high-precision, automated, logically clear, and completely non-destructive real-time monitoring method for pork water loss in meat processing.
[0033] This application provides a method, apparatus, device, and storage medium for non-destructive prediction of meat dehydration rate, relating to the field of deep learning technology. The method, apparatus, device, and storage medium 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 non-destructive prediction method for meat dehydration rate, etc., but is not limited to the above forms.
[0034] 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.
[0035] Reference Figure 1 This application provides a non-destructive method for predicting the water loss rate of meat. This method may include, but is not limited to, steps S100 to S130, as detailed below: S100: Obtain the sample spectral data of the pork sample; S110: Calculate the true water loss rate of the sample pork; S120: Using the sample spectral data as training samples and the actual water loss rate as training labels, train the water loss rate prediction model to obtain the trained water loss rate prediction model. S130: Input the spectral data of the pork to be tested into the trained water loss rate prediction model, and use the trained water loss rate prediction model to output the predicted water loss rate of the pork to be tested.
[0036] Optionally, the step of inputting the spectral data of the pork to be tested into the trained water loss rate prediction model, and using the trained water loss rate prediction model to output the predicted water loss rate of the pork to be tested, includes the following steps: The first learnable gating parameter in the adaptive spectral gating layer is multiplied element-wise with the input spectral data to be measured, and L1 regularization is used to identify characteristic bands related to the hydrodynamics of the system. The feature bands are mapped to the embedding space using a Transformer encoder, and each feature band mapping is used as a token. A two-layer Transformer encoder is used to extract global context features related to the hydraulic system from each token. The fusion ratio of the global context features is adaptively adjusted by a second learnable gating parameter using a gated residual fusion strategy, and the global context features are fused to obtain fused features; The fused features are processed by the GELU activation function of the regression head and the fully connected network of Dropout to obtain the predicted water loss rate.
[0037] Optionally, the water loss rate prediction model is trained using the following configuration: AdamW was used as the optimizer. Set the learning rate to 0.0003; The hyperparameter Batch Size is set to 12, and the maximum number of training cycles is set to 200. Define a composite loss function that includes an L1 regularization term; If the validation set loss does not decrease within 30 epochs, training will be stopped early. Setting max_norm=1.0 for gradient clipping prevents gradient explosion during deep network training.
[0038] Optionally, obtaining the sample spectral data of the pork sample includes the following steps: The spectral data of the pork sample were obtained using a hyperspectral imaging system.
[0039] Optionally, acquiring the sample spectral data from the pork sample using a hyperspectral imaging system includes the following steps: The sample pork was sampled using a hyperspectral imaging system with a wavelength range of 400-1000 nm; sampling was performed every 2 nm, and a total of 300 spectral features were generated for each sample pork.
[0040] Optionally, calculating the true water loss rate of the sample pork includes the following steps: Subsamples were collected from several locations within the pork sample. Each of the sub-samples is weighed once, pressure is applied, and then weighed again in sequence to obtain the weight of each sub-sample before and after applying pressure. For each of the subsamples, calculate: Water loss rate = (W_before - W_after) / W_before; where W_before is the weight before pressure is applied, and W_after is the weight after pressure is applied; The average water loss rate of each of the sub-samples is calculated as the true water loss rate of the pork sample.
[0041] Reference Figure 2 The following sections will provide a detailed description and explanation of some optional embodiments of this application, using specific application examples.
[0042] The core logic of this application lies in establishing a mapping relationship between hyperspectral data and physical water loss rate indicators. Addressing the characteristic that "the higher the water loss rate, the worse the hydraulic stability," the true value determination strictly follows these procedures: Sample preparation: A total of 1400 pork samples were collected to ensure the model has sufficient generalization ability when handling different meat quality characteristics. Water loss rate (true value) determination method: Instrument used: A meat hydraulic analyzer (model: RH1000) was used for measurement. Measurement method: The pressure method was used. Three different locations were randomly selected from each meat sample for sample cutting and measurement. Data recording: The weight of each sample before pressure treatment (W_before) and after pressure treatment (W_after) were accurately recorded. Calculation formula and physical meaning: Calculation formula: Water loss rate = (W_before - W_after) / W_before. Averaging: The loss rate measured from three samples taken from the same meat sample was averaged to obtain the final true hydraulic stability index for that meat sample. Explanation of the indicator: This formula actually measures the water loss rate of meat products. The higher the value, the more water the meat loses under pressure, and the worse its water-holding capacity (ability to retain moisture).
[0043] Spectral data acquisition: The Fig Spec® FS1X series hyperspectral imaging system was used, with a wavelength range of 400-1000nm (covering the visible to near-infrared region). Sampling was performed every 2nm, and a total of 300 spectral features (reflectance data) were generated for each sample.
[0044] The technical architecture of this embodiment includes: Reference Figure 3 The proposed solution employs a self-designed AS-Trans (Adaptive Spectral Transformer) model. This model achieves accurate prediction of water loss rate by capturing global spectral dependencies and incorporating an adaptive gating mechanism.
[0045] A. Adaptive Spectral Gating Layer Function: This is the first gate of the model, used to achieve implicit feature band selection. Principle: A set of learnable gate parameters (gate_weights) is defined and multiplied element-wise with the input hyperspectral features. Optimization: L1 regularization is introduced during training to penalize inactive weights, forcing the model to automatically identify and amplify feature bands sensitive to moisture (hydrothermal activity) while suppressing redundant noise bands.
[0046] For example, Figure 4 This is a diagram showing the band weight distribution of the adaptive spectral gating layer. Figure 4 The key feature bands automatically identified by the model in the 400-1000nm wavelength range are displayed in the form of heat maps or bar charts, demonstrating the model's ability to extract moisture-sensitive features.
[0047] B. Transformer Encoder: Maps the gated spectral features to a high-dimensional embedding space, treating each band as a token. Global Feature Extraction: Employs a 2-layer Transformer encoder. Utilizing its multi-head attention mechanism, the model can capture the nonlinear correlations between distant bands in the spectral curve, thereby extracting global contextual features related to the hydraulic depth of the system.
[0048] C. Gated Residual Fusion Strategy: The model adaptively adjusts the feature fusion ratio through a learnable gating parameter (Residual Gate). Technical Advantages: This design ensures that the prediction results retain the physical stability of the original spectrum while also possessing the deep abstract representation capabilities extracted by the Transformer.
[0049] D. Regression Output Regression Head Design: The fused features pass through a fully connected network containing the GELU activation function and Dropout (0.3). Output Result: The model directly outputs a continuous numerical value representing the predicted water loss rate of the pork sample.
[0050] Model training and optimization strategies include: To ensure the robustness of the model, the following training configuration was used in this embodiment: Training algorithm and parameters: Optimizer: The AdamW optimizer is used to improve generalization ability by decoupling weight decay.
[0051] Learning rate: set to 0.0003 to ensure the training stability of the Transformer structure.
[0052] Hyperparameters: Batch Size is set to 12, and the maximum number of training epochs is 200.
[0053] Composite Loss Function: This embodiment defines a composite loss function that includes an L1 regularization term. Technical Principle: By applying an L1 penalty to the gating weights, the model is forced to learn sparse band features, thereby automatically selecting key bands during training.
[0054] Training protection mechanisms: Early Stopping: Setting Patience=30, if the validation set loss does not decrease within 30 epochs, the training stops early to prevent overfitting. Gradient clipping: Setting max_norm=1.0 for gradient clipping prevents gradient explosion during deep network training.
[0055] Predicting water loss rate using the trained model: After completing the development and training of the AS-Trans model, the following steps are used to achieve rapid and non-destructive prediction of the water loss rate of pork samples: Load model parameters: The system automatically calls the trained and saved AS-Trans optimal weight file (.pth or .h5 format) to initialize the model architecture.
[0056] Input test data: Load the normalized hyperspectral reflectance data of the test sample.
[0057] Model inference: The model automatically weights key bands through an adaptive spectral gating layer, captures global features using a Transformer encoder, and finally outputs the prediction results by combining a gating residual fusion mechanism.
[0058] Output results: The system directly outputs the predicted water loss rate of pork, realizing real-time online monitoring of the water-binding capacity of pork.
[0059] To verify the predictive performance and stability of the AS-Trans model in this embodiment in practical applications, this embodiment uses a large-scale sample set for 5-Fold Cross-Validation.
[0060] Experimental design and data preparation: Sample size: A total of 1,400 samples of pig longissimus dorsi muscle were collected and prepared.
[0061] True value acquisition: The true water loss rate of each sample was determined by pressurization using a meat series hydraulic analyzer (RH1000).
[0062] Spectral acquisition: Reflectance spectral data in the range of 400-1000 nm were acquired using the Fig Spec® FS1X hyperspectral imaging system.
[0063] Validation method: 1400 samples were randomly divided into 5 groups. Each time, 4 groups (1120 samples) were selected as the training set for loading the model for learning, and the remaining 1 group (280 samples) was used as the test set for accuracy validation. This process was repeated 5 times to ensure the generalizability of the results.
[0064] Figure 5 This is a bar chart comparing the prediction accuracy of the AS-Trans model in this embodiment with that of a traditional model. By comparing the correlation coefficient, root mean square error, and mean absolute error, the technical advantages of this embodiment in terms of accuracy and robustness are highlighted.
[0065] Cross-validation results analysis: Through comprehensive validation of 1400 samples, the AS-Trans model performed excellently in predicting water loss rate. The average correlation coefficient between the model prediction and the actual value was 0.92, the root mean square error was 3.12%, and the average absolute error was 2.33%.
[0066] Table 1: Precision Statistics of Five-Fold Cross-Validation
[0067] Table 2: Prediction Results for Representative Samples
[0068] The experimental results based on a large sample size of 1400 show that: High fit: The correlation coefficient between the predicted value output by the model in this embodiment and the physically measured water loss rate reached 0.92, which can reflect the hydraulic condition of pork extremely accurately.
[0069] Strong generalization ability: With a sample size of 1,400 samples covering meat samples and spectral data collected under different environments, the low error of cross-validation proves the model's generalization potential in actual slaughtering and processing lines.
[0070] Adaptive Advantage: The adaptive spectral gating layer successfully identified the key features most sensitive to moisture loss from 300 original bands, avoiding subjective errors caused by manually selecting bands.
[0071] Beneficial effects: This embodiment achieves the following breakthrough results in the field of non-destructive testing of pork quality using the self-developed AS-Trans model: Completely non-destructive and full-volume testing: This completely changes the physical damage to meat samples caused by the traditional "pressure method," allowing all tested meat products to still be sold as fresh meat and supporting full-volume quality inspection on the production line.
[0072] Automatic feature recognition capability: Through the "adaptive spectral gating layer", the model can automatically identify moisture-sensitive features without manual pre-selection of bands, effectively solving the "curse of dimensionality" problem of hyperspectral data.
[0073] Extremely high prediction accuracy and generalization: By introducing the global dependency modeling capability of Transformer, the limitations of traditional linear models in handling complex nonlinear relationships are overcome, and prediction errors are significantly reduced.
[0074] Balancing physical and deep features: By using the "gated residual fusion" technique, we ensure that the model does not lose the original physical robustness of the spectrum while extracting features using deep learning, making the prediction logic clearer and more reliable.
[0075] Model interpretability: This embodiment makes the model's decision-making basis transparent through a gating weight distribution chart and a Top 10 contribution bar chart. This interpretability allows the test results to provide clear guidance for subsequent process adjustments by meat processing enterprises.
[0076] Reference Figure 6 This application also provides a non-destructive prediction device for meat dehydration rate, which can realize the above-mentioned non-destructive prediction method for meat dehydration rate. The device includes: The spectral acquisition unit is used to acquire the spectral data of the pork sample. A water loss rate calculation unit is used to calculate the true water loss rate of the sample pork. The model training unit is used to train the water loss rate prediction model using the sample spectral data as training samples and the actual water loss rate as training labels, so as to obtain the trained water loss rate prediction model. The water loss rate prediction unit is used to input the spectral data of the pork to be tested into the trained water loss rate prediction model, and use the trained water loss rate prediction model to output the predicted water loss rate of the pork to be tested.
[0077] 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.
[0078] 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.
[0079] 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.
[0080] Figure 7 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.
[0081] 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.
[0082] 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.
[0083] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0084] 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.
[0085] 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.
[0086] 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.
[0087] 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.
[0088] 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.
[0089] 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.
[0090] 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.
[0091] 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.
[0092] 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.
[0093] 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.
[0094] 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.
[0095] 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 non-destructive method for predicting the water loss rate of meat, characterized in that, The method includes the following steps: Obtain the spectral data of the pork sample; Calculate the true water loss rate of the pork sample; Using the sample spectral data as training samples and the actual water loss rate as training labels, a water loss rate prediction model is trained to obtain the trained water loss rate prediction model. The spectral data of the pork to be tested is input into the trained water loss rate prediction model, and the trained water loss rate prediction model is used to output the predicted water loss rate of the pork to be tested; wherein, the trained water loss rate prediction model achieves the prediction of water loss rate by capturing the global dependence of the spectrum and combining it with an adaptive gating mechanism. The process of inputting the spectral data of the pork to be tested into the trained water loss rate prediction model, and using the trained water loss rate prediction model to output the predicted water loss rate of the pork to be tested, includes the following steps: The first learnable gating parameter in the adaptive spectral gating layer is multiplied element-wise with the input spectral data to be measured, and L1 regularization is used to identify characteristic bands related to the hydrodynamics of the system; the characteristic bands are then projected to obtain the original projected features. The feature bands are mapped to the embedding space using a Transformer encoder, and each feature band mapping is used as a token. A two-layer Transformer encoder is used to extract global context features related to the hydraulic system from each token. The fusion ratio of the original projection features and the global context features is adaptively adjusted by a second learnable gating parameter using a gated residual fusion strategy, and the original projection features and the global context features are fused to obtain fused features; The fused features are processed by the GELU activation function of the regression head and the fully connected network of Dropout to obtain the predicted water loss rate; The process of obtaining the sample spectral data of the pork sample includes the following steps: The sample pork was subjected to spectral data using a hyperspectral imaging system. The process of acquiring spectral data of the pork sample using a hyperspectral imaging system includes the following steps: The sample pork was sampled using a hyperspectral imaging system with a wavelength range of 400-1000 nm; sampling was performed every 2 nm, and a total of 300 spectral features were generated for each sample pork.
2. The non-destructive prediction method for meat water loss rate according to claim 1, characterized in that, The water loss rate prediction model is trained using the following configuration: AdamW was used as the optimizer. Set the learning rate to 0.0003; The hyperparameter Batch Size is set to 12, and the maximum number of training cycles is set to 200. Define a composite loss function that includes an L1 regularization term; If the validation set loss does not decrease within 30 epochs, training will be stopped early. Setting max_norm=1.0 for gradient clipping prevents gradient explosion during deep network training.
3. The non-destructive prediction method for meat water loss rate according to claim 1, characterized in that, The calculation of the true water loss rate of the sample pork includes the following steps: Subsamples were collected from several locations within the pork sample. Each of the sub-samples is weighed once, pressure is applied, and then weighed again in sequence to obtain the weight of each sub-sample before and after applying pressure. For each of the subsamples, calculate: Water loss rate = (W_before - W_after) / W_before; where W_before is the weight before pressure is applied, and W_after is the weight after pressure is applied; The average water loss rate of each of the sub-samples is calculated as the true water loss rate of the pork sample.
4. A non-destructive prediction device for meat dehydration rate, characterized in that, The device is used to implement the non-destructive prediction method for meat water loss rate as described in claim 1, and the device includes: The spectral acquisition unit is used to acquire the spectral data of the pork sample. A water loss rate calculation unit is used to calculate the true water loss rate of the sample pork. The model training unit is used to train the water loss rate prediction model using the sample spectral data as training samples and the actual water loss rate as training labels, so as to obtain the trained water loss rate prediction model. The water loss rate prediction unit is used to input the spectral data of the pork to be tested into the trained water loss rate prediction model, and to output the predicted water loss rate of the pork to be tested using the trained water loss rate prediction model.
5. 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 3.
6. 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 3.
7. 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 3.
