Nutrient composition regulation method and system based on neural network and medium
By using neural network-based multi-source data processing and three-stage transfer learning, a closed-loop regulation system for the nutritional components of quick-frozen foods was constructed, which solved the problems of low precision and lag in the regulation of nutritional components in existing technologies and achieved efficient retention of nutritional components.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XINXIANG BEIER FRESH FOOD CO LTD
- Filing Date
- 2025-06-10
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies for regulating nutritional components in frozen food processing suffer from low precision, strong lag, lack of closed-loop control, poor multivariate coupling processing capabilities, and insufficient data processing and model building, resulting in low nutrient retention rates.
A nutrient component regulation method based on neural networks is adopted. Through multi-source sensor data acquisition and preprocessing, a deep recurrent neural network prediction model is constructed. Combined with attention mechanism and three-stage transfer learning training, a closed-loop regulation system for nutrients is constructed.
It enables dynamic tracking and closed-loop control of the nutritional components of frozen foods, improves nutrient retention and product quality, and enhances the model's applicability and generalization ability in actual production environments.
Smart Images

Figure CN120673989B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of nutrient component regulation technology, and in particular to a method, system and medium for nutrient component regulation based on neural networks. Background Technology
[0002] Quick-frozen foods are a food processing technology that involves pre-treating fresh food and then rapidly freezing it at -30℃ to -40℃, quickly lowering the core temperature of the food to below -18℃. Due to their convenience, speed, and long shelf life, quick-frozen foods occupy an important position in the modern food market. In the production of quick-frozen foods, the preservation of nutritional components is one of the key indicators for measuring product quality. Traditionally, nutritional component control mainly relies on experience to set process parameters, such as quick-freezing temperature, time, and pre-treatment methods, and then verifies the nutritional content of the final product through laboratory testing. With the development of the food industry, some advanced technologies have been applied to nutritional component monitoring. For example, near-infrared spectroscopy can non-destructively detect components such as moisture, protein, and fat in food; computer vision technology can assess the appearance characteristics of food; and temperature and humidity sensor networks can monitor processing environment parameters in real time. In terms of control, methods such as PID controllers and fuzzy control are used to adjust the temperature curve of the quick-freezing process to achieve better freezing results.
[0003] However, existing technologies have significant shortcomings in nutrient composition control. First, traditional process parameter settings are mainly based on experience or simple experimental design, making it difficult to capture complex nonlinear relationships, resulting in low precision in controlling nutrient loss. Second, although product quality can be verified through laboratory testing, this method is highly lagging and cannot achieve real-time control. Furthermore, while existing online detection technologies can acquire some nutrient data, they lack methods for effectively integrating this data with the control system, failing to form closed-loop control. In addition, existing control algorithms, such as PID controllers, struggle to handle multi-variable, strongly coupled quick-freezing systems and have poor adaptability to system disturbances (such as changes in raw material batches and equipment fluctuations). Most importantly, existing technologies lack the ability to accurately predict the dynamic process of nutrient composition changes, making it impossible to take early intervention measures. Problems are only detected after nutrient loss has occurred, resulting in a low overall nutrient retention rate.
[0004] Furthermore, existing technologies face profound challenges in data processing and model building during the frozen food processing process. At the data acquisition level, collaborative processing of multi-source heterogeneous sensor data is difficult, and the fusion of different data types suffers from inconsistencies in dimensions and temporal synchronization. Regarding model building, the complex and ever-changing processing environment demands models with strong feature extraction and temporal dependency learning capabilities, which traditional machine learning methods struggle to meet. During model training and application, food processing companies have limited actual production data, resulting in insufficient model generalization ability and difficulty in handling new situations such as product formula changes and seasonal raw material variations. In terms of control system implementation, how to build real-time, accurate, and robust control strategies based on predictive models to achieve closed-loop regulation of nutritional components is a pressing technical challenge. These problems severely restrict the improvement of intelligent manufacturing levels in the frozen food industry, necessitating innovative solutions. Summary of the Invention
[0005] This application provides a method, system, and medium for regulating nutrients based on neural networks, which can achieve dynamic tracking and closed-loop control of nutrients, significantly improving the nutrient retention rate and product quality of frozen foods.
[0006] In a first aspect, this application provides a method for regulating nutritional components based on neural networks. The method includes: collecting and preprocessing multi-source sensor data from the frozen food processing process; normalizing and segmenting temperature, humidity, nutritional component, and image feature sequences using a sliding window to obtain a structured time-series dataset; constructing a deep recurrent neural network prediction model based on the structured time-series dataset; inputting multi-source features into an encoder-decoder neural network and fusing features through an attention mechanism to obtain a nutritional component prediction model.
[0007] The nutrient composition prediction model is trained through a three-stage transfer learning process, including pre-training, domain adaptation, and incremental learning. The model parameters are optimized using elastic weight consolidation techniques to obtain the trained prediction model. A model prediction control system is constructed based on the trained prediction model. The optimal control sequence is solved using a sequence quadratic programming algorithm based on the prediction time domain and the control time domain to obtain the closed-loop regulation system for nutrient composition.
[0008] In a first embodiment of the first aspect, the multi-source sensor data acquisition and preprocessing of the frozen food processing process involves normalizing and segmenting the temperature sequence, humidity sequence, nutritional component sequence, and image feature sequence using a sliding window to obtain a structured time-series dataset, including:
[0009] Data is collected from the quick-frozen food processing production line using temperature sensor arrays, humidity sensors, near-infrared spectrometers, and image acquisition equipment to obtain raw multi-source sensor data.
[0010] The original multi-source sensor data is subjected to three-fold standard difference constant removal and time series-based interpolation imputation to obtain cleaned sensor data;
[0011] The cleaned sensor data is subjected to minimum-maximum standardization processing, mapping each sensor data to a range of zero to one, to obtain temperature sequence, humidity sequence, nutrient component sequence and image feature sequence containing multiple sampling times;
[0012] Based on a preset window size and sliding step, the temperature sequence, humidity sequence, nutrient component sequence and image feature sequence are segmented by sliding window to generate a sample sequence containing multi-source data input at historical time and target values of nutrient components at corresponding time.
[0013] Gaussian noise was added to the sample sequence, data interpolation was performed, and time axis perturbation was applied to obtain the enhanced training samples.
[0014] The enhanced training samples are organized according to the time dimension to construct a structured time series dataset containing multidimensional time series data.
[0015] In the second embodiment of the first aspect, the step of constructing a deep recurrent neural network prediction model based on the structured time-series dataset, which involves inputting multi-source features into an encoder-decoder neural network and fusing features through an attention mechanism to obtain a nutrient composition prediction model, includes:
[0016] The temperature sequences in the structured time-series dataset are input into a temperature time-series feature extraction network with a three-layer bidirectional long short-term memory network to extract features and obtain a dynamic temperature feature vector.
[0017] The humidity and pressure sequences in the structured time-series dataset are input into an environmental parameter feature extraction network with two layers of gated recurrent units for feature learning to obtain environmental parameter feature vectors.
[0018] The image feature sequences in the structured time-series dataset are input into an image feature extraction network consisting of three convolutional layers, two pooling layers, and a long short-term memory network to extract time-series features and obtain dynamic image feature vectors.
[0019] Multi-head attention calculation is performed on the temperature dynamic feature vector, environmental parameter feature vector and image dynamic feature vector based on the query matrix, key matrix and value matrix. The feature channel weights are dynamically allocated through the scaling dot product attention mechanism to obtain the fused feature vector.
[0020] The fused feature vector and the historical nutrient data in the structured time series dataset are input into a decoder with a four-layer stacked long short-term memory network for decoding, wherein each layer contains residual connections and layer normalization, to obtain the nutrient time series prediction output.
[0021] The time-series prediction output of the nutrients is linearly transformed through a fully connected layer, and the output dimension is equal to the number of predicted nutrient types, thus obtaining the nutrient prediction model.
[0022] In the third embodiment of the first aspect, the step of inputting the temperature sequence in the structured time-series dataset into a temperature time-series feature extraction network with a three-layer bidirectional long short-term memory network for feature extraction to obtain a temperature dynamic feature vector includes:
[0023] The temperature sequence in the structured time-series dataset is split into time dimensions, and the temperature data at each sampling time is used as the input unit of a bidirectional long short-term memory network to obtain the input sequence;
[0024] The input sequence is input into the forward long short-term memory unit and the backward long short-term memory unit respectively. The forward unit processes the sequence from the beginning to the end, and the backward unit processes the sequence from the end to the beginning. Each unit includes the calculation of the input gate, the forget gate and the output gate to obtain the forward hidden state sequence and the backward hidden state sequence.
[0025] The forward hidden state sequence and the backward hidden state sequence are concatenated to form the output of the first layer bidirectional long short-term memory network, wherein the output at each time step contains feature information in both the forward and backward directions, thus obtaining the 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. The forward and backward processing processes are repeated. By passing information between hidden units, higher-level temporal dependencies are captured 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. By stacking multiple networks, the long-term dependency pattern of temperature change is learned, and the third layer bidirectional feature sequence is obtained.
[0028] The last time step output of the third-layer bidirectional feature sequence is subjected to dimensional transformation and feature integration, and the forward and backward feature information is fused into a unified feature representation to obtain the temperature dynamic feature vector.
[0029] In the fourth embodiment of the first aspect, the step of inputting the fused feature vector and the historical nutrient data in the structured time-series dataset into a decoder with a four-layer stacked long short-term memory network for decoding processing, wherein each layer includes residual connections and layer normalization, to obtain the nutrient time-series prediction output, includes:
[0030] The fused feature vector and the historical nutrient composition data in the structured time series dataset are concatenated to form the initial input sequence of the decoder, thus obtaining the decoding input vector;
[0031] The decoded input vector is input into the first layer of the long short-term memory network, and the sequence information is processed through the gating mechanism of the input gate, forget gate and output gate to obtain the first layer of hidden state sequence;
[0032] The first layer hidden state sequence and the decoded input vector are residually concatenated, and the two are added together and then processed by layer normalization to retain the original input information and alleviate the gradient vanishing problem, thus obtaining the first layer normalized output.
[0033] The first layer normalized output is input into the second layer long short-term memory network, the gating calculation process is repeated, and residual connection and layer normalization processing are performed 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 the long short-term memory network in sequence. Each layer contains residual connections and layer normalization operations. By stacking multiple layers, the complex temporal patterns of nutrients are learned to obtain the final layer normalized output.
[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 future time steps is generated to obtain the nutrient component time-series prediction output.
[0036] In the fifth embodiment of the first aspect, the three-stage transfer learning training of the nutrient composition prediction model includes pre-training, domain adaptation, and incremental learning, and the model parameters are optimized using elastic weight consolidation technology to obtain the trained prediction model, including:
[0037] The nutritional component prediction model was pre-trained based on publicly available datasets from the food industry. The objective function was constructed by a weighted combination of the cross-entropy loss function and the mean squared error loss function. The learning rate was adjusted using a cosine annealing strategy to obtain the pre-trained model.
[0038] The pre-trained model is subjected to domain adaptive training. The parameters of the bottom layer network are frozen and only the parameters of the top layer are updated. The model is trained using the enterprise's historical production data. An adversarial training mechanism is constructed through a domain discriminator and a gradient inversion layer to extract domain-invariant features and obtain 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, thus obtaining an incremental learning model.
[0040] The importance of each parameter in the incremental learning model is calculated based on the Fisher information matrix. The parameter importance constraint is established through the elastic weight consolidation technique, in which the update magnitude of important parameters is subject to stronger constraints, and the parameter importance matrix is obtained.
[0041] Based on the parameter importance matrix, an elastic weight consolidation loss function is constructed. The loss of the new task is combined with the parameter importance regularization term. The retention of new and old knowledge is balanced by the regularization coefficient to obtain the optimization objective function.
[0042] The incremental learning model is updated based on the optimization objective function, and the total loss is minimized by the gradient descent algorithm. While learning new knowledge, it retains the ability to remember historical production patterns, thus obtaining the trained prediction model.
[0043] In the sixth embodiment of the first aspect, the step of constructing a model predictive control system based on the trained predictive model, and solving for the optimal control sequence using a sequence quadratic programming algorithm based on the prediction time domain and the control time domain to obtain a closed-loop regulation system for nutrients, includes:
[0044] Based on the trained prediction model, a prediction function is constructed. The current system state and control variables are used as inputs. Through forward inference, the trajectory of nutrient changes in the future prediction time domain is predicted to obtain the nutrient prediction sequence.
[0045] Based on the predicted nutrient composition sequence and the target nutrient composition values, an objective function is constructed. The sum of squared errors and the sum of squared control increments are then combined using a weighted matrix, where the error weight matrix determines the degree of penalty for nutrient composition deviations and the control weight matrix determines the degree of penalty for changes in control actions, thus obtaining the optimized objective function.
[0046] Set upper and lower bound constraints for control variables, set maximum change range constraints for control increments, and set quality standard range constraints for output variables. Combine these constraints to form a set of inequality constraints, and obtain the constraint set.
[0047] The optimization objective function and the set of constraints are combined to form a quadratic programming problem, which is then solved iteratively using a sequential quadratic programming algorithm. In each iteration, the nonlinear optimization problem is linearized and a quadratic subproblem is constructed to obtain the optimal control sequence in the future control time domain.
[0048] The first control action is extracted from the optimal control sequence and executed. The control action is applied to the quick-frozen food processing system to adjust the temperature and humidity. In the next control cycle, the optimization calculation is re-performed to achieve rolling optimization and obtain a real-time control signal.
[0049] Based on the real-time control signal, the processing parameters are adjusted in a closed loop. The control strategy is continuously corrected through a 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 regulation system.
[0050] Secondly, this 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 data acquisition module is used to acquire and preprocess multi-source sensor data during the processing of frozen foods. It normalizes and segments temperature sequences, humidity sequences, nutrient sequences, and image feature sequences using a sliding window to obtain a structured time-series dataset.
[0052] The input module is used to construct a deep recurrent neural network prediction model based on the structured time-series dataset. It inputs multi-source features into the encoder-decoder architecture neural network and fuses the features through an attention mechanism to obtain a nutrient composition prediction model.
[0053] The training module is used to perform three-stage transfer learning training on the nutrient composition prediction model, including pre-training, domain adaptation and incremental learning, and optimize the model parameters through elastic weight consolidation technology to obtain the trained prediction model.
[0054] The solution module is used to construct a model predictive control system based on the trained prediction model, and to solve for the optimal control sequence using a sequential quadratic programming algorithm based on the prediction time domain and the control time domain, thereby obtaining a closed-loop regulation system for nutrients.
[0055] Thirdly, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the aforementioned neural network-based nutrient regulation method.
[0056] The technical solution provided in this application utilizes multi-source sensor data acquisition and preprocessing technology to achieve comprehensive monitoring of temperature, humidity, nutritional components, and appearance characteristics during the processing of frozen foods. Data normalization and sliding window segmented processing ensure the effective integration of different types of data. The deep recurrent neural network prediction model effectively extracts the temporal dependencies of multi-source features through an encoder-decoder architecture. Specifically, a bidirectional long short-term memory network captures the long-term effects of temperature changes, a gated recurrent unit mines the dynamic characteristics of environmental parameters, a combination of convolutional and long short-term memory networks analyzes the time-varying patterns of image features, and a multi-head attention mechanism dynamically adjusts the weights of different feature channels, highlighting the factors most significantly affecting nutritional components, thus enabling the model to accurately capture complex nonlinear relationships. The three-stage transfer learning training strategy addresses the issues of data scarcity and domain adaptation in deep learning. The pre-training stage utilizes large-scale public datasets to acquire general feature representation capabilities, the domain adaptation stage extracts domain-invariant features through adversarial training, and incremental learning combined with elastic weight consolidation technology achieves continuous model optimization and knowledge accumulation, significantly improving the model's applicability and generalization ability in real-world production environments. The model predictive control system organically combines prediction and optimization, accurately predicting the changing trends of nutritional components within the prediction time domain. It solves for the optimal control sequence using a sequential quadratic programming algorithm, and a rolling optimization strategy ensures the real-time performance and robustness of the control. Overall, this method uses neural network algorithms to model and predict the complex nonlinear mapping relationship between process parameters such as temperature and humidity and nutrient loss in frozen food processing, overcoming the limitations of traditional methods that rely on empirical parameter settings and struggle to capture dynamic changes. Particularly noteworthy is the temporal feature extraction capability of deep recurrent neural networks, combined with feature importance learning through attention mechanisms. This enables the algorithm to identify key influencing factors and critical time points from massive amounts of multidimensional time-series data, which is crucial for applications like frozen foods where processes exhibit significant time dependence. Furthermore, transfer learning and incremental learning strategies address the data scarcity and continuous updating challenges faced by deep learning models in industrial environments. Elastic weight consolidation technology ensures that the model does not forget old knowledge while learning new knowledge. These algorithmic characteristics directly enhance the stability and adaptability of the system during long-term use. Attached Figure Description
[0057] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0058] Figure 1This is a schematic diagram of an embodiment of the nutrient component regulation method based on neural networks in this application.
[0059] Figure 2 This is a schematic diagram of one embodiment of the nutrient component regulation system based on neural networks in this application. Detailed Implementation
[0060] This application provides a method, system, and medium for regulating nutrients based on neural networks. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0061] For ease of understanding, the specific process of the embodiments of this application is described below. Please refer to [link / reference]. Figure 1 One embodiment of the nutrient component regulation method based on neural networks in this application includes:
[0062] Step S101: Collect and preprocess multi-source sensor data of the quick-frozen food processing process, normalize the temperature sequence, humidity sequence, nutrient composition sequence and image feature sequence and segment them with a sliding window to obtain a structured time series dataset.
[0063] Step S102: Construct 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 fuse features through an attention mechanism to obtain a nutrient composition prediction model.
[0064] Step S103: Perform three-stage transfer learning training on the nutrient composition prediction model, including pre-training, domain adaptation and incremental learning, and optimize the model parameters through elastic weight consolidation technology to obtain the trained prediction model.
[0065] Step S104: Construct a model prediction control system based on the trained prediction model, and solve the optimal control sequence using a sequence quadratic programming algorithm based on the prediction time domain and the control time domain to obtain a closed-loop regulation system for nutrients.
[0066] It is understood that the executing entity of this application can be a nutrient component regulation system based on a neural network, or it can be a terminal or a server; no specific limitation is made here. This application's embodiments use a server as an example for illustration.
[0067] Specifically, on a frozen food processing production line, temperature sensor arrays are deployed at key stations such as the pretreatment zone, quick-freezing zone, and packaging zone. Near-infrared spectrometers monitor nutrients such as protein, fat, carbohydrates, and vitamin C in real time, humidity sensors detect ambient humidity and water activity on the food surface, and image acquisition equipment captures the appearance characteristics of the food. These sensors form a monitoring network to capture data in real time during the quick-freezing process. The collected raw data contains noise and outliers. Outlier data points are identified and removed using a three-standard-deviation criterion, and missing values are filled using time-series interpolation. For example, if a temperature sensor measures -45℃ at a certain moment, while the measurements at the preceding and following moments are -32℃ and -33℃ respectively, this value significantly deviates from the normal range and is removed after a three-standard-deviation criterion, replaced by interpolation using data from the preceding and following moments. After data cleaning, the data from various sensors undergoes minimum-maximum standardization, mapping the values to the 0-1 range to resolve the issue of inconsistent dimensions between different types of data. Subsequently, a sliding window method was employed, with a set window size and sliding step, to segment the continuous time series into multiple overlapping segments. Each segment contains historical multi-source data and corresponding nutrient target values. To address the issue of scarce training data, data augmentation techniques such as adding Gaussian noise, data interpolation, and time axis perturbation were used to expand the training sample set and improve the model's generalization ability.
[0068] A deep recurrent neural network prediction model is 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, capable of simultaneously considering past and future temporal information, effectively capturing the impact of temperature changes on nutritional components. The environmental parameter feature extraction network uses a two-layer gated recurrent unit to process environmental data such as humidity and pressure. The gating mechanism selectively retains or discards information, mitigating the gradient vanishing problem in long-sequence training. The image feature extraction network combines a convolutional neural network and a long short-term memory network; the convolutional layers extract spatial features, while the long short-term memory network captures changes in the temporal dimension. These three networks output dynamic feature vectors for temperature, environmental parameters, and images, respectively. A multi-head attention mechanism is then introduced to fuse these features, dynamically assigning weights to different feature channels to enhance the model's sensitivity to key features. For example, when a specific temperature change significantly affects vitamin C content, the attention mechanism assigns higher weights to the temperature feature. The fused feature vectors and historical nutrient data are input 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 difficulties of deep networks. Finally, the predicted nutrient values are output through fully connected layers.
[0069] In the pre-training phase, an open-source dataset from the food industry is used, containing processing parameters and nutritional data for various 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 employed to gradually reduce the learning rate and prevent oscillations during training. In the domain adaptation phase, the underlying network parameters of the pre-trained model are frozen, and only the top-level parameters are updated. Domain adversarial training is introduced, by adding a domain discriminator to the model, training the network to extract domain-invariant features, enabling the model to adapt to the specific production environment of the enterprise. In the incremental learning phase, an experience replay mechanism is designed, maintaining a fixed-size historical sample buffer. When new production data arrives, new samples are mixed with historical samples for training to prevent the model from forgetting learned knowledge. In addition, elastic weight consolidation technology is used, calculating parameter importance through the Fisher information matrix, and imposing stronger update constraints on important parameters, maintaining historical knowledge while learning new knowledge.
[0070] Based on a 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 variation in control actions. Simultaneously, constraints on control variables, control increments, and outputs are set to ensure the system operates within a safe and reasonable range. A sequential quadratic programming algorithm is employed to solve this optimization problem. In each control cycle, the optimal control sequence is calculated, but only the first control action is executed; the system is re-optimized in the next cycle, achieving rolling optimization control. In this way, the system can automatically adjust processing parameters based on real-time monitored trends in nutrient changes, achieving precise control of nutrients, significantly reducing nutrient loss in traditional methods, and improving the quality and nutritional value of frozen foods.
[0071] In the embodiments of this application,
[0072] In one specific embodiment, the process of performing step S101 may specifically include the following steps:
[0073] Data is collected from the quick-frozen food processing production line using temperature sensor arrays, humidity sensors, near-infrared spectrometers, and image acquisition equipment to obtain raw multi-source sensor data.
[0074] The original multi-source sensor data is subjected to three-fold standard difference constant removal and time series-based interpolation imputation to obtain cleaned sensor data;
[0075] The cleaned sensor data is subjected to minimum-maximum standardization processing, mapping each sensor data to a range of zero to one, to obtain temperature sequence, humidity sequence, nutrient component sequence and image feature sequence containing multiple sampling times;
[0076] Based on a preset window size and sliding step, the temperature sequence, humidity sequence, nutrient component sequence and image feature sequence are segmented by sliding window to generate a sample sequence containing multi-source data input at historical time and target values of nutrient components at corresponding time.
[0077] Gaussian noise was added to the sample sequence, data interpolation was performed, and time axis perturbation was applied to obtain the enhanced training samples.
[0078] The enhanced training samples are organized according to the time dimension to construct a structured time series dataset containing multidimensional time series data.
[0079] Specifically, multiple sensors are deployed on the frozen food processing production line for data acquisition. A temperature sensor array is a network system composed of multiple individual temperature sensors strategically distributed at key workstations such as the pre-processing, quick-freezing, and packaging areas, collecting ambient temperature and food core temperature data at different 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 of the food surface, which is crucial for controlling moisture migration during freezing. Near-infrared spectrometers non-destructively detect the content of nutrients such as protein, fat, carbohydrates, and vitamin C in food by measuring the absorption and reflection characteristics of near-infrared light. Image acquisition equipment acquires the appearance and morphological characteristics of the food in real time, including indicators such as color, shape, and texture. All these devices acquire data synchronously, forming a timestamp-aligned raw multi-source sensor data stream. Outlier removal and missing value imputation are performed on the acquired raw multi-source sensor data. The three-fold standard deviation constant removal method is based on statistical principles; first, the mean and standard deviation of each sensor data are calculated, and then the range limits of normal values are determined. For any sensor data sequence, its mean and standard deviation are calculated. If a data point's value exceeds the range of the mean plus or minus three times the standard deviation, it is identified as an outlier and removed. For example, if the mean of temperature sensor data is -30℃ and the standard deviation is 1℃, then any temperature reading below -33℃ or above -27℃ will be identified as an outlier and removed from the dataset. These outliers are usually caused by sensor malfunctions, electronic interference, or other abnormal factors. For data gaps resulting from outlier removal, and for data points that the sensor itself failed to collect, a time-series-based interpolation imputation method is used. This method considers the temporal characteristics of the data and performs reasonable interpolation based on the values of adjacent time points. Commonly used interpolation methods include linear interpolation, spline interpolation, and polynomial interpolation. For example, if there is valid data at time points t1 and t3, but data at time t2 is missing, linear interpolation will calculate an estimate of the value at time t2 based on the data values at times t1 and t3.
[0080] Min-maximum standardization of the cleaned sensor data addresses the issue of inconsistent dimensions among different data types. The standardization process subtracts the minimum value for each data type from the original data value, then divides by the difference between the minimum and maximum values, resulting in a standardized value ranging from 0 to 1. This process maps data with different dimensions, such as temperature (°C), humidity (%), and nutrient content (mg / 100g), to the same scale, facilitating effective learning by neural networks. The standardized data yields temperature, humidity, nutrient content, and image feature sequences from multiple sampling times, forming a time-aligned multi-source dataset.
[0081] Sliding window segmentation is performed on various sequences based on a preset window size and sliding step size. A sliding window 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, setting the window size to 60 (corresponding to 10 minutes of data, assuming a sampling frequency of once every 10 seconds) and the sliding step size 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 containing multi-source data inputs from historical moments and corresponding target values for nutrients. This processing method enables neural networks to learn temporal context information and capture the temporal dependencies of the data. To enhance the model's generalization ability and robustness, data augmentation is performed on the above sample sequences. Gaussian noise addition refers to superimposing normally distributed random noise onto the original data to simulate measurement errors and interference present in the real environment. Data interpolation increases sample density by inserting new data points between the original data points. Time-axis perturbation applies slight scaling transformations to the time series, simulating time-scale changes caused by speed variations during processing. These enhancements work together to generate richer and more diverse training samples, helping the model learn more robust feature representations. The enhanced training samples are organized along the time dimension to construct a structured time-series dataset containing multidimensional time-series data. This dataset is a multidimensional tensor containing sample sequence dimensions, time dimensions, and feature dimensions, where the feature dimension includes multi-source data such as temperature, humidity, nutrient composition, and image features. This structured organization facilitates subsequent batch training and efficient processing of neural network models.
[0082] In one specific embodiment, the process of performing step S102 may specifically include the following steps:
[0083] The temperature sequences in the structured time-series dataset are input into a temperature time-series feature extraction network with a three-layer bidirectional long short-term memory network to extract features and obtain a dynamic temperature feature vector.
[0084] The humidity and pressure sequences in the structured time-series dataset are input into an environmental parameter feature extraction network with two layers of gated recurrent units for feature learning to obtain environmental parameter feature vectors.
[0085] The image feature sequences in the structured time-series dataset are input into an image feature extraction network consisting of three convolutional layers, two pooling layers, and a long short-term memory network to extract time-series features and obtain dynamic image feature vectors.
[0086] Multi-head attention calculation is performed on the temperature dynamic feature vector, environmental parameter feature vector and image dynamic feature vector based on the query matrix, key matrix and value matrix. The feature channel weights are dynamically allocated through the scaling dot product attention mechanism to obtain the fused feature vector.
[0087] The fused feature vector and the historical nutrient data in the structured time series dataset are input into a decoder with a four-layer stacked long short-term memory network for decoding, wherein each layer contains residual connections and layer normalization, to obtain the nutrient time series prediction output.
[0088] The time-series prediction output of the nutrients is linearly transformed through a fully connected layer, and the output dimension is equal to the number of predicted nutrient types, thus obtaining the nutrient prediction model.
[0089] Specifically, the temperature sequences from the structured time-series dataset are input into a temperature time-series feature extraction network with a three-layer bidirectional long short-term memory (LSTM) network. The bidirectional LSTM network is a special type of recurrent neural network structure that can simultaneously consider both forward and backward information of the sequence, capturing long-term dependencies in the time series. In this network, the temperature sequence is first decomposed into a series of time steps, with the temperature data from each time step flowing simultaneously into both forward and backward LSTM units. The LSTM units control the inflow, storage, and output of information through three gating mechanisms: input gate, forget gate, and output gate, effectively mitigating the gradient vanishing problem in traditional recurrent neural networks. The three-layer network structure allows for deeper feature extraction, extracting different levels of temperature change features layer by layer. Finally, the forward and backward feature vectors are merged to form a dynamic temperature feature vector, which contains comprehensive information about temperature changes over time. The humidity and pressure sequences from the structured time-series dataset are then input into an environmental parameter feature extraction network with two layers of gated recurrent units. Gated recurrent units (GRUs) are a simplified variant of long short-term memory (LSM) networks. They control information flow through update and reset gates, resulting in a simpler structure while retaining long-term memory capabilities. Humidity and pressure data, as environmental parameters, jointly influence moisture migration and textural changes during food processing. Therefore, combining them allows for the acquisition of more comprehensive environmental characteristics. A two-layer GRU network extracts temporal features of 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] For image feature sequence processing, a hybrid structure combining convolutional neural networks (CNNs) and long short-term memory (LSTM) networks was employed. The CNNs, specifically designed for processing spatially structured data such as images, extracted features through three convolutional layers, each using kernels of different sizes to extract spatial features at different scales. Two pooling layers performed downsampling to reduce the feature map size while preserving important features and lowering computational complexity. The feature sequences after convolution and pooling were then input into the LTM network to capture the temporal changes in image features. The entire network integrates spatial feature extraction and temporal feature learning capabilities, ultimately outputting a dynamic image feature vector containing information about how food appearance changes during processing. A multi-head attention mechanism was used to fuse these three feature vectors; this mechanism adaptively learns the importance of different features. In the multi-head attention computation, the input features were first mapped to a query matrix, a key matrix, and a value matrix through a linear transformation. The query matrix represents the information currently requiring attention, the key matrix is used to calculate a similarity score with the query matrix, and the value matrix contains the actual information content. Attention weights are obtained by calculating 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 allocates weights to different feature channels, giving higher attention to features that are more important for nutrient prediction.
[0091] The fused feature vectors and historical nutrient content data are input into a decoder with a four-layer stacked Long Short-Term Memory (LSTM) network. The decoder, through the multi-layer stacked LTM network structure, analyzes the information contained in the fused features layer by layer to predict the nutrient content at future time points. Residual connections are introduced between every two LTM layers, enabling the network to learn new feature representations while retaining original features, effectively mitigating the gradient vanishing problem in deep network training. Layer normalization, by normalizing each sample individually, stabilizes the training process of the deep network and accelerates model convergence. The four-layer stacked structure gives the decoder powerful non-linear expressive capabilities, enabling it to capture complex feature interactions and temporal dependencies, ultimately outputting a temporal prediction sequence of nutrient content.
[0092] A fully connected layer linearly transforms the time-series nutrient prediction output. This fully connected layer maps the feature space to the prediction space, and its output dimension is equal to the number of nutrient types to be predicted. For example, if we need to predict four nutrients simultaneously—protein, fat, carbohydrates, and vitamin C—the fully connected layer's output dimension will be 4. This step completes the final prediction transformation, forming the nutrient prediction model.
[0093] In one specific embodiment, the process of performing the feature extraction step of inputting the temperature sequence from the structured time-series dataset into a temperature time-series feature extraction network with a three-layer bidirectional long short-term memory network can specifically include the following steps:
[0094] The temperature sequence in the structured time-series dataset is split into time dimensions, and the temperature data at each sampling time is used as the input unit of a bidirectional long short-term memory network to obtain the input sequence;
[0095] The input sequence is input into the forward long short-term memory unit and the backward long short-term memory unit respectively. The forward unit processes the sequence from the beginning to the end, and the backward unit processes the sequence from the end to the beginning. Each unit includes the calculation of the input gate, the forget gate and the output gate to obtain the forward hidden state sequence and the backward hidden state sequence.
[0096] The forward hidden state sequence and the backward hidden state sequence are concatenated to form the output of the first layer bidirectional long short-term memory network, wherein the output at each time step contains feature information in both the forward and backward directions, thus obtaining the 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. The forward and backward processing processes are repeated. By passing information between hidden units, higher-level temporal dependencies are captured 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. By stacking multiple networks, the long-term dependency pattern of temperature change is learned, and the third layer bidirectional feature sequence is obtained.
[0099] The last time step output of the third-layer bidirectional feature sequence is subjected to dimensional transformation and feature integration, and the forward and backward feature information is fused into a unified feature representation to obtain the temperature dynamic feature vector.
[0100] Specifically, the temperature sequences in the structured time-series dataset are split along the time dimension. This step divides the continuous temperature time series into discrete sets of data points based on time points. Assuming a temperature sequence several hours in length, where each element represents the temperature value at a sampling time, time-dimensional splitting treats each temperature value in the sequence as an independent feature input. For example, in the processing of frozen foods, a temperature sensor collects data every 10 seconds, resulting in 360 sampling points in one hour of processing. After splitting, this yields an input sequence of 360 time steps. This splitting preserves the temporal relationship of the temperature data, providing a structured input for the subsequent bidirectional Long Short-Term Memory (LSTM) network. The split input sequences are then fed into the forward LSM unit and the backward LSM unit, respectively. The LSM unit is a special recurrent neural network structure specifically designed to solve the gradient vanishing problem in traditional recurrent neural networks, effectively learning long-term dependencies. In forward processing, the LSM unit processes the temperature data sequentially from the first time point to the last time point; in backward processing, it processes the data in reverse order, from the last time point to the first time point. Each Long Short-Term Memory (LSTM) unit contains three key gating mechanisms: the input gate controls the degree to which new information enters the cell state, the forget gate determines how much old information is discarded, and the output gate controls the degree to which the cell state outputs to the hidden state. These three gates work together, enabling the network to selectively remember or forget information, making it particularly suitable for processing time-series data. After forward and backward processing, the forward and backward hidden state sequences are obtained, each containing feature information for that moment. The forward and backward hidden state sequences are then concatenated. Concatenation refers to merging two vectors into a longer vector along the feature dimension. Specifically, for each time step, the corresponding forward and backward hidden states are concatenated into a new vector. Through this concatenation, the output of each time step simultaneously contains forward information from the beginning of the sequence to the current moment, as well as backward information from the end of the sequence to the current moment, enabling a more comprehensive capture of the temporal context. This bidirectional processing approach allows the network to not only use past information to predict the future but also to use future information to better understand the past, making it particularly suitable for processing data such as temperature changes, which exhibit significant patterns across different time scales. The concatenated first-layer bidirectional feature sequence contains the same number of time steps as the original sequence, with each time step having a feature dimension equal to the sum of the forward and backward dimensions. This first-layer bidirectional feature sequence is then fed into a second-layer bidirectional long short-term memory network, repeating the forward and backward processing. The second layer has the same structure as the first, but processes higher-level features. Through this layered structure, the network can learn feature representations at different levels of abstraction layer by layer.The first layer primarily learns local temperature change patterns, such as warming or cooling trends; while the second layer captures temperature change patterns over a longer time frame, such as temperature fluctuation cycles or temperature transition characteristics between different processes. Through information transmission between hidden units, the network can establish long-distance temporal dependencies and identify temperature patterns that significantly affect changes in nutrient composition. After processing by the second layer, the forward and backward hidden states are concatenated to obtain the second-layer bidirectional feature sequence, with the same dimensionality as the first layer but containing higher-level temporal information.
[0101] The second-layer bidirectional feature sequence is further input into the third-layer bidirectional long short-term memory network for deep feature extraction. A key characteristic of deep neural networks is that as the number of layers increases, the network can learn increasingly abstract and complex feature representations. The third-layer bidirectional long short-term memory network integrates the features extracted from the first two layers, capturing deeper patterns in temperature changes, such as the impact patterns of different temperature ranges on different nutrients, or the relationship between the rate of temperature change and nutrient retention. This multi-layered stacked structure enables the network to build long-term dependency models of temperature changes, identifying important information that may span the entire processing. The resulting third-layer bidirectional feature sequence contains a high-level abstract representation of the temperature data. Dimensional transformation and feature integration are then performed on the output of the last time step of the third-layer bidirectional feature sequence. Specifically, the output of the last time step of the third-layer sequence is selected; this output contains the cumulative information of the entire sequence. Then, through linear transformation or other feature integration methods, this vector is mapped to an appropriate feature space, forming the final dynamic temperature feature vector. This feature vector is a highly condensed representation of the temperature time-series data, containing key information on the impact of temperature changes on nutrients, providing important input for subsequent feature fusion and prediction models.
[0102] In one specific embodiment, the process of inputting the fused feature vector and the historical nutrient data from the structured time-series dataset into a decoder with a four-layer stacked long short-term memory network for decoding can specifically include the following steps:
[0103] The fused feature vector and the historical nutrient composition data in the structured time series dataset are concatenated to form the initial input sequence of the decoder, thus obtaining the decoding input vector;
[0104] The decoded input vector is input into the first layer of the long short-term memory network, and the sequence information is processed through the gating mechanism of the input gate, forget gate and output gate to obtain the first layer of hidden state sequence;
[0105] The first layer hidden state sequence and the decoded input vector are residually concatenated, and the two are added together and then processed by layer normalization to retain the original input information and alleviate the gradient vanishing problem, thus obtaining the first layer normalized output.
[0106] The first layer normalized output is input into the second layer long short-term memory network, the gating calculation process is repeated, and residual connection and layer normalization processing are performed 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 the long short-term memory network in sequence. Each layer contains residual connections and layer normalization operations. By stacking multiple layers, the complex temporal patterns of nutrients are learned to obtain the final layer normalized output.
[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 future time steps is generated to obtain the nutrient component time-series prediction output.
[0109] Specifically, the fused feature vector generated earlier through the attention mechanism is concatenated with the historical nutrient composition data from the structured time-series dataset. Concatenation involves merging the two sets of data along the feature dimension while maintaining the time dimension. For example, if the fused feature vector has a dimension of 256 and the historical nutrient composition data has a dimension of 64 (assuming 16 nutrients were monitored, each with 4 historical data points), the resulting decoded input vector has a dimension of 320. This concatenation ensures that the decoder simultaneously possesses both the environmental characteristics of the current batch and the historical trends in nutrient composition changes, providing a comprehensive information foundation for accurately predicting future nutrient content. The decoded input vector is then fed into the first layer of the Long Short-Term Memory (LSTM) network for processing. LSTM is a special type of recurrent neural network specifically designed for processing sequential data. Its core lies in managing information flow through three gating mechanisms: the input gate controls the proportion of new information entering the cell state, the forget gate controls how much old information is retained, and the 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 memorized content is output. These three gates output values between 0 and 1 through the sigmoid activation function, used to control the proportion of information flow. Through this fine-grained control, the Long Short-Term Memory (LSTM) network can maintain its state in long sequences and effectively learn patterns of nutrient changes over time. After the first layer of processing, the first layer of hidden state sequence is obtained, which contains the initially extracted temporal features.
[0110] To address the vanishing gradient problem common in deep neural networks and preserve original input information, a residual connection is performed between the first-layer hidden state sequence and the decoded input vector. A residual connection directly adds the input to the output, creating a shortcut that allows the gradient to flow back to the shallower layers. Specifically, the first-layer hidden state sequence and the decoded input vector are added element-wise to obtain a hybrid feature representation. This connection method allows the network to learn not only the difference between the input and output (the residual) but also preserves the original input information, which is beneficial for training deep networks. Subsequently, the addition result is 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, standardizing the features to a distribution with a mean of 0 and a variance of 1. This process reduces internal covariate shift, stabilizes the training process, and accelerates network convergence. After residual connection and layer normalization, the first-layer normalized output is obtained.
[0111] The normalized output of the first layer is used as input to the second layer of the Long Short-Term Memory (LSTM) network, and a similar gating process is repeated. The second LSM network further extracts higher-level temporal features, capable of capturing more complex patterns of nutrient changes. After processing, it is again residually connected to the normalized output of the first layer, and then subjected to layer normalization to obtain the normalized output of the second layer. This layered structure allows the network to learn features at different levels of abstraction, from simple short-term changes to complex long-term trends. Simultaneously, the residual connections at each layer ensure smooth flow of information and gradients, effectively alleviating the training difficulties of deep networks. The normalized output of the second layer is then sequentially input into the third and fourth LSM networks, maintaining the same processing pattern. Each layer extracts features through the LSM network, performs residual connections with the output of the previous layer, and then undergoes layer normalization for stable training. Through this multi-layered stacked structure, the network can gradually build a complex temporal model of nutrient changes, learning the patterns of change at different scales. For example, the first layer might learn the direct short-term effects of temperature on water-soluble vitamins, the second layer might learn the medium-term effects of water migration on nutrient stability, and the third and fourth layers might capture more complex long-term interactions, such as the combined effects of different process combinations on multiple nutrients. After processing through these four layers, the final layer's normalized output is obtained, which contains rich temporal feature information.
[0112] Feature extraction is performed at each time step of the normalized output of the final layer, mapping the hidden state to the prediction space. This step is typically achieved through a fully connected layer, converting the high-dimensional hidden state into specific nutrient prediction values. The output dimension of the fully connected layer equals the number of nutrient types to be predicted; for example, if the content of protein, vitamin C, folic acid, and antioxidants needs to be predicted simultaneously, the output dimension is 4. Through this mapping, the network generates a sequence of nutrient predictions for multiple future time steps, forming a time-series nutrient prediction output. This prediction not only includes the nutrient content at the next time step but also predicts the changing trends over multiple future time steps, providing predictive guidance for real-time regulation of the processing.
[0113] In one specific embodiment, the process of executing step S103 may specifically include the following steps:
[0114] The nutritional component prediction model was pre-trained based on publicly available datasets from the food industry. The objective function was constructed by a weighted combination of the cross-entropy loss function and the mean squared error loss function. The learning rate was adjusted using a cosine annealing strategy to obtain the pre-trained model.
[0115] The pre-trained model is subjected to domain adaptive training. The parameters of the bottom layer network are frozen and only the parameters of the top layer are updated. The model is trained using the enterprise's historical production data. An adversarial training mechanism is constructed through a domain discriminator and a gradient inversion layer to extract domain-invariant features and obtain 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, thus obtaining an incremental learning model.
[0117] The importance of each parameter in the incremental learning model is calculated based on the Fisher information matrix. The parameter importance constraint is established through the elastic weight consolidation technique, in which the update magnitude of important parameters is subject to stronger constraints, and the parameter importance matrix is obtained.
[0118] Based on the parameter importance matrix, an elastic weight consolidation loss function is constructed. The loss of the new task is combined with the parameter importance regularization term. The retention of new and old knowledge is balanced by the regularization coefficient to obtain the optimization objective function.
[0119] The incremental learning model is updated based on the optimization objective function, and the total loss is minimized by the gradient descent algorithm. While learning new knowledge, it retains the ability to remember historical production patterns, thus obtaining the trained prediction model.
[0120] Specifically, the nutritional component prediction model was initialized and trained using publicly available datasets from the food industry. These datasets typically contain a large amount of data on different types of frozen food processing and corresponding nutritional component detection results, with a data scale far exceeding the amount of data a single company can collect. The pre-training process employed a weighted combination of cross-entropy loss and mean squared error loss as the objective function. Cross-entropy loss is suitable for classification problems, used to evaluate the difference between the model's predicted nutritional component category and the actual category; mean squared error loss is suitable for regression problems, measuring the deviation between the model's predicted nutritional component value and the actual value. The weight coefficients were adjusted to balance the importance of the classification and regression tasks. During training, a cosine annealing strategy was used to dynamically adjust the learning rate, i.e., the learning rate gradually decreased from its initial value to a minimum value according to a cosine function, and then increased again, changing periodically. This strategy helps the model escape local optima, explore more broadly in the parameter space, and ultimately find a better solution. The pre-trained model obtained in this way already possesses the ability to represent the general features of nutritional component changes during food processing. The second stage is domain-adaptive training, designed to adapt the pre-trained model to the specific production environment of a particular company. In this stage, the underlying network parameters of the pre-trained model are first frozen, allowing only the top-level parameters to be updated. The underlying parameters typically extract general features, while the top-level parameters focus more on specific tasks. This partial fine-tuning preserves the general feature extraction capability while adapting the model to the target domain. Although the amount of historical production data from enterprises is limited, it contains unique production characteristics and product features, making it crucial for targeted model optimization. To address the distributional differences 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 tasked with distinguishing whether features originate from the source or target domain; simultaneously, a gradient reversal layer is added between the feature extractor and the discriminator, causing the gradient direction to be reversed during backpropagation. Through this adversarial training, the feature extractor is forced to learn domain-invariant feature representations—features that are useful for distinguishing changes in nutrient composition but are independent of the data source. This training method enables the model to work better in the target enterprise environment, even if the training data differs from the actual application environment.
[0121] The third stage is incremental learning training, designed to enable the model to continuously adapt to new production data and optimize performance. In practical applications, enterprises 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 learned knowledge, an experience replay mechanism is employed. This mechanism maintains a fixed-size historical sample buffer, storing a representative portion of historical data. When new production data arrives, it is mixed with historical samples for training, ensuring that the model does not forget old knowledge while learning new knowledge. This method effectively alleviates the catastrophic forgetting problem common in neural network training, i.e., the phenomenon where training on new tasks leads to a significant drop in model performance on old tasks. To further enhance the model's stability and memory capacity, elastic weight consolidation technology 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 is a method for measuring the degree of influence of parameters on model performance, evaluating parameter importance by calculating the second derivative of the loss function with respect to the parameters. Changes in important parameters will have a significant impact on model performance, while less important parameters will not significantly affect performance even with large changes. Based on the calculation results, a parameter importance matrix is obtained, where each parameter has a corresponding importance score.
[0122] A resilient weighted 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 modifications to important parameters. Specifically, the parameter importance regularization term calculates the difference between the current parameters and the historical best parameters, and weights them according to parameter importance. Changes in important parameters are penalized more strongly, thus subjecting them to stricter constraints. The two parts of the loss are balanced by a regularization coefficient, controlling the proportion of new and old knowledge retained. This mechanism ensures that the model does not significantly change parameters crucial to historical knowledge while learning new knowledge, thereby maintaining good performance on learned tasks. The incremental learning model's parameters are updated based on the optimization objective function. The gradient descent algorithm or its variants (such as Adam, RMSProp, etc.) are used to calculate the gradient of the loss function with respect to each parameter, and then the parameters are updated according to the gradient direction to minimize the total loss. Through iterative training, the model gradually optimizes, performing well on new data while maintaining its ability to remember historical data. This training strategy enables the model to adapt to various changes in the long-term operation of an enterprise, such as seasonal changes in raw materials, fluctuations in equipment performance, and process adjustments, while maintaining accurate nutrient prediction capabilities.
[0123] In one specific embodiment, the process of executing step S104 may specifically include the following steps:
[0124] Based on the trained prediction model, a prediction function is constructed. The current system state and control variables are used as inputs. Through forward inference, the trajectory of nutrient changes in the future prediction time domain is predicted to obtain the nutrient prediction sequence.
[0125] Based on the predicted nutrient composition sequence and the target nutrient composition values, an objective function is constructed. The sum of squared errors and the sum of squared control increments are then combined using a weighted matrix, where the error weight matrix determines the degree of penalty for nutrient composition deviations and the control weight matrix determines the degree of penalty for changes in control actions, thus obtaining the optimized objective function.
[0126] Set upper and lower bound constraints for control variables, set maximum change range constraints for control increments, and set quality standard range constraints for output variables. Combine these constraints to form a set of inequality constraints, and obtain the constraint set.
[0127] The optimization objective function and the set of constraints are combined to form a quadratic programming problem, which is then solved iteratively using a sequential quadratic programming algorithm. In each iteration, the nonlinear optimization problem is linearized and a quadratic subproblem is constructed to obtain the optimal control sequence in the future control time domain.
[0128] The first control action is extracted from the optimal control sequence and executed. The control action is applied to the quick-frozen food processing system to adjust the temperature and humidity. In the next control cycle, the optimization calculation is re-performed to achieve rolling optimization and obtain a real-time control signal.
[0129] Based on the real-time control signal, the processing parameters are adjusted in a closed loop. The control strategy is continuously corrected through a 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 regulation 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 inputs. The system state includes parameters such as the current temperature distribution, humidity, and internal temperature of the food, while the control variables include adjustable process parameters such as the quick-freezing temperature setpoint and conveyor belt speed. The prediction function calculates the changes in nutritional components over a future period through forward inference. Forward inference refers to the process of passing the input data sequentially from the input layer to each layer of the network to obtain the output value. Specifically, the current system state and control variables are first processed by the encoder network to extract feature representations, and then the decoder network generates predictions of nutritional component content at multiple future time points. In this way, for each time point within the prediction time domain (e.g., the next 30 minutes), a corresponding predicted value of nutritional component content can be obtained, forming a nutritional component prediction sequence. Based on the nutritional component prediction sequence obtained in the previous step and the pre-set target value of nutritional components, the objective function of model predictive control is constructed. The objective function typically contains two main parts: one is the sum of squares of the error between the predicted output and the target value, which measures the control effect; the other is the sum of squares of the control increment (i.e., the change in the control variable between two adjacent control cycles), which measures the control stationarity. These two parts are combined using a weighted matrix. The error weight matrix determines the degree of penalty for deviations at different times and for different nutrients. For example, higher weights can be assigned to predictions of the near future, or a higher penalty coefficient 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 that comprehensively considers control performance and control costs is obtained.
[0131] To ensure the safety and effectiveness of the control system under actual operating conditions, constraints need to be set for the control and output variables. Upper and lower bound constraints on the control variables limit the range of adjustable process parameters, such as ensuring the quick-freezing temperature cannot fall below equipment limits or exceed safety thresholds. Maximum change range constraints on control increments prevent abrupt changes in control actions, such as preventing large temperature adjustments in a short period, which helps protect equipment and ensure process stability. Quality standard range constraints on the output variables ensure that the predicted nutrient content meets product quality requirements, such as ensuring the vitamin C retention rate is not lower than a certain standard. These constraints are combined to form a set of inequality constraints, which, together with the objective function, constitute the optimization problem. Combining the objective function and the set of constraints forms a quadratic programming problem. Quadratic programming is a special type of optimization problem where the objective function is a quadratic function of the variables, and the constraints are linear. Here, since the objective function includes the sum of squared errors and the sum of squared control increments, it naturally has a quadratic form. This problem is solved using a sequential quadratic programming algorithm, an iterative optimization method particularly suitable for handling constrained nonlinear optimization problems. In each iteration, the algorithm first linearizes the nonlinear optimization problem near the current point, then constructs and solves a quadratic subproblem. Specifically, for the dynamic model of the potentially nonlinear system, the algorithm linearizes it using a first-order Taylor expansion, transforming the original problem into an optimization problem with a quadratic objective function and linear constraints. This subproblem is then solved using a standard quadratic programming solver to obtain the optimal control sequence. The optimal control sequence contains all control variable values from the current moment into 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 includes instructions to adjust process parameters such as freezing temperature and humidity, which are applied to the frozen food processing equipment through the control system. For example, if the optimal control sequence indicates that the freezing zone temperature should be reduced by 2°C, the control system will send a corresponding instruction to the refrigeration equipment. In the next control cycle (e.g., after 30 seconds), the system re-acquires the current state, repeats the above optimization calculation process, obtains a new optimal control sequence, and again executes only the first control action. This rolling optimization strategy can respond promptly to system changes and disturbances, continuously adjust the control strategy, and ensure the real-time performance and robustness of the control. Based on the above mechanism, a closed-loop regulation system for nutritional components is constructed. The core of the closed-loop system lies in the feedback mechanism, which involves real-time monitoring of the nutritional content in food using online detection equipment such as near-infrared spectrometers, comparing the actual measured values with the predicted and target values, and adjusting the control strategy based on the deviation. The closed-loop system includes four key links: prediction—predicting future changes in nutritional components based on the current state; optimization—calculating the optimal control sequence; execution—implementing the first control action; and feedback—monitoring the actual effect and updating the system state. These four stages operate in a cyclical manner, forming a continuously optimized closed-loop control process. Through this mechanism, the system can adapt to various disturbances such as changes in raw materials and equipment fluctuations, ensuring that the actual nutrient content continuously tracks the target value and achieving precise nutrient content regulation.
[0133] The above describes the nutrient component regulation method based on neural networks in the embodiments of this application. The following describes the nutrient component regulation system based on neural networks in the embodiments of this application. Please refer to [link / reference]. Figure 2 One embodiment of the nutrient component regulation system based on neural networks in this application includes:
[0134] The acquisition module 201 is used to acquire and preprocess multi-source sensor data of the quick-frozen food processing process, and to normalize and segment the temperature sequence, humidity sequence, nutrient composition sequence and image feature sequence using a sliding window to obtain a structured time series dataset.
[0135] Input module 202 is used to construct 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 fuse features through an attention mechanism to obtain a nutrient composition prediction model;
[0136] Training module 203 is used to perform three-stage transfer learning training on the nutrient composition prediction model, including pre-training, domain adaptation and incremental learning, and optimize the model parameters through elastic weight consolidation technology to obtain the trained prediction model.
[0137] The solution module 204 is used to construct a model predictive control system based on the trained prediction model, and to solve the optimal control sequence through a sequence quadratic programming algorithm based on the prediction time domain and the control time domain to obtain a closed-loop regulation system for nutrients.
[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, wherein the computer-readable storage medium stores instructions that, when the instructions are executed on a computer, cause the computer to perform the steps of the neural network-based nutrient regulation method.
[0139] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a neural network-based nutrient regulation device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0140] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A neural network-based nutrient composition regulation method, characterized by, The method includes: Multi-source sensor data from the frozen food processing process are collected and preprocessed. Temperature sequence, humidity sequence, nutrient composition sequence and image feature sequence are normalized and segmented by 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 an encoder-decoder neural network, and features are fused using an attention mechanism to obtain a nutrient composition prediction model. This includes: inputting the temperature sequence from the structured time-series dataset into a temperature time-series feature extraction network with a three-layer bidirectional long short-term memory network for feature extraction, obtaining a dynamic temperature feature vector; inputting the humidity and pressure sequences from the structured time-series dataset into an environmental parameter feature extraction network with two layers of gated recurrent units for feature learning, obtaining an environmental parameter feature vector; and inputting the image feature sequences from 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. Temporal feature extraction is performed on the network to obtain dynamic image feature vectors. Multi-head attention is then calculated on the temperature dynamic feature vector, environmental parameter feature vector, and image dynamic feature vector based on the query matrix, key matrix, and value matrix. Feature channel weights are dynamically allocated using a scaling dot product attention mechanism to obtain a fused feature vector. The fused feature vector and historical nutrient data from the structured time-series dataset are input into a decoder with a four-layer stacked long short-term memory network for decoding, where each layer includes residual connections and layer normalization, to obtain a nutrient temporal prediction output. This nutrient temporal prediction output is then linearly transformed through a fully connected layer, with the output dimension equal to the number of predicted nutrient types, resulting in a nutrient prediction model. The nutrient composition prediction model is trained using a three-stage transfer learning method, including pre-training, domain adaptation, and incremental learning. The model parameters are optimized using elastic weight consolidation techniques to obtain the trained prediction model. A model predictive control system is constructed based on the trained predictive model. The optimal control sequence is solved by a sequence quadratic programming algorithm based on the prediction time domain and the control time domain to obtain a closed-loop regulation system for nutrients.
2. The neural network-based nutrient composition regulation method according to claim 1, wherein, The process involves collecting and preprocessing multi-source sensor data during the frozen food processing. Temperature, humidity, nutrient composition, and image feature sequences are normalized and segmented using a sliding window to obtain a structured time-series dataset, including: Data is collected from the quick-frozen food processing production line using temperature sensor arrays, humidity sensors, near-infrared spectrometers, and image acquisition equipment to obtain raw multi-source sensor data. The original multi-source sensor data is subjected to three-fold standard difference constant removal and time series-based interpolation imputation to obtain cleaned sensor data; The cleaned sensor data is subjected to minimum-maximum standardization processing, mapping each sensor data to a range of zero to one, to obtain temperature sequence, humidity sequence, nutrient component sequence and image feature sequence containing multiple sampling times; Based on a preset window size and sliding step, the temperature sequence, humidity sequence, nutrient component sequence and image feature sequence are segmented by sliding window to generate a sample sequence containing multi-source data input at historical time and target values of nutrient components at corresponding time. Gaussian noise was added to the sample sequence, data interpolation was performed, and time axis perturbation was applied to obtain the enhanced training samples. The enhanced training samples are organized according to the time dimension to construct a structured time series dataset containing multidimensional time series data.
3. The neural network-based nutrient composition regulation method of claim 1, wherein, The step of inputting the temperature sequence from the structured time-series dataset into a temperature time-series feature extraction network with a three-layer bidirectional long short-term memory network for feature extraction, to obtain a dynamic temperature feature vector, includes: The temperature sequence in the structured time-series dataset is split into time dimensions, and the temperature data at each sampling time is used as the input unit of a bidirectional long short-term memory network to obtain the input sequence; The input sequence is input into the forward long short-term memory unit and the backward long short-term memory unit respectively. The forward unit processes the sequence from the beginning to the end, and the backward unit processes the sequence from the end to the beginning. Each unit includes the calculation of the input gate, the forget gate and the output gate to obtain the forward hidden state sequence and the backward hidden state sequence. The forward hidden state sequence and the backward hidden state sequence are concatenated to form the output of the first layer bidirectional long short-term memory network, wherein the output at each time step contains feature information in both the forward and backward directions, thus obtaining the 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. The forward and backward processing processes are repeated. By passing information between hidden units, higher-level temporal dependencies are captured 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. By stacking multiple layers of networks, the long-term dependency pattern of temperature change is learned, and the third layer bidirectional feature sequence is obtained. The last time step output of the third-layer bidirectional feature sequence is subjected to dimensional transformation and feature integration, and the forward and backward feature information is fused into a unified feature representation to obtain the temperature dynamic feature vector.
4. The nutrient component regulation method based on neural networks according to claim 3, characterized in that, The process involves inputting the fused feature vector and historical nutrient data from the structured time-series dataset into a decoder with a four-layer stacked long short-term memory network for decoding. Each layer includes residual connections and layer normalization to obtain a nutrient time-series prediction output, including: The fused feature vector and the historical nutrient composition data in the structured time series dataset are concatenated to form the initial input sequence of the decoder, thus obtaining the decoding input vector; The decoded input vector is input into the first layer of the long short-term memory network, and the sequence information is processed through the gating mechanism of the input gate, forget gate and output gate to obtain the first layer of hidden state sequence; The first layer hidden state sequence and the decoded input vector are residually concatenated, and the two are added together and then processed by layer normalization to retain the original input information and alleviate the gradient vanishing problem, thus obtaining the first layer normalized output. The first layer normalized output is input into the second layer long short-term memory network, the gating calculation process is repeated, and residual connection and layer normalization processing are performed 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 the long short-term memory network in sequence. Each layer contains residual connections and layer normalization operations. By stacking multiple layers, the complex temporal patterns of nutrients are learned to obtain the final layer normalized output. 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 future time steps is generated to obtain the nutrient component time-series prediction output.
5. The neural network-based nutrient composition regulation method of claim 1, wherein, The three-stage transfer learning training of the nutrient prediction model includes pre-training, domain adaptation, and incremental learning. The model parameters are optimized using elastic weight consolidation techniques to obtain the trained prediction model, including: The nutritional component prediction model was pre-trained based on publicly available datasets from the food industry. The objective function was constructed by a weighted combination of the cross-entropy loss function and the mean squared error loss function. The learning rate was adjusted using a cosine annealing strategy to obtain the pre-trained model. The pre-trained model is subjected to domain adaptive training. The parameters of the bottom layer network are frozen and only the parameters of the top layer are updated. The model is trained using the enterprise's historical production data. An adversarial training mechanism is constructed through a domain discriminator and a gradient inversion layer to extract domain-invariant features and obtain 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, thus obtaining an incremental learning model. The importance of each parameter in the incremental learning model is calculated based on the Fisher information matrix. The parameter importance constraint is established through the elastic weight consolidation technique, in which the update magnitude of important parameters is subject to stronger constraints, and the parameter importance matrix is obtained. Based on the parameter importance matrix, an elastic weight consolidation loss function is constructed. The loss of the new task is combined with the parameter importance regularization term. The retention of new and old knowledge is balanced by the regularization coefficient to obtain the optimization objective function. The incremental learning model is updated based on the optimization objective function, and the total loss is minimized by the gradient descent algorithm. While learning new knowledge, it retains the ability to remember historical production patterns, thus obtaining the trained prediction model.
6. The neural network-based nutrient composition regulation method of claim 1, wherein, The step involves constructing a model predictive control system based on the trained prediction model, and solving for the optimal control sequence using a sequence quadratic programming algorithm based on the prediction time domain and the control time domain to obtain a closed-loop regulation system for nutrient components, including: Based on the trained prediction model, a prediction function is constructed. The current system state and control variables are used as inputs. Through forward inference, the trajectory of nutrient changes in the future prediction time domain is predicted to obtain the nutrient prediction sequence. Based on the predicted nutrient composition sequence and the target nutrient composition values, an objective function is constructed. The sum of squared errors and the sum of squared control increments are then combined using a weighted matrix, where the error weight matrix determines the degree of penalty for nutrient composition deviations and the control weight matrix determines the degree of penalty for changes in control actions, thus obtaining the optimized objective function. Set upper and lower bound constraints for control variables, set maximum change range constraints for control increments, and set quality standard range constraints for output variables. Combine these constraints to form a set of inequality constraints, and obtain the constraint set. The optimization objective function and the set of constraints are combined to form a quadratic programming problem, which is then solved iteratively using a sequential quadratic programming algorithm. In each iteration, the nonlinear optimization problem is linearized and a quadratic subproblem is constructed to obtain the optimal control sequence in the future control time domain. The first control action is extracted from the optimal control sequence and executed. The control action is applied to the quick-frozen food processing system to adjust the temperature and humidity. In the next control cycle, the optimization calculation is re-performed to achieve rolling optimization and obtain a real-time control signal. Based on the real-time control signal, the processing parameters are adjusted in a closed loop. The control strategy is continuously corrected through a 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 regulation system.
7. A neural network-based nutrient composition regulation system, characterized by, For implementing the neural network-based nutrient component regulation method as described in any one of claims 1-6, the neural network-based nutrient component regulation system comprises: The data acquisition module is used to acquire and preprocess multi-source sensor data during the processing of frozen foods. It normalizes and segments temperature sequences, humidity sequences, nutrient sequences, and image feature sequences using a sliding window to obtain a structured time-series dataset. The input module is used to construct a deep recurrent neural network prediction model based on the structured time-series dataset. It inputs multi-source features into the encoder-decoder architecture neural network and fuses the features through an attention mechanism to obtain a nutrient composition prediction model. The training module is used to perform three-stage transfer learning training on the nutrient composition prediction model, including pre-training, domain adaptation and incremental learning, and optimize the model parameters through elastic weight consolidation technology to obtain the trained prediction model. The solution module is used to construct a model predictive control system based on the trained prediction model, and to solve for the optimal control sequence using a sequence quadratic programming algorithm based on the prediction time domain and the control time domain, thereby obtaining a closed-loop regulation system for nutrients.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that, When the computer program is run by the processor, it causes the processor to perform the neural network-based nutrient regulation method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
DRNN neural network-based eggplant greenhouse temperature intelligent detection device
CN110109193A
Food nutritional ingredient content prediction method and system based on cross-modal attention mechanism
CN114529790A