Egg storage day number prediction method based on near infrared spectrum data and deep learning regression model

By using a multi-scale residual attention spectral regression network, the problem of insufficient model accuracy and robustness in the prediction of egg storage days in existing technologies is solved, and the prediction of egg storage days is made fast, non-destructive and accurate, supporting quality control in breeding, warehousing logistics and sales.

CN122046302APending Publication Date: 2026-05-15HEFEI NALIXUN INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610144718.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-02
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

In existing technologies, methods for predicting egg freshness and storage days based on near-infrared spectroscopy have insufficient ability to characterize complex spectral features with significant high-dimensionality, noise, and nonlinear coupling in engineering applications. They also lack adaptive emphasis and noise suppression capabilities, resulting in insufficient model accuracy and robustness, making it difficult to meet the needs of large-scale, online detection.

Method used

A multi-scale residual attention spectral regression network is adopted, which combines shallow feature extraction, multi-scale residual attention feature extraction, global convergence and regression modules. Spectral data is processed through one-dimensional convolution, batch normalization, nonlinear activation and max pooling, and feature extraction and regression prediction are performed using attention mechanism and residual connection. A mean squared error loss function is constructed for training to achieve fast and lossless prediction of the storage days of eggs.

Benefits of technology

It improves the accuracy and stability of egg storage days prediction, reduces labor and time costs, facilitates quality control in breeding, warehousing, logistics and sales, and provides stable prediction for complex application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122046302A_ABST
    Figure CN122046302A_ABST
Patent Text Reader

Abstract

The invention discloses an egg storage day number detection method based on near infrared spectrum data and a deep learning regression model, and the method comprises the steps: 1) collecting the near infrared spectrum of an egg sample, carrying out the preprocessing, and constructing a spectrum data set and a corresponding real storage day number label; 2) inputting the preprocessed near infrared spectrum into a multi-scale residual attention spectrum regression network, and extracting spectral features related to the egg storage state through shallow feature extraction, multi-scale parallel convolution feature fusion, attention weighting and residual connection processing; 3) globally converging the extracted spectral features and obtaining a prediction result of a normalized space through a regression module; 4, numerical mapping and linear calibration are conducted on the prediction result, and a final storage day number prediction value of the egg sample is obtained.According to the method, on the premise that only simple spectrum preprocessing is adopted, effective characteristics can be automatically learned from the near infrared spectrum, and rapid, lossless and accurate prediction of the egg storage day number is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of near-infrared spectrum analysis and non-destructive detection of agricultural products, and in particular to a method for predicting the storage days of eggs based on near-infrared spectrum data and a deep learning model. BACKGROUND

[0002] The freshness of eggs is an important indicator of their quality and commercial value. During production, storage, transportation and sales, the storage days of eggs from production to detection are often used to quantify and characterize freshness. During storage, water migration, carbon dioxide escape and changes in protein and other components occur, leading to continuous evolution of internal quality, so a fast, non-destructive and scalable method for predicting storage days is needed to support quality control in breeding, warehousing logistics and circulation.

[0003] Traditional detection methods such as HU determination, pH measurement, specific gravity determination, etc. usually require destructive sampling or contact operation, which is tedious and inefficient, and cannot meet the needs of large-scale, online detection.

[0004] Near-infrared spectroscopy can quickly obtain information about the internal chemical bonds of samples, and has the advantages of non-destructive and fast. In the prior art, some methods combine near-infrared spectroscopy with partial least squares regression, support vector regression, etc. for freshness grading or storage day modeling, but still have the following shortcomings: (1) The ability to characterize complex spectral features with high dimensionality, noise and significant non-linear coupling is insufficient, and the prediction performance is easily affected by sample differences and environmental disturbances; (2) There is a lack of parallel feature extraction mechanism for different scale spectral patterns, and there is a lack of adaptive emphasis and noise suppression ability for key band intervals and key feature channels, so redundant bands and noise information are easily introduced, which limits the model accuracy and robustness, and makes it difficult to meet the engineering application requirements. SUMMARY

[0005] The present application aims to overcome the shortcomings of existing methods for evaluating the freshness / storage days of eggs based on near-infrared spectroscopy in engineering applications, and provides a method for predicting the storage days of eggs based on near-infrared spectroscopy data and a deep learning regression model, so that it can automatically learn the feature information related to the internal quality evolution of eggs from the near-infrared absorption spectrum under the premise of only using simple spectral preprocessing, thereby achieving fast, non-destructive and accurate prediction of the storage days of eggs.

