Nutrient regulation method and system based on neural network, and medium
Through a neural network-based nutrient control method, using multi-source sensor data and deep recurrent neural networks, the accuracy and real-time problems of nutrient control in quick-frozen food processing were solved, accurate prediction and real-time control of nutrients were achieved, and food quality was improved.
Patent Information
- Application Number
- CN202510767737.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-06-10
AI Technical Summary
Existing quick-frozen food processing technology has problems in nutrient regulation, such as low precision, poor real-time performance, difficulty in handling multivariable coupling, and insufficient data processing and model building, resulting in poor control of nutrient loss.
A neural network-based nutrient regulation method is adopted. Through multi-source sensor data collection and preprocessing, a deep recurrent neural network prediction model is constructed. Combined with the attention mechanism and three-stage transfer learning, dynamic tracking and closed-loop control of nutrients are achieved.
It significantly improves the nutritional retention rate of quick-frozen foods, realizes accurate prediction and real-time regulation of nutritional components, and improves food quality.
Smart Images

Figure CN120673989A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of nutrient component regulation, and in particular to a nutrient component regulation method, system and medium based on a neural network. Background Art
[0002] Quick-frozen food is a food processing technique that involves pre-processing fresh food and then rapidly freezing it at -30°C to -40°C, rapidly reducing the core temperature to below -18°C. Quick-frozen food, due to its convenience and long shelf life, occupies a significant position in the modern food market. In the production process of quick-frozen food, nutrient retention is a key quality indicator. Traditionally, nutrient content control relies primarily on empirically setting process parameters such as quick-freezing temperature, time, and pre-treatment methods, and laboratory testing to verify the nutritional content of the final product. With the development of the food industry, advanced technologies have been applied to nutrient content monitoring, such as near-infrared spectroscopy, which can non-destructively detect moisture, protein, and fat in food; computer vision technology, which can assess food appearance; and temperature and humidity sensor networks, which can monitor processing environment parameters in real time. In terms of control, PID controllers and fuzzy control methods are used to adjust the temperature profile of the quick-freezing process to achieve optimal freezing results.
[0003] However, the existing technology has obvious deficiencies in the regulation of nutrients. First, the traditional process parameter setting is mainly based on experience or simple experimental design, which makes it difficult to capture complex nonlinear relationships, resulting in low precision in the control of nutrient loss. Secondly, although product quality can be verified through laboratory testing, this method has a strong lag and cannot achieve real-time regulation. In addition, although the existing online detection technology can obtain some nutrient data, it lacks a method to effectively integrate this data with the control system, and cannot form a closed-loop control. In addition, existing control algorithms such as PID controllers have difficulty handling multivariable, strongly coupled quick-freezing systems, and have poor adaptability to system disturbances (such as raw material batch changes and equipment fluctuations). The most critical thing is that the existing technology lacks the ability to accurately predict the dynamic process of nutrient changes, and cannot take intervention measures in advance. Problems can only be discovered after the nutrients have been lost, resulting in a low overall nutrient retention rate.
[0004] In addition, existing technologies still face deep-seated challenges in data processing and model building during the quick-frozen food processing process. At the data acquisition level, the collaborative processing of multi-source heterogeneous sensor data is difficult, and the fusion of different types of data has dimensional inconsistency and time synchronization problems; in terms of model construction, the complex and changing processing environment requires the model to have strong feature extraction and time-dependent learning capabilities, and traditional machine learning methods are difficult to meet this demand; in the process of model training and application, the actual production data of food processing companies is limited, the model generalization ability is insufficient, and it is difficult to cope with new situations such as product formula changes and seasonal raw material changes; in the implementation of the control system, how to build a real-time, accurate, and robust control strategy based on the predictive model to achieve closed-loop regulation of nutritional components is a technical problem that needs to be solved urgently. The existence of these problems has seriously restricted the improvement of the level of intelligent manufacturing in the quick-frozen food industry, and innovative solutions are urgently needed. Summary of the Invention
[0005] The present application provides a nutrient component regulation method, system and medium based on a neural network, which are used to achieve dynamic tracking and closed-loop control of nutrients, significantly improving the nutrient retention rate and product quality of quick-frozen foods.
[0006] In a first aspect, the present application provides a method for regulating nutrient content based on a neural network, the method comprising: collecting and preprocessing multi-source sensor data from a quick-frozen food processing process, normalizing and performing sliding window segmentation on a temperature sequence, a humidity sequence, a nutrient content sequence, and an image feature sequence to obtain a structured time series data set; constructing a deep recurrent neural network prediction model based on the structured time series data set, inputting multi-source features into an encoder-decoder architecture neural network, and performing feature fusion through an attention mechanism to obtain a nutrient content prediction model;
[0007] The nutrient component prediction model is subjected to three-stage transfer learning training, including pre-training, domain adaptation and incremental learning. The model parameters are optimized through elastic weight consolidation technology to obtain a trained prediction model; a model predictive control system is constructed based on the trained prediction model, and the optimal control sequence is solved by a sequential quadratic programming algorithm based on the prediction time domain and the control time domain to obtain a nutrient component closed-loop control system.
[0008] In a first embodiment of the first aspect, the multi-source sensor data of the quick-frozen food processing process is collected and preprocessed, and the temperature sequence, humidity sequence, nutrient component sequence, and image feature sequence are normalized and segmented by sliding windows to obtain a structured time series dataset, including:
[0009] Data is collected from the quick-frozen food processing line through a temperature sensor array, humidity sensor, near-infrared spectrometer, and image acquisition equipment to obtain raw multi-source sensor data.
[0010] Performing triple standard deviation constant elimination and time series-based interpolation filling on the original multi-source sensor data to obtain cleaned sensor data;
[0011] Performing minimum and maximum value normalization processing on the cleaned sensor data, mapping each sensor data to an interval between zero and one, and obtaining a temperature sequence, a humidity sequence, a nutrient component sequence, and an image feature sequence comprising multiple sampling moments;
[0012] Performing sliding window segmentation processing on the temperature sequence, humidity sequence, nutrient component sequence, and image feature sequence based on a preset window size and sliding step size to generate a sample sequence including multi-source data input at a historical moment and nutrient component target values at the corresponding moment;
[0013] Adding Gaussian noise, performing data interpolation and time axis perturbation processing on the sample sequence to obtain enhanced training samples;
[0014] The enhanced training samples are organized according to the time dimension to construct a structured time series data set containing multi-dimensional time series data.
[0015] In a second embodiment of the first aspect, a deep recurrent neural network prediction model is constructed based on the structured time series dataset, multi-source features are input into an encoder-decoder architecture neural network, and feature fusion is performed through an attention mechanism to obtain a nutrient component prediction model, including:
[0016] Inputting the temperature sequence in the structured time series data set into a temperature time series feature extraction network having a three-layer bidirectional long short-term memory network to extract features and obtain a temperature dynamic feature vector;
[0017] Inputting the humidity sequence and pressure sequence in the structured time series dataset into an environmental parameter feature extraction network with two layers of gated recurrent units for feature learning to obtain an environmental parameter feature vector;
[0018] Inputting the image feature sequence in the structured time series dataset into an image feature extraction network composed of three convolutional layers, two pooling layers and a long short-term memory network to extract time series features and obtain an image dynamic feature vector;
[0019] performing multi-head attention calculation on the temperature dynamic feature vector, the environmental parameter feature vector, and the image dynamic feature vector based on the query matrix, the key matrix, and the value matrix, and dynamically allocating feature channel weights through a scaled dot product attention mechanism to obtain a fused feature vector;
[0020] Inputting the fused feature vector and the historical nutritional component data in the structured time series dataset into a decoder having a four-layer stacked long short-term memory network for decoding processing, wherein each layer includes a residual connection and layer normalization, to obtain a nutritional component time series prediction output;
[0021] The nutrient component time series prediction output is linearly transformed through a fully connected layer, and the output dimension is equal to the number of predicted nutrient component types to obtain a nutrient component prediction model.
[0022] In a third implementation of the first aspect, inputting the temperature sequence in the structured time series dataset into a temperature time series feature extraction network having a three-layer bidirectional long short-term memory network for feature extraction to obtain a temperature dynamic feature vector includes:
[0023] Splitting the temperature sequence in the structured time series dataset by time dimension, using the temperature data at each sampling moment as an input unit of a bidirectional long short-term memory network to obtain an input sequence;
[0024] Inputting the input sequence into a forward long short-term memory unit and a backward long short-term memory unit respectively, wherein the forward unit processes from the start to the end of the sequence, and the backward unit processes from the end to the start of the sequence, and each unit includes the calculation of an input gate, a forget gate, and an output gate to obtain a forward hidden state sequence and a backward hidden state sequence;
[0025] Performing a concatenation operation on the forward hidden state sequence and the backward hidden state sequence to form an output of a first-layer bidirectional long short-term memory network, wherein the output at each moment contains feature information in both the forward and backward directions, thereby obtaining a first-layer bidirectional feature sequence;
[0026] The first-layer bidirectional feature sequence is passed as input to the second-layer bidirectional long short-term memory network, and the forward and backward processing processes are repeated. The higher-level temporal dependencies are captured by information transfer between hidden units to obtain the second-layer bidirectional feature sequence.
[0027] The second-layer bidirectional feature sequence is input into the third-layer bidirectional long short-term memory network for deep feature extraction. The long-term dependency pattern of temperature change is learned by stacking multiple layers of the network to obtain the third-layer bidirectional feature sequence.
[0028] The last moment output of the third-layer bidirectional feature sequence is subjected to dimension transformation and feature integration, and the forward and backward feature information are fused into a unified feature representation to obtain a temperature dynamic feature vector.
[0029] In a fourth embodiment of the first aspect, the fused feature vector and the historical nutrient data in the structured time series dataset are input into a decoder having a four-layer stacked long short-term memory network for decoding, wherein each layer includes a residual connection and layer normalization, to obtain a nutrient time series prediction output, comprising:
[0030] splicing the fused feature vector and the historical nutrient data in the structured time series dataset to form an initial input sequence for a decoder, thereby obtaining a decoding input vector;
[0031] Inputting the decoded input vector into the first-layer long short-term memory network, processing the sequence information through the gating mechanism of the input gate, the forget gate, and the output gate to obtain the first-layer hidden state sequence;
[0032] Performing a residual connection on the first layer hidden state sequence and the decoded input vector, adding the two together and performing layer normalization processing to retain the original input information and alleviate the gradient vanishing problem, thereby obtaining the first layer normalized output;
[0033] Input the first layer normalized output into the second layer long short-term memory network, repeat the gating calculation process and perform residual connection and layer normalization processing with the first layer normalized output to obtain the second layer normalized output;
[0034] The normalized output of the second layer is passed through the third and fourth layers of long short-term memory networks in sequence. Each layer contains residual connections and layer normalization operations. The complex temporal patterns of nutrients are learned by stacking multiple layers to obtain the normalized output of the final layer.
[0035] Feature extraction is performed on each time step of the normalized output of the final layer, the hidden state is mapped to the prediction space, and a nutrient component prediction sequence for multiple moments in the future is generated to obtain a nutrient component time series prediction output.
[0036] In a fifth embodiment of the first aspect, the nutrient component prediction model is subjected to three-stage transfer learning training, including pre-training, domain adaptation, and incremental learning, and the model parameters are optimized by elastic weight consolidation technology to obtain a trained prediction model, including:
[0037] The nutrient composition prediction model is pre-trained based on a public food industry dataset, an objective function is constructed through a weighted combination of a cross entropy loss function and a mean square error loss function, and a learning rate is adjusted using a cosine annealing strategy to obtain a pre-trained model;
[0038] Performing domain adaptive training on the pre-trained model, freezing the bottom-layer network parameters and only updating the top-layer parameters, using the company's historical production data to train the model, constructing an adversarial training mechanism through a domain discriminator and a gradient reversal layer, extracting domain-invariant features, and obtaining a domain adaptive model;
[0039] Incremental learning training is performed on the domain adaptive model, a fixed-size historical sample buffer is constructed, and new production data is mixed with historical samples for training to prevent the model from forgetting historical knowledge, thereby obtaining an incremental learning model;
[0040] The importance of each parameter in the incremental learning model is calculated based on the Fisher information matrix, and parameter importance constraints are established through elastic weight consolidation technology, in which the update range of important parameters is subject to stronger constraints, thereby obtaining a parameter importance matrix;
[0041] Constructing an elastic weight consolidation loss function based on the parameter importance matrix, combining the new task loss with the parameter importance regularization term, and balancing the retention of new and old knowledge through the regularization coefficient to obtain the optimization objective function;
[0042] The parameters of the incremental learning model are updated based on the optimization objective function, the total loss is minimized through the gradient descent algorithm, and the ability to remember historical production patterns is maintained while learning new knowledge to obtain a trained prediction model.
[0043] In a sixth embodiment of the first aspect, a model predictive control system is constructed based on the trained prediction model, and an optimal control sequence is solved by a sequential quadratic programming algorithm based on the prediction time domain and the control time domain to obtain a closed-loop control system for nutrient components, comprising:
[0044] Constructing a prediction function based on the trained prediction model, taking the current system state and control variables as input, and predicting the nutrient component change trajectory in the future prediction time domain through forward reasoning to obtain a nutrient component prediction sequence;
[0045] Constructing an objective function based on the nutrient component prediction sequence and the nutrient component target value, and weighting the sum of squares of the error and the sum of squares of the control increments by a weighted combination using a weight matrix, wherein the error weight matrix determines the degree of penalty for nutrient component deviation, and the control weight matrix determines the degree of penalty for control action changes, to obtain an optimized objective function;
[0046] Set upper and lower bound constraints on the control variables, set maximum change range constraints on the control increments, set quality standard range constraints on the output variables, combine these constraints to form an inequality constraint set, and obtain a constraint condition set;
[0047] Combining the optimization objective function and the constraint condition set to form a quadratic programming problem, iteratively solving it using a sequential quadratic programming algorithm, linearizing the nonlinear optimization problem and constructing quadratic subproblems in each iteration to obtain an optimal control sequence in the future control time domain;
[0048] Extracting and executing the first control action from the optimal control sequence, applying the control action to the quick-frozen food processing system to adjust the temperature and humidity, and re-optimizing the calculation in the next control cycle to achieve rolling optimization and obtain a real-time control signal;
[0049] Based on the real-time control signal, the processing parameters are closed-loop adjusted, and the control strategy is continuously revised through the feedback mechanism so that the actual nutrient content tracks the target value. A complete closed-loop system including prediction, optimization, execution and feedback is constructed to obtain a nutrient closed-loop control system.
[0050] In a second aspect, the present application provides a nutrient component regulation system based on a neural network, the nutrient component regulation system based on a neural network comprising:
[0051] The acquisition module is used to collect and preprocess multi-source sensor data from the quick-frozen food processing process, normalize and segment the temperature sequence, humidity sequence, nutrient sequence, and image feature sequence using a sliding window to obtain a structured time series dataset;
[0052] An input module is used to build a deep recurrent neural network prediction model based on the structured time series dataset, input multi-source features into the encoder-decoder architecture neural network and perform feature fusion through the attention mechanism to obtain a nutrient component prediction model;
[0053] A training module is used to perform three-stage transfer learning training on the nutrient component prediction model, including pre-training, domain adaptation and incremental learning, and optimize the model parameters through elastic weight consolidation technology to obtain a trained prediction model;
[0054] The solution module is used to construct a model predictive control system based on the trained prediction model, solve the optimal control sequence through a sequential quadratic programming algorithm based on the prediction time domain and the control time domain, and obtain a closed-loop control system for nutrient components.
[0055] In a third aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, which, when executed on a computer, enables the computer to execute the above-mentioned neural network-based nutrient component regulation method.
[0056] In the technical solution provided by this application, multi-source sensor data acquisition and preprocessing technology realizes the all-round monitoring of temperature, humidity, nutritional content and appearance characteristics during the processing of quick-frozen food. Data normalization and sliding window segmentation processing ensure the effective integration of different types of data. The deep recurrent neural network prediction model effectively extracts the temporal dependency of multi-source features through the encoder-decoder architecture. The bidirectional long short-term memory network captures the long-term impact of temperature changes, the gated recurrent unit mines the dynamic characteristics of environmental parameters, the combination of convolutional network and long short-term memory network analyzes the time-varying laws of image features, and the multi-head attention mechanism dynamically adjusts the weights of different feature channels to highlight the factors that have the most significant impact on nutritional content, so that the model has the ability to accurately capture complex nonlinear relationships. The three-stage transfer learning training strategy solves the problems of data scarcity and domain adaptation in deep learning. The pre-training stage uses large-scale public data sets to obtain general feature representation capabilities. The domain adaptation stage extracts domain-invariant features through adversarial training. Incremental learning combined with elastic weight consolidation technology realizes continuous optimization and knowledge accumulation of the model, greatly improving the applicability and generalization ability of the model in actual production environments. The model predictive control system (MPC) seamlessly integrates prediction and optimization to accurately estimate nutrient content trends within the prediction time domain. It uses a sequential quadratic programming algorithm to solve the optimal control sequence, and a rolling optimization strategy ensures real-time and robust control. Overall, this approach uses a neural network algorithm to model and predict the complex, nonlinear mapping relationship between process parameters such as temperature and humidity and nutrient loss during quick-frozen food processing. This overcomes the limitations of traditional methods, which rely on empirical parameter settings and struggle to capture dynamic changes. Notably, the deep recurrent neural network's time series feature extraction capabilities, combined with feature importance learning using an attention mechanism, enable the algorithm to identify key influencing factors and critical time points from massive amounts of multidimensional time series data. This is crucial for applications such as quick-frozen food processing, where significant time dependencies exist. Furthermore, transfer learning and incremental learning strategies address the data scarcity and continuous updating challenges faced by deep learning models in industrial settings. Elastic weight consolidation ensures that the model retains old knowledge while learning new information. These algorithmic features directly enhance the system's stability and adaptability over long-term use. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0058] Figure 1This is a schematic diagram of an embodiment of a method for regulating nutrient components based on a neural network in an embodiment of the present application;
[0059] Figure 2 This is a schematic diagram of an embodiment of a nutrient component regulation system based on a neural network in the embodiments of the present application. DETAILED DESCRIPTION
[0060] The present application embodiment provides a kind of nutrient composition regulation method, system and medium based on neural network. The terms "first", "second", "third", "fourth" etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or precedence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments described here can be implemented in a sequence other than the content illustrated or described here. In addition, the terms "including" or "having" and any deformation thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or equipment comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0061] For ease of understanding, the specific process of the embodiment of the present application is described below. Figure 1 In the embodiments of the present application, an embodiment of the nutrient component regulation method based on a neural network includes:
[0062] Step S101: Collect and preprocess multi-source sensor data from the quick-frozen food processing process, normalize and perform sliding window segmentation on the temperature sequence, humidity sequence, nutrient sequence, and image feature sequence to obtain a structured time series data set;
[0063] Step S102: constructing a deep recurrent neural network prediction model based on the structured time series dataset, inputting multi-source features into an encoder-decoder architecture neural network and performing feature fusion through an attention mechanism to obtain a nutrient component prediction model;
[0064] Step S103: performing three-stage transfer learning training on the nutrient component prediction model, including pre-training, domain adaptation, and incremental learning, optimizing the model parameters through elastic weight consolidation technology to obtain a trained prediction model;
[0065] Step S104: constructing a model predictive control system based on the trained prediction model, solving the optimal control sequence through a sequential quadratic programming algorithm based on the prediction time domain and the control time domain, and obtaining a closed-loop control system for nutrient components.
[0066] It is understandable that the execution subject of the present application can be a nutrient component control system based on a neural network, or a terminal or a server, which is not limited here. The embodiment of the present application is described by taking the server as the execution subject as an example.
[0067] Specifically, on a frozen food processing line, temperature sensor arrays are deployed at key workstations, including the pre-processing, quick-freezing, and packaging areas. Near-infrared spectrometers monitor nutrients such as protein, fat, carbohydrates, and vitamin C in real time. Humidity sensors detect ambient humidity and food surface water activity, and image acquisition equipment captures food appearance characteristics. These sensors form a monitoring network that captures real-time data from the quick-freezing process. The collected raw data is noisy and contains outliers. Anomalous data points are identified and removed using the triple standard deviation criterion, and missing values are filled using time series interpolation. For example, if a temperature sensor measures -45°C at a certain moment, while the previous and subsequent measurements are -32°C and -33°C, respectively, this value significantly deviates from the normal range. After triple standard deviation, it is removed and interpolated using the previous and subsequent data. After data cleaning, the sensor data is normalized to its minimum and maximum values, mapping the values to the range of 0 to 1 to address the dimensional inconsistency of different data types. A sliding window approach was then used, with a set window size and sliding step size, to segment the continuous time series into multiple overlapping segments, each containing historical multi-source data and corresponding nutrient target values. To address the scarcity of training data, data augmentation techniques such as adding Gaussian noise, data interpolation, and timeline perturbations were used to expand the training sample set and improve the model's generalization capabilities.
[0068] A deep recurrent neural network prediction model was constructed, employing an encoder-decoder architecture and consisting of three parallel feature extraction networks. The temperature time series feature extraction network uses a three-layer bidirectional long short-term memory network (LSTM) to simultaneously consider past and future time series information, effectively capturing the impact of temperature changes on nutrients. The environmental parameter feature extraction network utilizes a two-layer gated recurrent unit (GRU) to process environmental data such as humidity and pressure. The gating mechanism selectively retains or discards information, alleviating the vanishing gradient problem in long-sequence training. The image feature extraction network combines a convolutional neural network and a long short-term memory network (LSTM). The convolutional layers extract spatial features, while the LSTM captures temporal changes. These three networks output dynamic feature vectors for temperature, environmental parameters, and image, respectively. A multi-head attention mechanism is then introduced to fuse these features, dynamically assigning weights to different feature channels and enhancing the model's sensitivity to key features. For example, when a specific temperature change has a significant impact on vitamin C content, the attention mechanism assigns a higher weight to the temperature feature. The fused feature vectors and historical nutrient data are fed into the decoder of a four-layer stacked long-short-term memory network. Residual connections and layer normalization are added between each layer to alleviate the training challenges of deep networks. Finally, a fully connected layer outputs the predicted nutrient values.
[0069] The pre-training phase utilizes an open-source food industry dataset containing processing parameters and nutritional data for a variety of frozen foods. A weighted combination of cross-entropy loss and mean squared error loss is constructed as the training objective. A cosine annealing learning rate strategy is used to gradually reduce the learning rate to prevent oscillations during training. The domain adaptation phase freezes the underlying network parameters of the pre-trained model and only updates the top-level parameters. Domain adversarial training is also introduced. By incorporating a domain discriminator into the model, the network is trained to extract domain-invariant features, enabling the model to adapt to a company's specific production environment. The incremental learning phase incorporates an experience replay mechanism that maintains a fixed-size buffer of historical samples. When new production data arrives, new samples are mixed with historical samples for training to prevent the model from forgetting previously learned knowledge. Furthermore, elastic weight consolidation is employed, calculating parameter importance using the Fisher information matrix. This imposes stronger update constraints on important parameters, preserving historical knowledge while learning new information.
[0070] Based on the trained prediction model, a closed-loop control system is designed, defining an objective function encompassing both the prediction and control time domains. This function comprehensively considers the error between the predicted and target nutrient values, as well as the magnitude of the control action. Control variable constraints, control increment constraints, and output constraints are also set to ensure that the system operates within a safe and reasonable range. A sequential quadratic programming algorithm is used to solve this optimization problem. The optimal control sequence is calculated during each control cycle, but only the first control action is executed, with the next cycle reoptimized to achieve rolling optimization control. In this way, the system can automatically adjust processing parameters based on real-time monitoring of nutrient change trends, achieving precise control of nutrient content, significantly reducing nutrient loss in traditional methods, and improving the quality and nutritional value of quick-frozen foods.
[0071] In the embodiments of this application,
[0072] In a specific embodiment, the process of executing step S101 may specifically include the following steps:
[0073] Data is collected from the quick-frozen food processing line through a temperature sensor array, humidity sensor, near-infrared spectrometer, and image acquisition equipment to obtain raw multi-source sensor data.
[0074] Performing triple standard deviation constant elimination and time series-based interpolation filling on the original multi-source sensor data to obtain cleaned sensor data;
[0075] Performing minimum and maximum value normalization processing on the cleaned sensor data, mapping each sensor data to an interval between zero and one, and obtaining a temperature sequence, a humidity sequence, a nutrient component sequence, and an image feature sequence comprising multiple sampling moments;
[0076] Performing sliding window segmentation processing on the temperature sequence, humidity sequence, nutrient component sequence, and image feature sequence based on a preset window size and sliding step size to generate a sample sequence including multi-source data input at a historical moment and nutrient component target values at the corresponding moment;
[0077] Adding Gaussian noise, performing data interpolation and time axis perturbation processing on the sample sequence to obtain enhanced training samples;
[0078] The enhanced training samples are organized according to the time dimension to construct a structured time series data set containing multi-dimensional time series data.
[0079] Specifically, multiple sensors are deployed throughout the quick-frozen food processing line to collect data. A temperature sensor array is a network of individual temperature sensors strategically located at key workstations, such as the pre-processing area, quick-freezing area, and packaging area, collecting ambient temperature and food core temperature data at various locations. Each sensor has a fixed sampling frequency, for example, recording data every 10 seconds. Humidity sensors monitor the relative humidity of the processing environment and the water activity on the food surface, which is crucial for controlling moisture migration during the freezing process. Near-infrared spectrometers measure the absorption and reflection properties of near-infrared light to non-destructively detect the content of nutrients such as protein, fat, carbohydrates, and vitamin C in food. Image acquisition devices capture the appearance and morphological characteristics of food in real time, including color, shape, and texture. All of these devices collect data synchronously, forming a single, timestamp-aligned, raw multi-source sensor data stream. This raw multi-source sensor data is then processed for outlier removal and missing value imputation. The triple standard deviation outlier elimination method, based on statistical principles, first calculates the mean and standard deviation of each sensor data type and then determines the range of normal values. For any sensor data series, the mean and standard deviation are calculated. If a data point's value falls outside the range of the mean plus or minus three standard deviations, it is identified as an outlier and removed. For example, if the mean of temperature sensor data is -30°C and the standard deviation is 1°C, any temperature reading below -33°C or above -27°C is identified as an outlier and removed from the dataset. These outliers are typically caused by sensor failure, electronic interference, or other abnormal factors. For missing data resulting from outlier removal, as well as data points not collected by the sensor itself, a time series-based interpolation method is used. This method considers the temporal nature of the data and interpolates values based on adjacent time points. Common interpolation methods include linear interpolation, spline interpolation, and polynomial interpolation. For example, if valid data is available at time points t1 and t3, but data at t2 is missing, linear interpolation will calculate an estimated value at t2 based on the data values at t1 and t3.
[0080] Minimum-maximum normalization is performed on the cleaned sensor data to address the problem of inconsistent dimensions across different data types. The normalization process subtracts the minimum value of that data type from the original data value and then divides it by the difference between the minimum and maximum values, resulting in a normalized value between 0 and 1. This process maps data of different dimensions, such as temperature (°C), humidity (%), and nutrient content (mg / 100g), to the same scale, facilitating effective neural network learning. After normalization, temperature, humidity, nutrient content, and image feature sequences are generated across multiple sampling points, forming a multi-source dataset aligned in time.
[0081] Sliding window segmentation is performed on various sequences based on a preset window size and sliding step size. Sliding window segmentation is a method for dividing continuous time series data into multiple overlapping segments. The window size w determines the number of time points contained in each segment, and the sliding step size s determines the offset between adjacent windows. For example, if the window size is set to 60 (corresponding to 10 minutes of data, assuming a sampling frequency of every 10 seconds) and the sliding step size is set to 30 (5 minutes), then the first window will contain data from time points 1 to 60, the second window will contain data from time points 31 to 90, and so on. In this way, long time series are decomposed into multiple short sequences, each of which contains multi-source data inputs at historical moments and the target nutrient values at that moment. This processing method enables the neural network to learn temporal context and capture the temporal dependencies of the data. To enhance the generalization and robustness of the model, data augmentation is performed on the above sample sequences. Gaussian noise addition involves superimposing normally distributed random noise on the original data to simulate measurement errors and interference in real-world environments. Data interpolation increases sample density by inserting new data points between the original data points. Time axis perturbation slightly scales the time series to simulate the time scale changes caused by speed changes during processing. These enhancement methods work together to generate richer and more diverse training samples, helping the model learn more robust feature representations. The enhanced training samples are organized according to the time dimension to construct a structured time series dataset containing multidimensional time series data. This dataset is a multidimensional tensor that includes sample sequence dimensions, time dimensions, and feature dimensions. The feature dimensions include multi-source data such as temperature, humidity, nutritional content, and image features. This structured organization facilitates batch training and efficient processing of subsequent neural network models.
[0082] In a specific embodiment, the process of executing step S102 may specifically include the following steps:
[0083] Inputting the temperature sequence in the structured time series data set into a temperature time series feature extraction network having a three-layer bidirectional long short-term memory network to extract features and obtain a temperature dynamic feature vector;
[0084] Inputting the humidity sequence and pressure sequence in the structured time series dataset into an environmental parameter feature extraction network with two layers of gated recurrent units for feature learning to obtain an environmental parameter feature vector;
[0085] Inputting the image feature sequence in the structured time series dataset into an image feature extraction network composed of three convolutional layers, two pooling layers and a long short-term memory network to extract time series features and obtain an image dynamic feature vector;
[0086] performing multi-head attention calculation on the temperature dynamic feature vector, the environmental parameter feature vector, and the image dynamic feature vector based on the query matrix, the key matrix, and the value matrix, and dynamically allocating feature channel weights through a scaled dot product attention mechanism to obtain a fused feature vector;
[0087] Inputting the fused feature vector and the historical nutritional component data in the structured time series dataset into a decoder having a four-layer stacked long short-term memory network for decoding processing, wherein each layer includes a residual connection and layer normalization, to obtain a nutritional component time series prediction output;
[0088] The nutrient component time series prediction output is linearly transformed through a fully connected layer, and the output dimension is equal to the number of predicted nutrient component types to obtain a nutrient component prediction model.
[0089] Specifically, the temperature series from the structured time series dataset is input into a temperature time series feature extraction network consisting of a three-layer bidirectional long short-term memory (LSTM) network. The BLSTM network is a special recurrent neural network architecture that simultaneously considers both forward and backward information in the sequence, capturing long-term dependencies in the time series. In this network, the temperature series is first decomposed into a series of time steps, with the temperature data for each time step flowing simultaneously into the LSTM units in both the forward and backward directions. The LSTM units control the inflow, storage, and output of information through three gating mechanisms: input gate, forget gate, and output gate, effectively alleviating the vanishing gradient problem in traditional recurrent neural networks. The three-layer network architecture enables a more in-depth feature extraction process, extracting features of different levels of temperature variation layer by layer. Ultimately, the forward and backward feature vectors are merged to form a temperature dynamic feature vector, which contains comprehensive information about temperature variations over time. The humidity and pressure series from the structured time series dataset are input into an environmental parameter feature extraction network consisting of two layers of gated recurrent units. The gated recurrent unit (GRU) is a simplified variant of the long short-term memory (LSTM) network. It uses update and reset gates to control information flow, resulting in a simpler structure while retaining long-term memory capabilities. Humidity and pressure data, as environmental parameters, jointly influence moisture migration and texture changes during food processing. Therefore, combining these two parameters can provide a more comprehensive picture of the environment. A two-layer GRU network extracts temporal features of the humidity and pressure data layer by layer, ultimately outputting an environmental parameter feature vector that comprehensively reflects the dynamic characteristics of the processing environment.
[0090] To process image feature sequences, a hybrid architecture combining convolutional neural networks and long short-term memory networks (LSTMs) is employed. Convolutional neural networks are specifically designed for processing spatially structured data, such as images. Feature extraction is performed through three convolutional layers, each using kernels of varying sizes to extract spatial features at different scales. Two pooling layers perform downsampling, reducing the size of the feature map while retaining important features and reducing computational complexity. The feature sequence after convolution and pooling is then input into a long short-term memory network (LSTM), which captures the temporal evolution of image features. The network combines the capabilities of spatial feature extraction and temporal feature learning, ultimately outputting a dynamic feature vector for the image. This vector captures information about how the food's appearance changes during processing. These three feature vectors are fused using a multi-head attention mechanism, which adaptively learns the importance of different features. In the multi-head attention computation, the input features are first mapped into a query matrix, a key matrix, and a value matrix through a linear transformation. The query matrix represents the information of interest, the key matrix is used to calculate similarity scores with the query matrix, and the value matrix contains the actual information content. Attention weights are calculated by computing the dot product of the query matrix and the key matrix, followed by scaling and softmax normalization. These weights are then used to perform a weighted summation of the value matrix to generate the attention output. Multiple attention heads are computed in parallel, and their outputs are concatenated to form the final fused feature vector. This mechanism dynamically assigns weights to different feature channels, giving higher attention to features that are more important for nutrient content prediction.
[0091] The fused feature vector and historical nutrient data are input into a decoder consisting of a four-layer stacked long short-term memory network. Through the multi-layer stacked long short-term memory network structure, the decoder analyzes the information contained in the fused features layer by layer to predict the nutrient content at future moments. The introduction of residual connections between every two layers of the long short-term memory network enables the network to learn new feature representations while retaining the original features, effectively alleviating the vanishing gradient problem in deep network training. Layer normalization stabilizes the deep network training process and accelerates model convergence by performing individual normalization on each sample. The four-layer stacked structure gives the decoder powerful nonlinear expression capabilities, capable of capturing complex feature interactions and temporal dependencies, ultimately outputting a time-series prediction sequence of nutrient content.
[0092] The nutrient composition time series prediction output is linearly transformed using a fully connected layer. This layer maps from feature space to prediction space, with its output dimension equal to the number of nutrients to be predicted. For example, if four nutrients—protein, fat, carbohydrates, and vitamin C—are to be predicted simultaneously, the output dimension of the fully connected layer is 4. This step completes the final prediction transformation, forming a nutrient composition prediction model.
[0093] In a specific embodiment, the process of inputting the temperature sequence in the structured time series dataset into a temperature time series feature extraction network having a three-layer bidirectional long short-term memory network for feature extraction may specifically include the following steps:
[0094] Splitting the temperature sequence in the structured time series dataset by time dimension, using the temperature data at each sampling moment as an input unit of a bidirectional long short-term memory network to obtain an input sequence;
[0095] Inputting the input sequence into a forward long short-term memory unit and a backward long short-term memory unit respectively, wherein the forward unit processes from the start to the end of the sequence, and the backward unit processes from the end to the start of the sequence, and each unit includes the calculation of an input gate, a forget gate, and an output gate to obtain a forward hidden state sequence and a backward hidden state sequence;
[0096] Performing a concatenation operation on the forward hidden state sequence and the backward hidden state sequence to form an output of a first-layer bidirectional long short-term memory network, wherein the output at each moment contains feature information in both the forward and backward directions, thereby obtaining a first-layer bidirectional feature sequence;
[0097] The first-layer bidirectional feature sequence is passed as input to the second-layer bidirectional long short-term memory network, and the forward and backward processing processes are repeated. The higher-level temporal dependencies are captured by information transfer between hidden units to obtain the second-layer bidirectional feature sequence.
[0098] The second-layer bidirectional feature sequence is input into the third-layer bidirectional long short-term memory network for deep feature extraction. The long-term dependency pattern of temperature change is learned by stacking multiple layers of the network to obtain the third-layer bidirectional feature sequence.
[0099] The last moment output of the third-layer bidirectional feature sequence is subjected to dimension transformation and feature integration, and the forward and backward feature information are fused into a unified feature representation to obtain a temperature dynamic feature vector.
[0100] Specifically, the temperature series in a structured time series dataset is split along the time dimension. This step divides the continuous temperature time series into discrete sets of data points based on time points. Consider a temperature series spanning several hours, where each element represents a temperature value at a sampling moment. Time-dimension splitting treats each temperature value in the series as an independent feature input. For example, in the processing of frozen food, temperature sensors collect data every 10 seconds. A one-hour processing cycle generates 360 sampling points, resulting in a 360-time-step input sequence. This split preserves the temporal relationship of the temperature data and provides structured input for the subsequent bidirectional long short-term memory (LSTM) network. The split input sequences are fed into the forward and backward LSTM units, respectively. LSTM units are a special recurrent neural network architecture designed to address the vanishing gradient problem in traditional recurrent neural networks and effectively learn long-term dependencies. In the forward pass, the LSTM unit processes the temperature data sequentially, from the first to the last time point; in the backward pass, the data is processed in reverse order, from the last to the first time point. Each LSTM cell contains three key gating mechanisms: the input gate controls the extent to which new information enters the cell state, the forget gate determines how much old information is discarded, and the output gate controls the extent to which the cell state is output to the hidden state. These three gates work together to enable the network to selectively remember or forget information, making it particularly well-suited for processing time series data. After forward and backward processing, a sequence of forward hidden states and a sequence of backward hidden states are generated, each containing feature information at that moment. These sequences of forward hidden states and backward hidden states are then concatenated. Concatenation combines two vectors into a longer vector along the feature dimension. Specifically, for each time step, the corresponding forward hidden state and backward hidden state are concatenated into a new vector. Through this concatenation, the output of each time step contains both forward information from the beginning of the sequence to the current moment and backward information from the end of the sequence to the current moment, more comprehensively capturing temporal context. This bidirectional processing allows the network to not only use past information to predict the future but also use future information to better understand the past. This is particularly well-suited for processing data such as temperature fluctuations, which exhibit significant patterns across different timescales. The concatenated first-layer bidirectional feature sequence contains the same number of time steps as the original sequence, with the feature dimension of each time step being the sum of the forward and backward dimensions. This first-layer bidirectional feature sequence is passed as input to the second-layer bidirectional long short-term memory network, where the forward and backward processing is repeated. The second-layer network has the same structure as the first layer, but processes higher-level features. This stacked structure enables the network to learn feature representations at different levels of abstraction.The first layer primarily learns local temperature patterns, such as rising or falling trends; the second layer, on the other hand, is capable of capturing temperature variations over longer timeframes, such as temperature fluctuation cycles or temperature transitions between different processes. By transferring information between hidden units, the network is able to establish long-range temporal dependencies and identify temperature patterns that significantly influence changes in nutrient composition. After processing the second layer, the forward and backward hidden states are similarly concatenated to produce a second-layer bidirectional feature sequence. This sequence has the same dimensionality as the first layer, but incorporates higher-level temporal information.
[0101] The second-layer bidirectional feature sequence is then fed into a third-layer bidirectional long-short-term memory network for deeper feature extraction. A key characteristic of deep neural networks is that, as the number of layers increases, the network learns increasingly abstract and complex feature representations. The third-layer bidirectional long-short-term memory network integrates the features extracted by the first two layers to capture deeper patterns in temperature variation, such as the impact of different temperature ranges on different nutrients or the relationship between the rate of temperature change and nutrient retention. This multi-layer stacked structure enables the network to model long-term dependencies of temperature variation and identify important information that may span the entire processing process. The resulting third-layer bidirectional feature sequence contains a high-level, abstract representation of the temperature data. The final output of the third-layer bidirectional feature sequence undergoes dimensionality transformation and feature integration. Specifically, the final time-step output of the third-layer sequence is selected, which contains the accumulated information of the entire sequence. This vector is then mapped to an appropriate feature space using linear transformation or other feature integration methods to form the final temperature dynamic feature vector. This feature vector is a highly condensed representation of the temperature time series data, containing key information about the impact of temperature changes on nutrients and providing important input for subsequent feature fusion and prediction models.
[0102] In a specific embodiment, the process of inputting the fused feature vector and the historical nutritional data in the structured time series dataset into a decoder having a four-layer stacked long short-term memory network for decoding may specifically include the following steps:
[0103] splicing the fused feature vector and the historical nutrient data in the structured time series dataset to form an initial input sequence for a decoder, thereby obtaining a decoding input vector;
[0104] Inputting the decoded input vector into the first-layer long short-term memory network, processing the sequence information through the gating mechanism of the input gate, the forget gate, and the output gate to obtain the first-layer hidden state sequence;
[0105] Performing a residual connection on the first layer hidden state sequence and the decoded input vector, adding the two together and performing layer normalization processing to retain the original input information and alleviate the gradient vanishing problem, thereby obtaining the first layer normalized output;
[0106] Input the first layer normalized output into the second layer long short-term memory network, repeat the gating calculation process and perform residual connection and layer normalization processing with the first layer normalized output to obtain the second layer normalized output;
[0107] The normalized output of the second layer is passed through the third and fourth layers of long short-term memory networks in sequence. Each layer contains residual connections and layer normalization operations. The complex temporal patterns of nutrients are learned by stacking multiple layers to obtain the normalized output of the final layer.
[0108] Feature extraction is performed on each time step of the normalized output of the final layer, the hidden state is mapped to the prediction space, and a nutrient component prediction sequence for multiple moments in the future is generated to obtain a nutrient component time series prediction output.
[0109] Specifically, the fused feature vector generated by the attention mechanism is concatenated with the historical nutrient data from the structured time series dataset. Concatenation combines the two data sets along the feature dimension, while preserving the time dimension. For example, if the fused feature vector has a dimension of 256 and the historical nutrient data has a dimension of 64 (assuming 16 nutrients are monitored, with historical data for each at four time points), the resulting decoder input vector has a dimension of 320. This concatenation ensures that the decoder has both the environmental characteristics of the current batch and historical nutrient trends, providing a comprehensive information foundation for accurately predicting future nutrient content. The decoder input vector is then fed into the first-layer long-short-term memory network for processing. Long-short-term memory networks are a special type of recurrent neural network designed specifically for processing sequential data. At their core, they manage information flow through three gating mechanisms: an input gate controls the rate at which new information enters the cell state, a forget gate controls how much old information is retained, and an output gate controls how much cell state information is passed to the hidden state. Specifically, as the decoded input vector flows through the network, the input gate evaluates the importance of the current input, the forget gate determines how much previously memorized information is discarded, and the output gate controls how much of the memory is output. These three gates output values between 0 and 1 using a sigmoid activation function, controlling the rate of information flow. This fine-grained control enables the LSTM network to maintain state over long sequences, effectively learning patterns in nutrient composition over time. After the first layer of processing, the resulting hidden state sequence is the first layer, which contains the initially extracted temporal features.
[0110] To address the vanishing gradient problem common in deep neural networks and preserve the original input information, a residual connection is performed between the first-layer hidden state sequence and the decoded input vector. Residual connections add the input directly to the output, creating a shortcut that allows gradients to flow directly back to shallow layers of the network. In practice, the first-layer hidden state sequence and the decoded input vector are element-wise added to produce a mixed feature representation. This connection allows the network to not only learn the difference (residual) between input and output but also preserve the original input information, facilitating the training of deep networks. The added result is then subjected to layer normalization. Layer normalization is a technique that normalizes features along the feature dimension. By calculating the mean and variance of each sample, the features are normalized to a distribution with a mean of zero and a variance of one. This process reduces internal covariate shift, stabilizes training, and accelerates network convergence. After residual connections and layer normalization, the normalized output of the first layer is obtained.
[0111] The normalized output of the first layer is fed into the second-layer LSTM network, and a similar gating calculation process is repeated. The second-layer LSTM network further extracts higher-level temporal features, enabling it to capture more complex patterns of nutrient composition changes. After processing, it is again residually connected to the normalized output of the first layer, followed by layer normalization, to produce the normalized output of the second layer. This layered structure enables the network to learn features at different levels of abstraction, from simple short-term changes to complex long-term trends. Furthermore, the residual connections within each layer ensure a smooth flow of information and gradients, effectively alleviating the difficulty of training deep networks. The normalized output of the second layer is then fed into the third and fourth LSTM layers, maintaining the same processing pattern. Each layer extracts features through the LSTM network, performs a residual connection with the output of the previous layer, and then stabilizes training through layer normalization. Through this multi-layered stacking structure, the network gradually builds a complex temporal model of nutrient composition changes, learning patterns of variation at different scales. For example, the first layer might learn the direct short-term impact of temperature on water-soluble vitamins, the second layer might learn the medium-term impact of water migration on nutrient stability, and the third and fourth layers might capture more complex interactions over longer periods of time, such as the combined effects of different process combinations on multiple nutrients. After these four layers of processing, the final layer produces a normalized output that contains rich temporal feature information.
[0112] Feature extraction is performed on each time step of the normalized output of the final layer, mapping the hidden state to the prediction space. This step is typically implemented using a fully connected layer, which converts the high-dimensional hidden state into specific nutrient predictions. The output dimension of the fully connected layer is equal to the number of nutrients to be predicted. For example, if protein, vitamin C, folate, and antioxidant content need to be predicted simultaneously, the output dimension is 4. Through this mapping, the network generates a sequence of nutrient predictions for multiple future moments, forming a nutrient time series prediction output. This prediction not only includes the nutrient content at the next moment but also predicts the changing trends at multiple future moments, providing predictive guidance for real-time control of the processing process.
[0113] In a specific embodiment, the process of executing step S103 may specifically include the following steps:
[0114] The nutrient composition prediction model is pre-trained based on a public food industry dataset, an objective function is constructed through a weighted combination of a cross entropy loss function and a mean square error loss function, and a learning rate is adjusted using a cosine annealing strategy to obtain a pre-trained model;
[0115] Performing domain adaptive training on the pre-trained model, freezing the bottom-layer network parameters and only updating the top-layer parameters, using the company's historical production data to train the model, constructing an adversarial training mechanism through a domain discriminator and a gradient reversal layer, extracting domain-invariant features, and obtaining a domain adaptive model;
[0116] Incremental learning training is performed on the domain adaptive model, a fixed-size historical sample buffer is constructed, and new production data is mixed with historical samples for training to prevent the model from forgetting historical knowledge, thereby obtaining an incremental learning model;
[0117] The importance of each parameter in the incremental learning model is calculated based on the Fisher information matrix, and parameter importance constraints are established through elastic weight consolidation technology, in which the update range of important parameters is subject to stronger constraints, thereby obtaining a parameter importance matrix;
[0118] Constructing an elastic weight consolidation loss function based on the parameter importance matrix, combining the new task loss with the parameter importance regularization term, and balancing the retention of new and old knowledge through the regularization coefficient to obtain the optimization objective function;
[0119] The parameters of the incremental learning model are updated based on the optimization objective function, the total loss is minimized through the gradient descent algorithm, and the ability to remember historical production patterns is maintained while learning new knowledge to obtain a trained prediction model.
[0120] Specifically, the nutrient composition prediction model was initialized and trained using publicly available datasets from the food industry. These datasets typically contain a large amount of data on the processing of various types of quick-frozen foods and the corresponding nutrient composition test results. The data volume is far greater than a single company could collect. The pre-training process uses a weighted combination of the cross-entropy loss function and the mean squared error loss function as the objective function. The cross-entropy loss function is suitable for classification problems, evaluating the difference between the model's predicted nutrient categories and the actual categories; the mean squared error loss function is suitable for regression problems, measuring the deviation between the model's predicted nutrient values and the actual values. The weight coefficients are used to adjust the ratio of the two loss functions to balance the importance of the classification and regression tasks. During training, the learning rate is dynamically adjusted using a cosine annealing strategy, where the learning rate is gradually reduced from an initial value to a minimum value and then increased again, cyclically varying in the form of a cosine function. This strategy helps the model escape local optima, explore more extensively in the parameter space, and ultimately find a more optimal solution. The resulting pre-trained model possesses the ability to represent general features related to nutrient composition changes during food processing. The second stage is domain adaptation training, which aims to adapt the pre-trained model to the specific production environment of a specific company. During this phase, the pre-trained model's bottom-level network parameters are first frozen, allowing only the top-level parameters to be updated. Bottom-level parameters typically extract general features, while top-level parameters are more task-specific. This partial fine-tuning approach preserves general feature extraction capabilities while adapting the model to the target domain. While limited in quantity, historical enterprise production data contains unique production characteristics and product features, making it crucial for targeted model optimization. To address the distributional discrepancy between the source domain (public dataset) and the target domain (enterprise data), a domain adversarial training mechanism is introduced. This mechanism includes a domain discriminator, whose task is to distinguish features from the source or target domain. A gradient reversal layer is added between the feature extractor and the discriminator, reversing the direction of the gradient during backpropagation. Through this adversarial training, the feature extractor is forced to learn domain-invariant feature representations—features that are useful for distinguishing nutrient content variations but are independent of the data source. This training approach enables the model to perform better in the target enterprise environment, even when the training data differs from the actual application environment.
[0121] The third stage is incremental learning training, which aims to enable the model to continuously adapt to new production data and continuously optimize performance. In real-world applications, companies constantly generate new production data, which may reflect new production batches, seasonal raw material changes, or process adjustments. To effectively utilize this data without losing previously learned knowledge, an experience replay mechanism is employed. This mechanism maintains a fixed-size historical sample buffer that stores a representative portion of historical data. When new production data arrives, it is mixed with historical samples for training, ensuring that the model learns new knowledge while not forgetting old knowledge. This approach effectively mitigates the catastrophic forgetting problem common in neural network training, where training on a new task causes a significant drop in model performance on the old task. To further enhance the model's stability and memory capacity, a flexible weight consolidation technique is employed. First, the importance of each parameter in the incremental learning model is calculated based on the Fisher Information Matrix. The Fisher Information Matrix measures the degree to which a parameter affects model performance. Parameter importance is assessed by calculating the second-order derivative of the loss function with respect to the parameter. Changes in important parameters have a significant impact on model performance, while changes in less important parameters, even if significant, will not significantly affect performance. Based on the calculated results, a parameter importance matrix is generated, in which each parameter is assigned a corresponding importance score.
[0122] An elastic weight consolidation loss function is constructed based on the parameter importance matrix. This loss function consists of two parts: the original loss for the new task, which evaluates the model's performance on new data; and a parameter importance regularization term, which penalizes significant changes to important parameters. Specifically, the parameter importance regularization term calculates the difference between the current parameters and the historical optimal parameters and weights them according to their importance. Changes in important parameters are more severely penalized, resulting in tighter constraints. These two loss components are balanced by a regularization coefficient to control the proportion of new and old knowledge retained. This mechanism ensures that while the model learns new knowledge, it does not significantly change parameters that are critical to historical knowledge, thereby maintaining good performance on the learned task. Parameters of the incremental learning model are updated based on the optimization objective function. A gradient descent algorithm or its variants (such as Adam and RMSProp) is used to calculate the gradient of the loss function with respect to each parameter. The parameters are then updated in the direction of the gradient to minimize the total loss. Through iterative training, the model is gradually optimized, performing well on new data while retaining its ability to retain historical data. This training strategy enables the model to adapt to various changes in the company's long-term operations, such as seasonal raw material changes, equipment performance fluctuations, process adjustments, etc., and always maintain accurate nutrient composition prediction capabilities.
[0123] In a specific embodiment, the process of executing step S104 may specifically include the following steps:
[0124] Constructing a prediction function based on the trained prediction model, taking the current system state and control variables as input, and predicting the nutrient component change trajectory in the future prediction time domain through forward reasoning to obtain a nutrient component prediction sequence;
[0125] Constructing an objective function based on the nutrient component prediction sequence and the nutrient component target value, and weighting the sum of squares of the error and the sum of squares of the control increments by a weighted combination using a weight matrix, wherein the error weight matrix determines the degree of penalty for nutrient component deviation, and the control weight matrix determines the degree of penalty for control action changes, to obtain an optimized objective function;
[0126] Set upper and lower bound constraints on the control variables, set maximum change range constraints on the control increments, set quality standard range constraints on the output variables, combine these constraints to form an inequality constraint set, and obtain a constraint condition set;
[0127] Combining the optimization objective function and the constraint condition set to form a quadratic programming problem, iteratively solving it using a sequential quadratic programming algorithm, linearizing the nonlinear optimization problem and constructing quadratic subproblems in each iteration to obtain an optimal control sequence in the future control time domain;
[0128] Extracting and executing the first control action from the optimal control sequence, applying the control action to the quick-frozen food processing system to adjust the temperature and humidity, and re-optimizing the calculation in the next control cycle to achieve rolling optimization and obtain a real-time control signal;
[0129] Based on the real-time control signal, the processing parameters are closed-loop adjusted, and the control strategy is continuously revised through the feedback mechanism so that the actual nutrient content tracks the target value. A complete closed-loop system including prediction, optimization, execution and feedback is constructed to obtain a nutrient closed-loop control system.
[0130] Specifically, a prediction function is constructed based on the trained prediction model. This function receives the current system state and control variables as input. The system state includes parameters such as the current temperature distribution, humidity, and internal food temperature, while the control variables include adjustable process parameters such as the quick-freezing temperature setpoint and conveyor speed. The prediction function calculates the changes in nutrient content over a period of time in the future through forward reasoning. Forward reasoning refers to the process of passing input data from the input layer to each network layer in sequence to ultimately obtain output values. Specifically, the current system state and control variables are first processed by the encoder network to extract feature representations. Then, the decoder network generates nutrient content predictions for multiple future time points. In this way, for each time point within the prediction time domain (e.g., the next 30 minutes), a corresponding nutrient content prediction value is obtained, forming a nutrient content prediction sequence. Based on the nutrient content prediction sequence obtained in the previous step and the pre-set nutrient content target values, the objective function of the model predictive control is constructed. The objective function typically consists of two main components: the sum of squared errors between the predicted output and the target value, which measures control effectiveness; and the sum of squared control increments (i.e., the change in the control variable between two consecutive control cycles), which measures control stability. These two components are weighted together using a weight matrix. The error weight matrix determines the degree of penalty for deviations in different nutrients at different times. For example, predictions closer to the future can be given higher weights, or higher penalty coefficients can be set for more important nutrients (such as easily lost vitamin C). The control weight matrix determines the degree of constraint on changes in control actions, preventing drastic fluctuations in control output, protecting equipment, and ensuring process stability. Through this weighted combination, an optimization objective function is obtained that comprehensively considers control performance and control cost.
[0131] To ensure the safety and effectiveness of the control system under actual operating conditions, constraints must be imposed on the control variables and output variables. Upper and lower bound constraints on the control variables define the adjustable range of process parameters, such as the quick-freezing temperature must not fall below the equipment limit or exceed the safety threshold. Constraints on the maximum amplitude of control increments prevent sudden changes in control actions, such as preventing large temperature adjustments in a short period of time. This helps protect equipment and ensure process stability. Quality standard range constraints on output variables ensure that the predicted nutrient content meets product quality requirements, such as ensuring that the vitamin C retention rate does not fall below a certain standard. These constraints are combined to form a set of inequality constraints, which, together with the optimization objective function, form an optimization problem. Combining the optimization objective function and the set of constraints creates a quadratic programming problem. Quadratic programming is a special type of optimization problem in which the objective function is a quadratic function of the variables and the constraints are linear. In this case, because the objective function consists of the sum of squared errors and the sum of squared control increments, it naturally has a quadratic form. This problem is solved using the sequential quadratic programming algorithm, an iterative optimization method particularly well suited for constrained nonlinear optimization problems. In each iteration, the algorithm first linearizes the nonlinear optimization problem around the current point and then constructs and solves a quadratic subproblem. Specifically, for any nonlinear system dynamics model, the algorithm linearizes the problem using a first-order Taylor expansion, transforming the original problem into an optimization problem with a quadratic objective function and linear constraints. A standard quadratic programming solver is then used to solve this subproblem, yielding the optimal control sequence. This optimal control sequence contains all control variable values from the current moment in the future control time domain (e.g., the next 10 control cycles).
[0132] Based on the rolling optimization principle of model predictive control, only the first control action is extracted from the optimal control sequence and executed. This control action, which includes adjustment instructions for process parameters such as quick-freezing temperature and humidity, is applied to the quick-frozen food processing equipment through the control system. For example, if the optimal control sequence indicates that the quick-freezing zone temperature should be lowered by 2°C, the control system will send the corresponding instructions to the refrigeration equipment. In the next control cycle (e.g., after 30 seconds), the system re-samples the current state and repeats the optimization calculation process to obtain a new optimal control sequence, again executing only the first control action. This rolling optimization strategy can promptly respond to system changes and disturbances, continuously adjusting the control strategy to ensure real-time and robust control. Based on the above mechanism, a closed-loop nutrient content control system is constructed. The core of the closed-loop system lies in the feedback mechanism, which uses online detection equipment such as near-infrared spectrometers to monitor the nutrient content of food in real time, compares the actual measured values with the predicted values and target values, and adjusts the control strategy based on the deviation. The closed-loop system consists of four key steps: prediction—predicting future changes in nutrient content based on the current state; optimization—calculating the optimal control sequence; execution—implementing the first control action; and feedback—monitoring the actual results and updating the system state. These four steps operate in a continuous, closed-loop control process. This mechanism allows the system to adapt to various disturbances, such as raw material changes and equipment fluctuations, ensuring that actual nutrient content consistently tracks target values, enabling precise nutrient regulation.
[0133] The above describes the nutrient composition control method based on neural network in the embodiment of the present application. The following describes the nutrient composition control system based on neural network in the embodiment of the present application. Figure 2 In the embodiments of the present application, an embodiment of a nutrient component regulation system based on a neural network includes:
[0134] The acquisition module 201 is used to collect and preprocess multi-source sensor data from the quick-frozen food processing process, normalize and segment the temperature sequence, humidity sequence, nutrient sequence, and image feature sequence using a sliding window to obtain a structured time series data set;
[0135] Input module 202 is used to build a deep recurrent neural network prediction model based on the structured time series dataset, input multi-source features into the encoder-decoder architecture neural network and perform feature fusion through the attention mechanism to obtain a nutrient component prediction model;
[0136] A training module 203 is configured to perform three-stage transfer learning training on the nutrient component prediction model, including pre-training, domain adaptation, and incremental learning, and optimize the model parameters through elastic weight consolidation technology to obtain a trained prediction model;
[0137] The solution module 204 is used to construct a model predictive control system based on the trained prediction model, and solve the optimal control sequence through a sequential quadratic programming algorithm based on the prediction time domain and the control time domain to obtain a closed-loop control system for nutrient components.
[0138] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions, which, when executed on a computer, cause the computer to execute the steps of the neural network-based nutrient component regulation method.
[0139] If the integrated unit is implemented in the form of 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 the present invention is essentially 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. The computer software product is stored in a storage medium and includes several instructions for enabling a nutrient component control device based on a neural network (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0140] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for regulating nutrient content based on a neural network, characterized in that: The method comprises: Multi-source sensor data from the quick-frozen food processing process is collected and preprocessed. The temperature series, humidity series, nutrient series, and image feature series are normalized and segmented using a sliding window to obtain a structured time series dataset. A deep recurrent neural network prediction model is constructed based on the structured time series dataset, multi-source features are input into the encoder-decoder architecture neural network, and feature fusion is performed through the attention mechanism to obtain a nutrient component prediction model; The nutrient composition prediction model is trained through three-stage transfer learning, including pre-training, domain adaptation, and incremental learning, and the model parameters are optimized through elastic weight consolidation technology to obtain a trained prediction model; A model predictive control system is constructed according to the trained prediction model, and an optimal control sequence is solved by a sequential quadratic programming algorithm based on the prediction time domain and the control time domain to obtain a closed-loop control system for nutrient components.
2. The method for regulating nutrient content based on a neural network according to claim 1, wherein: The multi-source sensor data of the quick-frozen food processing process is collected and preprocessed, and the temperature sequence, humidity sequence, nutrient sequence and image feature sequence are normalized and segmented by sliding windows to obtain a structured time series data set, including: Data is collected from the quick-frozen food processing line through a temperature sensor array, humidity sensor, near-infrared spectrometer, and image acquisition equipment to obtain raw multi-source sensor data. Performing triple standard deviation constant elimination and time series-based interpolation filling on the original multi-source sensor data to obtain cleaned sensor data; Performing minimum and maximum value normalization processing on the cleaned sensor data, mapping each sensor data to an interval between zero and one, and obtaining a temperature sequence, a humidity sequence, a nutrient component sequence, and an image feature sequence comprising multiple sampling moments; Performing sliding window segmentation processing on the temperature sequence, humidity sequence, nutrient component sequence, and image feature sequence based on a preset window size and sliding step size to generate a sample sequence including multi-source data input at a historical moment and nutrient component target values at the corresponding moment; Adding Gaussian noise, performing data interpolation and time axis perturbation processing on the sample sequence to obtain enhanced training samples; The enhanced training samples are organized according to the time dimension to construct a structured time series data set containing multi-dimensional time series data.
3. The method for regulating nutrient content based on a neural network according to claim 1, wherein: The method constructs a deep recurrent neural network prediction model based on the structured time series dataset, inputs multi-source features into the encoder-decoder architecture neural network, and performs feature fusion through the attention mechanism to obtain a nutrient component prediction model, including: Inputting the temperature sequence in the structured time series data set into a temperature time series feature extraction network having a three-layer bidirectional long short-term memory network to extract features and obtain a temperature dynamic feature vector; Inputting the humidity sequence and pressure sequence in the structured time series dataset into an environmental parameter feature extraction network with two layers of gated recurrent units for feature learning to obtain an environmental parameter feature vector; Inputting the image feature sequence in the structured time series dataset into an image feature extraction network composed of three convolutional layers, two pooling layers and a long short-term memory network to extract time series features and obtain an image dynamic feature vector; performing multi-head attention calculation on the temperature dynamic feature vector, the environmental parameter feature vector, and the image dynamic feature vector based on the query matrix, the key matrix, and the value matrix, and dynamically allocating feature channel weights through a scaled dot product attention mechanism to obtain a fused feature vector; Inputting the fused feature vector and the historical nutritional component data in the structured time series dataset into a decoder having a four-layer stacked long short-term memory network for decoding processing, wherein each layer includes a residual connection and layer normalization, to obtain a nutritional component time series prediction output; The nutrient component time series prediction output is linearly transformed through a fully connected layer, and the output dimension is equal to the number of predicted nutrient component types to obtain a nutrient component prediction model.
4. The method for regulating nutrient content based on a neural network according to claim 3, wherein: The temperature sequence in the structured time series data set is input into a temperature time series feature extraction network having a three-layer bidirectional long short-term memory network for feature extraction to obtain a temperature dynamic feature vector, including: Splitting the temperature sequence in the structured time series dataset by time dimension, using the temperature data at each sampling moment as an input unit of a bidirectional long short-term memory network to obtain an input sequence; Inputting the input sequence into a forward long short-term memory unit and a backward long short-term memory unit respectively, wherein the forward unit processes from the start to the end of the sequence, and the backward unit processes from the end to the start of the sequence, and each unit includes the calculation of an input gate, a forget gate, and an output gate to obtain a forward hidden state sequence and a backward hidden state sequence; Performing a concatenation operation on the forward hidden state sequence and the backward hidden state sequence to form an output of a first-layer bidirectional long short-term memory network, wherein the output at each moment contains feature information in both the forward and backward directions, thereby obtaining a first-layer bidirectional feature sequence; The first-layer bidirectional feature sequence is passed as input to the second-layer bidirectional long short-term memory network, and the forward and backward processing processes are repeated. The higher-level temporal dependencies are captured by information transfer between hidden units to obtain the second-layer bidirectional feature sequence. The second-layer bidirectional feature sequence is input into the third-layer bidirectional long short-term memory network for deep feature extraction. The long-term dependency pattern of temperature change is learned by stacking multiple layers of the network to obtain the third-layer bidirectional feature sequence. The last moment output of the third-layer bidirectional feature sequence is subjected to dimension transformation and feature integration, and the forward and backward feature information are fused into a unified feature representation to obtain a temperature dynamic feature vector.
5. The method for regulating nutrient composition based on a neural network according to claim 3, wherein: The fusion feature vector and the historical nutritional data in the structured time series dataset are input into a decoder having a four-layer stacked long short-term memory network for decoding, wherein each layer includes a residual connection and layer normalization, to obtain a nutritional component time series prediction output, including: splicing the fused feature vector and the historical nutrient data in the structured time series dataset to form an initial input sequence for a decoder, thereby obtaining a decoding input vector; Inputting the decoded input vector into the first layer of long short-term memory network, processing the sequence information through the gating mechanism of input gate, forget gate and output gate to obtain the first layer hidden state sequence; Performing a residual connection on the first layer hidden state sequence and the decoded input vector, adding the two together and performing layer normalization processing to retain the original input information and alleviate the gradient vanishing problem, thereby obtaining the first layer normalized output; Input the first layer normalized output into the second layer long short-term memory network, repeat the gating calculation process and perform residual connection and layer normalization processing with the first layer normalized output to obtain the second layer normalized output; The normalized output of the second layer is passed through the third and fourth layers of long short-term memory networks in sequence. Each layer contains residual connections and layer normalization operations. The complex temporal patterns of nutrients are learned by stacking multiple layers to obtain the normalized output of the final layer. Feature extraction is performed on each time step of the normalized output of the final layer, the hidden state is mapped to the prediction space, and a nutrient component prediction sequence for multiple moments in the future is generated to obtain a nutrient component time series prediction output.
6. The method for regulating nutrient content based on a neural network according to claim 1, wherein: The nutrient component prediction model is subjected to three-stage transfer learning training, including pre-training, domain adaptation, and incremental learning, and the model parameters are optimized through elastic weight consolidation technology to obtain a trained prediction model, including: The nutrient composition prediction model is pre-trained based on a public food industry dataset, an objective function is constructed through a weighted combination of a cross entropy loss function and a mean square error loss function, and a learning rate is adjusted using a cosine annealing strategy to obtain a pre-trained model; Performing domain adaptive training on the pre-trained model, freezing the bottom-layer network parameters and only updating the top-layer parameters, using the company's historical production data to train the model, constructing an adversarial training mechanism through a domain discriminator and a gradient reversal layer, extracting domain-invariant features, and obtaining a domain adaptive model; Incremental learning training is performed on the domain adaptive model, a fixed-size historical sample buffer is constructed, and new production data is mixed with historical samples for training to prevent the model from forgetting historical knowledge, thereby obtaining an incremental learning model; The importance of each parameter in the incremental learning model is calculated based on the Fisher information matrix, and parameter importance constraints are established through elastic weight consolidation technology, in which the update range of important parameters is subject to stronger constraints, thereby obtaining a parameter importance matrix; Constructing an elastic weight consolidation loss function based on the parameter importance matrix, combining the new task loss with the parameter importance regularization term, and balancing the retention of new and old knowledge through the regularization coefficient to obtain the optimization objective function; The parameters of the incremental learning model are updated based on the optimization objective function, the total loss is minimized through the gradient descent algorithm, and the ability to remember historical production patterns is maintained while learning new knowledge to obtain a trained prediction model.
7. The method for regulating nutrient content based on a neural network according to claim 1, wherein: The method comprises: constructing a model predictive control system based on the trained prediction model, solving an optimal control sequence by a sequential quadratic programming algorithm based on the prediction time domain and the control time domain, and obtaining a closed-loop control system for nutrient components, including: Constructing a prediction function based on the trained prediction model, taking the current system state and control variables as input, and predicting the nutrient component change trajectory in the future prediction time domain through forward reasoning to obtain a nutrient component prediction sequence; Constructing an objective function based on the nutrient component prediction sequence and the nutrient component target value, and weighting the sum of squares of the error and the sum of squares of the control increments by a weighted combination using a weight matrix, wherein the error weight matrix determines the degree of penalty for nutrient component deviation, and the control weight matrix determines the degree of penalty for control action changes, to obtain an optimized objective function; Set upper and lower bound constraints on the control variables, set maximum change range constraints on the control increments, set quality standard range constraints on the output variables, combine these constraints to form an inequality constraint set, and obtain a constraint condition set; Combining the optimization objective function and the constraint condition set to form a quadratic programming problem, iteratively solving it using a sequential quadratic programming algorithm, linearizing the nonlinear optimization problem and constructing quadratic subproblems in each iteration to obtain an optimal control sequence in the future control time domain; Extracting and executing the first control action from the optimal control sequence, applying the control action to the quick-frozen food processing system to adjust the temperature and humidity, and re-optimizing the calculation in the next control cycle to achieve rolling optimization and obtain a real-time control signal; Based on the real-time control signal, the processing parameters are closed-loop adjusted, and the control strategy is continuously revised through the feedback mechanism so that the actual nutrient content tracks the target value. A complete closed-loop system including prediction, optimization, execution and feedback is constructed to obtain a nutrient closed-loop control system.
8. A nutrient composition control system based on a neural network, characterized in that: For implementing the nutrient component regulation method based on a neural network according to any one of claims 1 to 7, the nutrient component regulation system based on a neural network comprises: The acquisition module is used to collect and preprocess multi-source sensor data from the quick-frozen food processing process, normalize and segment the temperature sequence, humidity sequence, nutrient sequence, and image feature sequence using a sliding window to obtain a structured time series dataset; An input module is used to build a deep recurrent neural network prediction model based on the structured time series dataset, input multi-source features into the encoder-decoder architecture neural network and perform feature fusion through the attention mechanism to obtain a nutrient component prediction model; A training module is used to perform three-stage transfer learning training on the nutrient component prediction model, including pre-training, domain adaptation and incremental learning, and optimize the model parameters through elastic weight consolidation technology to obtain a trained prediction model; The solution module is used to construct a model predictive control system based on the trained prediction model, solve the optimal control sequence through a sequential quadratic programming algorithm based on the prediction time domain and the control time domain, and obtain a closed-loop control system for nutrient components.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the processor is caused to execute the neural network-based nutrient component regulation method according to any one of claims 1 to 7.
Citation Information
Patent Citations
DRNN neural network-based eggplant greenhouse temperature intelligent detection device
CN110109193A
Soil Cd element spectrum qualitative analysis method based on LSTM neural network algorithm
CN113960090A
Food nutritional ingredient content prediction method and system based on cross-modal attention mechanism
CN114529790A
Fan blade dynamic impact detection method and system based on digital twin modeling
CN115859837A
Microelement content prediction method based on ConvBiLSTM-Attention deep neural network
CN117894394A