[0006] To achieve the above-mentioned application purposes, the present application adopts the following technical solutions: The method for predicting the storage days of eggs based on near-infrared spectroscopy data and a deep learning regression model according to the present application is characterized in that it is performed according to the following steps: Step 1: Collect near-infrared spectra of egg samples using a near-infrared spectrometer and preprocess them to obtain a preprocessed near-infrared spectral dataset, denoted as . ,in, Indicates the first spectral vectors of individual egg samples, Let be the number of effective bands; let the . The actual storage days label for each egg sample is: , The total number of egg samples; Step 2: Establish a multi-scale residual attention spectral regression network, including: a shallow feature extraction module, a multi-scale residual attention feature extraction module, a global convergence module, and a regression module, and then... Feature extraction and regression prediction are performed to obtain the first... Final predicted storage days for each egg sample ; Step 3: Based on the actual storage days label and the final predicted storage days, construct the mean squared error loss function to train the multi-scale residual attention spectral regression network, thereby obtaining a regression model for predicting the storage days of eggs, which is used to predict the storage days of eggs based on the near-infrared spectral data of the input egg samples.

[0007] The method for predicting the storage days of eggs based on near-infrared spectral data and a deep learning regression model described in this invention is characterized in that step 2 is performed as follows: Step 2.1, The input is processed sequentially through a one-dimensional convolutional layer, a batch normalization layer, a non-linear activation layer, and a max pooling layer to obtain the first... Shallow spectral characteristics of an egg sample ; Step 2.2: The multi-scale residual attention feature extraction module extracts features from the data. Execute sequentially Level feature extraction processing, to obtain Level spectral characteristics ;in, Indicates the first The first egg sample Level spectral characteristics; Step 2.3: The global convergence module performs [the following] along the spectral length dimension. Perform global aggregation processing to obtain the first... Global spectral feature vector of an egg sample ; Step 2.4, Regression module Perform regression prediction processing and output the first... Intermediate regression predicted values ​​for a sample of eggs ; Step 2.5, according to mean with standard deviation Using equation (1), we obtain the first... Predicted storage days per egg sample : (1) Step 2.6, using equation (2) to... Perform linear calibration to obtain the first... Final predicted storage days for each egg sample : (2) In equation (2), and There are two calibration parameters.

[0008] Furthermore, step 2.2 is performed as follows: Step 2.2.1, when At that time, As the first Level spectral characteristics ; Step 2.2.2, adopt One-dimensional convolution operations with different kernel sizes affect the... Level spectral characteristics Perform multi-scale parallel convolution processing to obtain the first... The parallel convolution feature set corresponding to level ; right Perform fusion processing to obtain the first The first egg sample Level fusion spectral characteristics ; right Channel attention and spatial attention weighting are performed separately to generate the corresponding first... The first egg sample Level channel attention weight Spatial attention weights Thus, the first The first egg sample Level weighted spectral characteristics ;in, It is element-wise multiplication; Will and Perform residual connections and process them with a nonlinear activation function to obtain the first... Level spectral characteristics ; Step 2.2.3, will Assign to Then, return to step 2.2.2 and execute sequentially until... Until then, thus obtaining Level spectral characteristics { }

[0009] The present invention provides an electronic device, including a memory and a processor, characterized in that the memory is used to store a program that supports the processor in executing the egg storage days prediction method, and the processor is configured to execute the program stored in the memory.

[0010] The present invention discloses a computer-readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, performs the steps of the egg storage days prediction method.

[0011] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention enables regression prediction of the number of days eggs are stored based on near-infrared spectral data. It can quickly and non-destructively assess the number of days eggs are stored, reducing labor and time costs and facilitating its application in quality control during breeding, warehousing, logistics and sales.

[0012] 2. This invention constructs a multi-scale residual attention spectral regression network for spectral feature learning: it extracts spectral features at different scales through multi-scale convolution, and combines the attention mechanism to adaptively enhance key spectral information. At the same time, it utilizes residual connections to promote feature transfer and fusion, thereby improving the model's adaptability and prediction stability to sample differences and noise disturbances, enhancing the robustness of engineering applications, and providing support for stable prediction in complex application scenarios. Attached Figure Description

[0013] Figure 1 This is a structural diagram of the present invention; Figure 2 This is a structural diagram of the shallow feature extraction module of the present invention; Figure 3 This is a structural diagram of the multi-scale residual attention feature extraction module of the present invention; Figure 4 This is a structural diagram of the attention module in the convolutional block. Detailed Implementation

[0014] In this embodiment, a regression prediction method for the number of days of egg storage based on near-infrared spectral data and a deep learning model is described in the following structure: Figure 1 As shown, it includes the following steps: Step 1: Collect near-infrared spectra of egg samples using a near-infrared spectrometer and preprocess them to obtain a preprocessed near-infrared spectral dataset, denoted as . ,in, Indicates the first spectral vectors of individual egg samples, Let be the number of effective bands; let the . The actual storage days label for each egg sample is: , The total number of egg samples is represented. In this embodiment, a self-built near-infrared spectral dataset of eggs is used, which contains near-infrared spectral data of eggs stored from day 1 to day 25. The dataset is randomly divided into a training set and a test set, with the training set accounting for 70% and the test set accounting for 30%. Standard normal variable transformation preprocessing is performed on the divided training set and test set respectively.

[0015] Step 2: Establish a multi-scale residual attention spectral regression network, including: a shallow feature extraction module, a multi-scale residual attention feature extraction module, a global convergence module, and a regression module, and then... Feature extraction and regression prediction are performed to obtain the first... Final predicted storage days for each egg sample ; Step 2.1, as follows Figure 2 As shown, The input is processed sequentially through a one-dimensional convolutional layer, a batch normalization layer, a non-linear activation layer, and a max pooling layer to obtain the first... Shallow spectral feature tensor of an egg sample In this embodiment, the parameters of the shallow feature extraction module can be instantiated as follows: the one-dimensional convolutional layer has 1 input channel, 32 output channels, a kernel size of 7, a stride of 2, and padding of 3; and batch normalization layers and ReLU activation layers are set; the max pooling layer has a kernel size of 2 and a stride of 2. This setting can compress the sequence length while preserving the main spectral structure, reducing the subsequent computational load.

[0016] Step 2.2, as follows Figure 3 and Figure 4 As shown, the multi-scale residual attention feature extraction module is cascaded in multiple stages, and... Execute sequentially Level feature extraction processing, to obtain Level spectral characteristics ;in, Indicates the first The first egg sample Level spectral features; in this embodiment, feature extraction is achieved by cascading six multi-scale residual attention feature extraction blocks.

[0017] Step 2.2.1, when At that time, As the first Level spectral characteristics To facilitate iteration, The first time The shallow spectral features correspond to the initial input features of this module. In this embodiment, the shallow spectral features obtained in step 2.1 can be used as input features. As the initial input for the iteration, and based on this, the first iteration is completed. Level 1 feature extraction; from an implementation perspective, it can be equivalently understood as completing an initialization before entering step 2.2.2, so that the Level 1 processing can use the features of the previous level as input for calculation.

[0018] Step 2.2.2, adopt One-dimensional convolution operations with different kernel sizes affect the spectral features of the upper layer. Perform multi-scale parallel convolution processing to obtain the first... The parallel convolution feature set corresponding to level ; The parallel convolution feature sets are fused to obtain the first... The first egg sample Level fusion spectral characteristics ; right Channel attention and spatial attention weighting are performed separately to generate the corresponding first... The first egg sample Level channel attention weight Spatial attention weights Thus, the first The first egg sample Level weighted spectral characteristics ;in, It is element-wise multiplication.

[0019] Will Spectral features as input at this level Perform residual connections and process them with a nonlinear activation function to obtain the first... Level output spectral characteristics ; In this embodiment, the number of branches in multi-scale parallel convolution... It can be instantiated as 3, with convolution kernel sizes of 3, 5, and 7, respectively, to extract spectral local patterns at different scales; after the output of each branch, the channels are concatenated, and then fused by 1×1 convolution to obtain fused spectral features. Attention weighting is achieved through channel attention and spectral position (sequence) attention in CBAM: channel attention obtains channel descriptions through average pooling and max pooling, and outputs channel attention weights after passing through a multilayer perceptron and a sigmoid function; spatial attention outputs spatial attention weights by averaging and max pooling the channel dimensions, concatenating the results, and then passing through convolution and a sigmoid function. Residual connections are used to element-wise add the attention-enhanced features to the current-level input features, and then... Get the first Level output characteristics When the number of input or output channels or the stride are inconsistent, dimension matching can be achieved through 1×1 convolutional projection to ensure that element-wise addition is feasible, thereby improving gradient propagation and stabilizing deep training.

[0020] Step 2.2.3, will Assign to Then, return to step 2.2.2 and execute sequentially until... Until then, thus obtaining Level spectral characteristics { This step describes the step-by-step implementation: the output after each level is completed. Then, it is used as the input for the next stage, and multi-scale parallel convolution, attention weighting, and residual connections are repeatedly performed until the first stage is completed. Level feature extraction is performed to obtain a multi-level spectral feature set.

[0021] Step 2.3: The global convergence module performs convergence along the spectral dimension. Perform global aggregation processing to obtain the first... Global spectral feature vector of an egg sample In this embodiment, global aggregation can be achieved using adaptive average pooling, that is, the spectral dimension is aggregated into features of length 1, thereby compressing inputs of different lengths into a fixed-dimensional vector, which is convenient for subsequent regression module processing.

[0022] Step 2.4, Regression module Perform regression prediction processing and output the first... Intermediate regression predicted values ​​for a sample of eggs In this embodiment, the regression module can be implemented using a multi-layer fully connected structure to map the global spectral feature vector to a single regression output. , to characterize the prediction results under the standardized label space.

[0023] Step 2.5, according to mean with standard deviation Using equation (1), we obtain the first... Predicted storage days per egg sample : (1) In this embodiment, and It can be obtained from the labels of the training set (or a subset of the training set used for optimization), and is used to measure the network output. De-standardization to the actual storage days scale facilitates direct reading and use in engineering applications.

[0024] Step 2.6, using equation (2) to... Perform linear calibration to obtain the first... Final predicted storage days for each egg sample : (2) In equation (2), and There are two calibration parameters; in this embodiment, a calibration subset can be divided from the training data to fit the calibration parameters. and To reduce systematic bias and improve the fitted results Set a reasonable range to avoid abnormal calibration affecting output stability.

[0025] Step 3: Based on the actual storage days label and the final predicted storage days, construct the mean squared error loss function to train the multi-scale residual attention spectral regression network, thereby obtaining a regression model for predicting the storage days of eggs, which is used to predict the storage days of eggs based on the near-infrared spectral data of the input egg samples.

[0026] In this embodiment, the mean squared error loss function is used as the objective function during training, and the network parameters are updated through backpropagation. The training strategy may include: dividing the dataset into an independent final test set, with the remainder used as the training set, and performing cross-validation to evaluate the stability of the model under different partitions.

[0027] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the above-described method, and the processor is configured to execute the program stored in the memory.

[0028] In this embodiment, a computer-readable storage medium stores a computer program, which is executed by a processor to perform the steps of the above method.

Claims

1. A method for predicting the storage days of eggs based on near-infrared spectral data and a deep learning regression model, characterized in that, The procedure is as follows: Step 1: Collect near-infrared spectra of egg samples using a near-infrared spectrometer and preprocess them to obtain a preprocessed near-infrared spectral dataset, denoted as . ,in, Indicates the first spectral vectors of individual egg samples, Let be the number of effective bands; let the . The actual storage days label for each egg sample is: , The total number of egg samples; Step 2: Establish a multi-scale residual attention spectral regression network, including: a shallow feature extraction module, a multi-scale residual attention feature extraction module, a global convergence module, and a regression module, and then... Feature extraction and regression prediction are performed to obtain the first... Final predicted storage days for each egg sample ; Step 3: Based on the actual storage days label and the final predicted storage days, construct the mean squared error loss function to train the multi-scale residual attention spectral regression network, thereby obtaining a regression model for predicting the storage days of eggs, which is used to predict the storage days of eggs based on the near-infrared spectral data of the input egg samples.

2. The method for predicting the storage days of eggs based on near-infrared spectral data and a deep learning regression model according to claim 1, characterized in that, Step 2 is performed as follows: Step 2.1, The input is processed sequentially through a one-dimensional convolutional layer, a batch normalization layer, a non-linear activation layer, and a max pooling layer to obtain the first... Shallow spectral characteristics of an egg sample ; Step 2.2: The multi-scale residual attention feature extraction module extracts features from the data. Execute sequentially Level feature extraction processing, to obtain Level spectral characteristics ;in, Indicates the first The first egg sample Level spectral characteristics; Step 2.3: The global convergence module performs [the following] along the spectral length dimension. Perform global aggregation processing to obtain the first... Global spectral feature vector of an egg sample ; Step 2.4, Regression module Perform regression prediction processing and output the first... Intermediate regression predicted values ​​for a sample of eggs ; Step 2.5, according to mean with standard deviation Using equation (1), we obtain the first... Predicted storage days per egg sample : (1) Step 2.6, using equation (2) to... Perform linear calibration to obtain the first... Final predicted storage days for each egg sample : (2) In equation (2), and There are two calibration parameters.

3. The method for predicting the storage days of eggs based on near-infrared spectral data and a deep learning regression model according to claim 2, characterized in that, Step 2.2 is performed as follows: Step 2.2.1, when At that time, As the first Level spectral characteristics ; Step 2.2.2, adopt One-dimensional convolution operations with different kernel sizes affect the... Level spectral characteristics Perform multi-scale parallel convolution processing to obtain the first... The parallel convolution feature set corresponding to level ; right Perform fusion processing to obtain the first The first egg sample Level fusion spectral characteristics ; right Channel attention and spatial attention weighting are performed separately to generate the corresponding first... The first egg sample Level channel attention weight Spatial attention weights Thus, the first The first egg sample Level weighted spectral characteristics ;in, It is element-wise multiplication; Will and Perform residual connections and process them with a nonlinear activation function to obtain the first... Level spectral characteristics ; Step 2.2.3, will Assign to Then, return to step 2.2.2 and execute sequentially until... Until then, thus obtaining Level spectral characteristics { } 4. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing the egg storage days prediction method according to any one of claims 1-3, and the processor is configured to execute the program stored in the memory.

5. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is run by the processor, it performs the steps of the egg storage days prediction method according to any one of claims 1-3.