Food additive detection method and system based on Fourier transform infrared spectroscopy

By collecting Fourier transform infrared spectral data at different depths of food samples, and combining multi-task Gaussian process regression algorithm and Bayesian optimization method, the problem of poor robustness of food additive detection in the prior art is solved, and efficient and accurate detection of multiple additives is achieved.

CN119757266AInactive Publication Date: 2025-04-04CSSC HAISHEN MEDICAL TECH CO LTD

Patent Information

Application Number
CN202411871022.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-04
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing food additive detection methods have poor robustness, long detection time, high cost, complex operation and difficulty in detecting multiple additives at the same time.

Method used

The detection method based on Fourier transform infrared spectroscopy is adopted, and multiple sets of Fourier transform infrared spectral data are collected at different depths of food samples. Combined with external environmental parameters, multi-task Gaussian process regression algorithm and Bayesian optimization method are used for modeling and hyperparameter tuning, and the detection model is further fine-tuned through the recurrent neural network enhanced by the attention mechanism.

Benefits of technology

It improves the accuracy and robustness of the detection, can quickly and accurately detect a variety of food additives, reduces the cost and difficulty of testing, and enhances the generalization ability and adaptability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119757266A_ABST
    Figure CN119757266A_ABST
Patent Text Reader

Abstract

The invention provides a fourier transform infrared spectroscopy-based food additive detection method and a fourier transform infrared spectroscopy-based food additive detection system. Wherein a plurality of groups of Fourier transform infrared spectrum data are acquired at different depths of a food sample, external acquisition environment parameters are recorded, and comprehensive spectrum information is generated; based on the comprehensive spectral information, a multi-task Gaussian process regression algorithm is applied to carry out joint modeling and capture of shared information, and a Bayesian optimization method is adopted to carry out automatic optimization and generate optimized model parameters; based on the optimized model parameters, dynamically distributing attention weights by using an attention mechanism enhanced recurrent neural network, and performing fine tuning by adopting a transfer learning technology to generate a food additive detection model; on the basis of the food additive detection model, explanation and verification are carried out by integrating physicochemical properties, and a food additive detection scheme is generated. According to the technical scheme provided by the invention, the food additive detection accuracy and robustness are remarkably improved, and powerful technical support is provided for food safety supervision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of food safety technology, and in particular to a food additive detection method and system based on Fourier transform infrared spectroscopy. Background Art

[0002] As food safety issues have received increasing attention, food additive detection technology has become an important means to ensure food safety. In the food production and circulation process, it is necessary to be able to quickly and accurately detect the presence and content of food additives in order to promptly discover and deal with unqualified products; the detection method needs to be highly precise and able to accurately identify various additives in complex and changeable food samples, and maintain stable performance under different environmental conditions; in addition to detecting a single type of food additive, it is also necessary to be able to detect multiple additives at the same time and provide comprehensive test results to meet the needs of food safety supervision.

[0003] Existing methods for detecting food additives mainly include traditional chemical analysis methods and near-infrared spectroscopy technology. Although traditional chemical analysis methods such as high-performance liquid chromatography and gas chromatography have high precision and reliability, they usually require complex sample pre-treatment steps, long detection time, high cost, and complex operation. They have high requirements for equipment and environment, which increases the cost and difficulty of detection. Near-infrared spectroscopy technology has been widely used in food additive detection due to its non-destructive and rapid characteristics, but the analysis of near-infrared spectroscopy data depends on a large number of training samples and complex modeling processes. Especially when dealing with complex and diverse food samples, the generalization ability and robustness of the model are poor, and it is difficult to meet the needs of fast, accurate and comprehensive detection.

[0004] Traditional chemical analysis methods usually take a long time for sample pretreatment and analysis, which makes it difficult to meet the needs of rapid testing; many existing detection methods require professionals to operate, and have high requirements for equipment and environment, which increases the cost and difficulty of detection; the analysis of near-infrared spectral data often requires a large amount of labeled data and complex model construction, especially when dealing with complex and diverse food samples, the generalization ability and robustness of the model are poor; many existing methods can only detect specific types of food additives and cannot handle multiple additives at the same time, which limits their flexibility and comprehensiveness in practical applications. Summary of the invention

[0005] The embodiments of the present application provide a food additive detection method and system based on Fourier transform infrared spectroscopy to solve the problem of poor robustness in the prior art.

[0006] In a first aspect, the present application provides a method for detecting food additives based on Fourier transform infrared spectroscopy, comprising:

[0007] Collect multiple sets of Fourier transform infrared spectral data at different depths of food samples, record external collection environment parameters, and generate comprehensive spectral information;

[0008] Based on the comprehensive spectral information, a multi-task Gaussian process regression algorithm is used to perform joint modeling to capture the shared information between the spectral data of different food additives, and a Bayesian optimization method is used to automatically tune the hyperparameters to improve the prediction accuracy and robustness of the model and generate optimized model parameters;

[0009] Based on the optimized model parameters, a recurrent neural network enhanced by an attention mechanism is used to dynamically allocate attention weights at different time steps, capture long-term dependencies, and adopt transfer learning technology to perform fine-tuning for specific types of food additives to generate a food additive detection model;

[0010] Based on the food additive detection model, the physical and chemical properties of food samples are comprehensively considered, the test results are interpreted and verified, and a food additive detection plan is generated.

[0011] Optionally, based on the comprehensive spectral information, a multi-task Gaussian process regression algorithm is used to perform joint modeling, capture shared information between spectral data of different food additives, and automatically tune hyperparameters using a Bayesian optimization method to improve model prediction accuracy and robustness, and generate optimized model parameters, including:

[0012] Based on the comprehensive spectral information, collect and integrate spectral data of different food additives to generate a comprehensive database;

[0013] Based on the comprehensive database, a multi-task Gaussian process regression algorithm is used to perform joint modeling to capture the shared information and unique features between the spectral data of different food additives and generate a preliminary model for multi-data processing;

[0014] Based on the preliminary multi-data processing model, the Bayesian optimization method is used to automatically tune the hyperparameters, define the model performance measurement objective function, iteratively select hyperparameter combinations to update the objective function prior knowledge, efficiently search for the optimal hyperparameter combination, and generate optimized hyperparameter settings;

[0015] Based on the optimized hyperparameter settings, multiple trainings are performed to adjust and optimize, capture the inherent laws of food additive spectral data, and generate optimized model parameters.

[0016] Optionally, based on the comprehensive database, a multi-task Gaussian process regression algorithm is used to perform joint modeling, capture shared information and unique features between spectral data of different food additives, and generate a preliminary model for multi-data processing, including:

[0017] Based on the comprehensive database, data cleaning is performed to remove outliers and noise, increase the generalization ability of the model, and generate a consistent data set;

[0018] Based on the consistency data set, a multi-task Gaussian process regression algorithm is used to pre-set the kernel function for joint modeling, so as to capture the shared information and unique features between the spectral data of different food additives and generate a preliminary joint model;

[0019] Based on the preliminary joint model, a multi-task learning framework is set up to simultaneously learn the spectral features of multiple food additives, and the correlation between different tasks is used to improve the learning efficiency, so as to generate a multi-task learning framework model;

[0020] Based on the multi-task learning framework model, the generalization ability of the model for different food additive data is cross-validated, the model learning effect is visualized, and a preliminary model for multi-data processing is generated.

[0021] Optionally, based on the consistency data set, a multi-task Gaussian process regression algorithm is used to pre-set a kernel function for joint modeling, capture the shared information and unique features between the spectral data of different food additives, and generate a preliminary joint model, including:

[0022] Based on the consistent data set, standardization processing eliminates dimensional differences to improve convergence speed;

[0023] Feature selection is performed through correlation analysis to remove redundant and noisy features of the data set to generate kernel function values;

[0024] The kernel function value is calculated using the following formula:

[0025]

[0026] Among them, k(x i ,x j ) is the kernel function value; is the signal variance, representing the degree of fluctuation of the data; l is the length scale, controlling the decay speed of the similarity; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data; x i,d and x j,d are the values ​​of the i-th and j-th samples in the d-th dimension respectively; γ d is the characteristic scale of the dth dimension, which is used to adjust the importance of different dimensions; is the noise variance, indicating the measurement error; δ ij is the Kronecker delta function, which is 1 when i=j and 0 otherwise;

[0027] Based on the kernel function value, construct the covariance matrix between training data, solve the Gaussian process regression conditional distribution to obtain the statistical index of the prediction function, introduce the task correlation matrix to generate the prediction function;

[0028] The prediction function is calculated using the following formula:

[0029]

[0030] Where f(x) is the prediction function; i is the index of the training sample, from 1 to N; N is the number of training samples; α i is the weight coefficient of the i-th sample; k(x,x i ) is the kernel function value, which is used to measure the difference between the new sample x and the training sample x i The similarity between them; λ is an additional length scale used to adjust the smoothness of the prediction function; x d is the value of the new sample in the dth dimension; x i,d is the value of the ith training sample in the dth dimension; β is the bias term, which is used to adjust the baseline level of the predicted value; ω is the frequency parameter of the sine function, which is used to introduce periodic changes; η is the slope parameter of the logistic function, which is used to control the steepness of the logistic function; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data;

[0031] Based on the prediction function, the model hyperparameters are optimized by Bayesian optimization method, and a plurality of different Gaussian process regression models are integrated by weighted averaging to generate a preliminary joint model.

[0032] Optionally, based on the preliminary model for multi-data processing, a Bayesian optimization method is used to automatically tune hyperparameters, define a model performance measurement objective function, iteratively select hyperparameter combinations to update the objective function prior knowledge, efficiently search for the optimal hyperparameter combination, and generate optimized hyperparameter settings, including:

[0033] Based on the preliminary multi-data processing model, the prediction accuracy and robustness are comprehensively considered to define the objective function, measure the model performance under different hyperparameter combinations, and generate a performance evaluation standard;

[0034] Based on the performance evaluation criteria, a Bayesian optimization method is used to initialize the hyperparameter search space and the prior distribution, automatically tune the hyperparameters, and generate an initial selection of the hyperparameters;

[0035] Based on the initial selection of the hyperparameters, the preliminary multi-data processing model is trained, the model performance is evaluated using the objective function, and the feedback is fed back to the Bayesian optimization method to update the objective function prior knowledge and generate optimized prior knowledge;

[0036] Based on the optimized prior knowledge, new hyperparameter combinations are iteratively selected to efficiently explore the hyperparameter space, gradually approach the optimal hyperparameter combination, and generate optimized hyperparameter settings.

[0037] Optionally, based on the optimized model parameters, a recurrent neural network enhanced by an attention mechanism is used to dynamically allocate attention weights of different time steps, capture long-term dependencies, and adopt transfer learning technology to perform fine-tuning for specific types of food additives to generate a food additive detection model, including:

[0038] Based on the optimized model parameters, the recurrent neural network is configured, the number of network layers and activation functions are set, the basic network structure is generated to adapt to the characteristics of food additive spectral data;

[0039] Based on the basic network structure, the attention mechanism is introduced to build a recurrent neural network enhanced by the attention mechanism, dynamically allocate attention weights at different time steps, effectively capture the long-term dependency of time series data, and generate enhanced feature representation;

[0040] Based on the enhanced feature representation, transfer learning technology is used, combined with a small amount of annotated data of specific types of food additives, the last several layers are fine-tuned, most of the layers are frozen, and a transfer learning model is generated;

[0041] Based on the transfer learning model, detailed testing and verification are carried out to compare and evaluate the performance under different conditions to make necessary adjustments and optimizations to generate a food additive detection model.

[0042] Optionally, based on the basic network structure, an attention mechanism is introduced to construct a recurrent neural network enhanced with the attention mechanism, dynamically allocate attention weights of different time steps, effectively capture the long-term dependency of time series data, and generate enhanced feature representation, including:

[0043] Based on the basic network structure, an attention mechanism module is introduced to analyze the dynamic characteristics of the input data, calculate the attention weight of each time step, highlight important features, and generate an attention weight allocation scheme;

[0044] Based on the attention weight allocation scheme, a recurrent neural network enhanced with attention mechanism is constructed, and an enhanced network structure is generated by combining the attention mechanism module with the basic network structure;

[0045] Based on the enhanced network structure, the food additive spectral data is processed, and the attention weights of different time steps are dynamically adjusted through the attention mechanism to effectively capture the long-term dependencies in the time series data and generate dynamically adjusted feature representations;

[0046] Based on the dynamically adjusted feature representation, performance evaluation and optimization adjustment processing are performed to ensure accurate identification of different types of food additives and generate enhanced feature representation.

[0047] Optionally, based on the attention weight allocation scheme, a recurrent neural network enhanced with an attention mechanism is constructed, and an attention mechanism module is combined with a basic network structure to generate an enhanced network structure, including:

[0048] Based on the attention weight allocation scheme, the hidden state of the previous time step is initialized and concatenated with the input data into a joint feature vector;

[0049] Mapping to the new feature space through a nonlinear activation function to generate an unnormalized attention score;

[0050] The unnormalized attention score is calculated using the following formula:

[0051]

[0052] Among them, e t is the unnormalized attention score at the t-th time step; v a is the weight vector of attention score; W a is the weight matrix of attention score; h t-1 is the hidden state at the t-1th time step; x t is the input data of the tth time step; b a is the bias term of the attention score; w d is the period weight of the dth dimension; L is the period length; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data; t is the current time step;

[0053] Based on the unnormalized attention score, the softmax function is used to normalize it into an attention weight, which is applied to the hidden state of each time step, and a time step difference smoothing term is introduced to reduce the influence of long-distance time steps to generate a hidden state;

[0054] The hidden state is calculated using the following formula:

[0055]

[0056] Among them, h t is the hidden state at the tth time step; W h is the weight matrix of the hidden state; x t is the input data of the tth time step; α t' is the attention weight of the t'th time step; h t'-1 is the hidden state of the t'-1th time step; σ is the smoothing parameter of the time step difference; b h is the bias term of the hidden state; w' d is the cycle weight of the dth dimension; L is the cycle length; β d is the Gaussian kernel weight of the dth dimension; μd is the mean of the dth dimension; σ d is the standard deviation of the dth dimension; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data; t is the current time step; t' is the time step, which is used to calculate the mutual influence between the hidden states of different time steps;

[0057] Based on the hidden state, the local features of different dimensions of the input data are captured by the Gaussian kernel function, the model performance is evaluated using cross-validation to optimize the hyperparameters, and multiple recurrent neural network models enhanced by different attention mechanisms are integrated to generate an enhanced network structure.

[0058] Optionally, based on the food additive detection model, the physical and chemical properties of the food sample are comprehensively considered, the detection results are interpreted and verified, and a food additive detection scheme is generated, including:

[0059] Based on the food additive detection model, predicting the Fourier transform infrared spectroscopy data of the food sample to generate a preliminary prediction of the food additive;

[0060] Based on the preliminary prediction of food additives, the physical and chemical properties of food samples are comprehensively considered to interpret the test results, ensure that the test results are reasonable and reliable, and generate a food additive prediction interpretation;

[0061] Based on the food additive prediction interpretation, by comparing the test results with known historical data, verify the accuracy of the test results, identify and correct potential errors, and generate a test result verification report;

[0062] Based on the test result verification report, the types of additives in food samples are evaluated in detail, and a food additive testing plan is generated in combination with potential food safety impacts.

[0063] In a second aspect, the present application provides a food additive detection system based on Fourier transform infrared spectroscopy, comprising:

[0064] The acquisition module is used to collect multiple sets of Fourier transform infrared spectral data at different depths of food samples, record external acquisition environment parameters, and generate comprehensive spectral information;

[0065] A generation module is used to perform joint modeling based on the comprehensive spectral information using a multi-task Gaussian process regression algorithm to capture shared information between spectral data of different food additives, automatically tune hyperparameters using a Bayesian optimization method, improve model prediction accuracy and robustness, and generate optimized model parameters;

[0066] An allocation module is used to dynamically allocate attention weights of different time steps based on the optimized model parameters, using a recurrent neural network enhanced by an attention mechanism, capturing long-term dependencies, and using transfer learning technology to perform fine-tuning for specific types of food additives to generate a food additive detection model;

[0067] The verification module is used to interpret and verify the test results based on the food additive detection model and to generate a food additive detection plan by comprehensively considering the physical and chemical properties of the food samples.

[0068] In an embodiment of the present application, multiple groups of Fourier transform infrared spectral data are collected at different depths of food samples, and external collection environment parameters are recorded to generate comprehensive spectral information; based on the comprehensive spectral information, a multi-task Gaussian process regression algorithm is used to perform joint modeling to capture shared information between spectral data of different food additives, and a Bayesian optimization method is used to automatically tune hyperparameters to improve model prediction accuracy and robustness, and generate optimized model parameters; based on the optimized model parameters, a recurrent neural network enhanced by an attention mechanism is used to dynamically allocate attention weights for different time steps to capture long-term dependencies, and transfer learning technology is used to fine-tune specific types of food additives to generate a food additive detection model; based on the food additive detection model, the physicochemical properties of food samples are comprehensively considered, the detection results are interpreted and verified, and a food additive detection scheme is generated.

[0069] The technical solution of this application has the following beneficial effects:

[0070] By collecting multiple sets of Fourier transform infrared spectral data at different depths of food samples and recording external collection environment parameters, comprehensive spectral information can be generated, which helps to more accurately capture the characteristics of food additives and improve the accuracy of detection; the use of multi-task Gaussian process regression algorithm for joint modeling can effectively capture the shared information between spectral data of different food additives. The Bayesian optimization method is combined to automatically tune the hyperparameters, which further improves the prediction accuracy and robustness of the model and ensures the stable performance of the model under different conditions; based on the optimized model parameters, the attention weights of different time steps are dynamically allocated using the recurrent neural network enhanced by the attention mechanism, which can effectively capture the long-term dependencies in time series data. This mechanism enables the model to better handle complex spectral data and improve the reliability of detection results; the transfer learning technology is used to fine-tune specific types of food additives, so that the model can quickly adapt to new detection tasks, reduce training time and data requirements, while maintaining high detection accuracy; based on the generated food additive detection model, the physical and chemical properties of food samples are comprehensively considered, and the detection results are interpreted and verified to ensure the scientificity and reliability of the detection scheme.

[0071] Furthermore, by collecting and integrating the spectral data of different food additives and generating a comprehensive database, it is possible to fully utilize the information of multiple data sources and improve the generalization ability of the model. The multi-task Gaussian process regression algorithm is used for joint modeling, which can effectively capture the shared information and unique features between the spectral data of different food additives, thereby improving the model's understanding of complex spectral data. The Bayesian optimization method is used to automatically tune the hyperparameters, define the model performance measurement objective function, and update the prior knowledge of the objective function by iteratively selecting hyperparameter combinations, efficiently search for the optimal hyperparameter combination, and adjust and optimize through multiple trainings, which can better capture the inherent laws of food additive spectral data, generate optimized model parameters, and improve the prediction accuracy and robustness of the model. Through multi-task learning and hyperparameter optimization, the generated optimized model parameters can significantly improve the prediction accuracy and robustness of the model, ensure stable performance under different conditions, reduce the workload of manual parameter adjustment, improve the efficiency of model development, and at the same time ensure the reliability and accuracy of the model in practical applications.

[0072] Furthermore, by introducing the attention mechanism and constructing a recurrent neural network enhanced by the attention mechanism, the attention weights of different time steps can be dynamically allocated, the long-term dependencies in time series data can be effectively captured, and the model's processing ability for complex spectral data can be improved. The attention mechanism enables the model to highlight important features and generate enhanced feature representations, thereby improving the accuracy and reliability of the detection results. By adopting transfer learning technology, combined with a small amount of labeled data of a specific type of food additives, the last few layers are fine-tuned, most of the layers are frozen, and a transfer learning model is generated, which can quickly adapt to new detection tasks, reduce training time and data requirements, and maintain high detection accuracy. Through transfer learning, the model can use existing knowledge and experience to accelerate the learning process of new tasks, improve the generalization ability and adaptability of the model, and carry out detailed testing and verification based on the transfer learning model to ensure the stability and reliability of the model in various practical application scenarios, and improve the credibility and practicality of the detection results.

[0073] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0075] Figure 1A flowchart of a food additive detection method based on Fourier transform infrared spectroscopy provided in an embodiment of the present application;

[0076] Figure 2 A schematic diagram of the structure of a food additive detection system based on Fourier transform infrared spectroscopy provided in an embodiment of the present application;

[0077] Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0078] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0079] In some of the processes described in the specification and claims of this application and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.

[0080] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0081] Figure 1 A flowchart of a food additive detection method based on Fourier transform infrared spectroscopy is provided for the embodiment of the present application, such as Figure 1 As shown, the method includes:

[0082] 101. Collect multiple sets of Fourier transform infrared spectral data at different depths of food samples, record external collection environment parameters, and generate comprehensive spectral information;

[0083] Fourier transform infrared spectroscopy is an analytical technique that determines the chemical composition of a sample by measuring the infrared absorption spectrum of the sample at different wavelengths, including the infrared absorption spectrum data of the sample at different depths, which is used to identify and quantitatively analyze various additives in food.

[0084] External acquisition environment parameters include temperature, humidity, lighting conditions, etc. Recording these parameters helps ensure the consistency and repeatability of spectral data.

[0085] Comprehensive spectral information is a data set containing multi-dimensional information generated by collecting multiple sets of Fourier transform infrared spectral data and combining them with external environmental parameters, which is used for subsequent analysis and modeling.

[0086] In the embodiments of the present application, first, a suitable food sample is selected and sampling points are determined, and different depths of the sample need to be covered to ensure that comprehensive spectral information is obtained; second, a Fourier transform infrared spectrometer is used to collect spectral data for each sampling point, and this needs to be done in a well-controlled environment to reduce the impact of external factors on the spectral data; third, the external environmental parameters such as temperature, humidity and light conditions are recorded at each collection for subsequent data processing and analysis; finally, all the collected spectral data and the corresponding external environmental parameters are integrated together to generate comprehensive spectral information as the basis for subsequent analysis and for building an efficient detection model.

[0087] Suppose you need to test the content of sodium benzoate, a common food additive, in a certain fruit juice drink;

[0088] First, select an unopened bottle of fruit juice as a sample and determine the sampling points, such as taking a sample at the mouth, middle and bottom of the bottle. Use a Fourier transform infrared spectrometer to collect spectral data of the samples at the mouth, middle and bottom of the bottle respectively. During each collection process, record the current temperature (e.g., 25°C), humidity (e.g., 40%) and lighting conditions (e.g., laboratory standard lighting); secondly, record the spectral data and corresponding environmental parameters of each sampling point, integrate all the data, and generate a data set containing information in multiple dimensions; thirdly, organize the above data set into a structured format to facilitate subsequent analysis and modeling; finally, the generated comprehensive spectral information will contain the spectral data of each sampling point and its corresponding external environmental parameters, providing basic data support for the subsequent multi-task Gaussian process regression algorithm and attention mechanism enhanced recurrent neural network.

[0089] Through the above steps, comprehensive and detailed spectral information can be generated, providing a reliable data basis for subsequent food additive testing.

[0090] 102. Based on the comprehensive spectral information, a multi-task Gaussian process regression algorithm is used to perform joint modeling, capture the shared information between the spectral data of different food additives, and automatically tune the hyperparameters using the Bayesian optimization method to improve the prediction accuracy and robustness of the model and generate optimized model parameters;

[0091] The multi-task Gaussian process regression algorithm is a machine learning method used to handle regression problems of multiple related tasks. It improves the generalization ability and prediction accuracy of the model by capturing shared information and unique features between different tasks.

[0092] The Bayesian optimization method is a global optimization method that automatically searches for the optimal hyperparameter combination to improve model performance by constructing a probability model of the objective function (usually a Gaussian process).

[0093] The optimized model parameters are a set of optimal hyperparameter settings generated after Bayesian optimization, which can make the model achieve the best in terms of prediction accuracy and robustness.

[0094] In this step, first, based on comprehensive spectral information, the spectral data of different food additives are collected and integrated to generate a comprehensive database; secondly, the multi-task Gaussian process regression algorithm is used to jointly model the comprehensive database to capture the shared information and unique features between the spectral data of different food additives, and generate a preliminary multi-data processing model; thirdly, the Bayesian optimization method is used to define the objective function for measuring model performance, and the prior knowledge of the objective function is updated by iteratively selecting different hyperparameter combinations to efficiently search for the optimal hyperparameter combination; finally, based on the optimal hyperparameter settings found, multiple trainings are performed to adjust and optimize the model to ensure that the model can accurately capture the inherent laws of the spectral data of food additives and generate optimized model parameters.

[0095] Optionally, the method in step 102 is based on the comprehensive spectral information and uses a multi-task Gaussian process regression algorithm to perform joint modeling, capture shared information between spectral data of different food additives, and automatically tune hyperparameters using a Bayesian optimization method to improve model prediction accuracy and robustness, and generate optimized model parameters, including: based on the comprehensive spectral information, collecting and integrating spectral data of different food additives to generate a comprehensive database; based on the comprehensive database, using a multi-task Gaussian process regression algorithm to perform joint modeling, capture shared information and unique features between spectral data of different food additives, and generate a preliminary model for multi-data processing; based on the preliminary model for multi-data processing, using a Bayesian optimization method to automatically tune hyperparameters, define a model performance measurement objective function, iteratively select hyperparameter combinations to update the prior knowledge of the objective function, efficiently search for the optimal hyperparameter combination, and generate optimized hyperparameter settings; based on the optimized hyperparameter settings, perform multiple trainings to adjust and optimize, capture the inherent laws of food additive spectral data, and generate optimized model parameters.

[0096] Among them, based on the comprehensive database, a multi-task Gaussian process regression algorithm is used to perform joint modeling, capture the shared information and unique features between the spectral data of different food additives, and generate a preliminary model for multi-data processing, including: based on the comprehensive database, data cleaning is performed to remove outliers and noise, increase the generalization ability of the model, and generate a consistent data set; based on the consistent data set, a multi-task Gaussian process regression algorithm is used, and a kernel function is pre-set to perform joint modeling, capture the shared information and unique features between the spectral data of different food additives, and generate a preliminary joint model; based on the preliminary joint model, a multi-task learning framework is set to simultaneously learn the spectral features of multiple food additives, and the correlation between different tasks is used to improve the learning efficiency, and a multi-task learning framework model is generated; based on the multi-task learning framework model, the generalization ability of the model for different food additive data is cross-validated, the model learning effect is visually displayed, and a preliminary model for multi-data processing is generated.

[0097] The multi-task Gaussian process regression algorithm is a machine learning method used to handle regression problems of multiple related tasks. It improves the generalization ability and prediction accuracy of the model by capturing shared information and unique features between different tasks.

[0098] The Bayesian optimization method is a global optimization method that automatically searches for the optimal hyperparameter combination to improve model performance by constructing a probability model of the objective function (usually a Gaussian process).

[0099] The optimized model parameters are a set of optimal hyperparameter settings generated after Bayesian optimization, which can make the model achieve the best in terms of prediction accuracy and robustness.

[0100] Data cleaning ensures the consistency and reliability of the data set by removing outliers and noise.

[0101] The kernel function is a function used to measure the similarity between input data in the Gaussian process and is a key part of joint modeling.

[0102] The multi-task learning framework is a machine learning method that improves learning efficiency by learning multiple related tasks at the same time and utilizing the correlation between tasks.

[0103] In the embodiments of the present application, first, based on comprehensive spectral information, spectral data of different food additives are collected and integrated to generate a comprehensive database; secondly, data cleaning is performed to remove outliers and noise, increase the generalization ability of the model, and generate a consistent data set; thirdly, a multi-task Gaussian process regression algorithm is used, and a kernel function is pre-set for joint modeling to capture the shared information and unique features between the spectral data of different food additives, and generate a preliminary joint model; a multi-task learning framework is continued to be set to simultaneously learn the spectral features of multiple food additives, and the learning efficiency is improved by using the correlation between different tasks to generate a multi-task learning framework model; then the generalization ability of the model for different food additive data is cross-validated, the model learning effect is visualized, and a preliminary model for multi-data processing is generated; finally, a Bayesian optimization method is used to define a model performance measurement objective function, iteratively select hyperparameter combinations to update the prior knowledge of the objective function, efficiently search for the optimal hyperparameter combination, generate an optimized hyperparameter setting, and perform multiple trainings based on the optimized hyperparameter setting to adjust and optimize, capture the inherent laws of the food additive spectral data, and generate optimized model parameters.

[0104] Suppose you need to test the content of several common food additives (such as sodium benzoate, potassium sorbate and citric acid) in different food samples;

[0105] First, multiple sets of Fourier transform infrared spectral data are collected from different depths of different food samples, and external environmental parameters (such as temperature, humidity, etc.) are recorded to generate comprehensive spectral information; secondly, these spectral data are integrated to form a comprehensive database; thirdly, the comprehensive database is cleaned to remove outliers and noise to generate a consistent data set; then, a multi-task Gaussian process regression algorithm is used to pre-set a suitable kernel function (such as RBF kernel) for joint modeling to capture the shared information and unique features between the spectral data of different food additives and generate a preliminary joint model; continue to set up a multi-task learning framework to learn sodium benzoate at the same time. , potassium sorbate and citric acid, and used the correlation between tasks to improve learning efficiency and generate a multi-task learning framework model. Then, cross-validation was used to evaluate the generalization ability of the model on different food additive data, and the learning effect of the model was visualized to generate a preliminary model for multi-data processing. Finally, the Bayesian optimization method was used to define the objective function for measuring model performance, iteratively select hyperparameter combinations to update the prior knowledge of the objective function, efficiently search for the optimal hyperparameter combination, generate optimized hyperparameter settings, and perform multiple trainings based on the optimized hyperparameter settings to adjust and optimize, capture the inherent laws of food additive spectral data, and generate optimized model parameters.

[0106] Through the above steps, an optimized multi-task Gaussian process regression model can be generated, which can accurately detect the content of various food additives with high prediction accuracy and robustness.

[0107] This application takes into account that in the multi-task Gaussian process regression algorithm, the kernel function is used to measure the similarity between input data and is a key part of building the model. By pre-setting the kernel function for joint modeling, a task correlation matrix is ​​introduced to improve the generalization ability and prediction accuracy of the model, and the Bayesian optimization method is used to automatically tune the model hyperparameters to further improve the model performance.

[0108] Optionally, based on the consistency data set, a multi-task Gaussian process regression algorithm is used to pre-set a kernel function for joint modeling, capture the shared information and unique features between the spectral data of different food additives, and generate a preliminary joint model, including:

[0109] Based on the consistent data set, standardization processing eliminates dimensional differences to improve convergence speed;

[0110] Feature selection is performed through correlation analysis to remove redundant and noisy features of the data set to generate kernel function values;

[0111] The kernel function value is calculated using the following formula:

[0112]

[0113] Among them, k(x i ,x j ) is the kernel function value; is the signal variance, representing the degree of fluctuation of the data; l is the length scale, controlling the decay speed of the similarity; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data; x i,d and x j,d are the values ​​of the i-th and j-th samples in the d-th dimension respectively; γ d is the characteristic scale of the dth dimension, which is used to adjust the importance of different dimensions; is the noise variance, indicating the measurement error; δ ij is the Kronecker delta function, which is 1 when i=j and 0 otherwise;

[0114] Based on the kernel function value, construct the covariance matrix between training data, solve the Gaussian process regression conditional distribution to obtain the statistical index of the prediction function, introduce the task correlation matrix to generate the prediction function;

[0115] The prediction function is calculated using the following formula:

[0116]

[0117] Where f(x) is the prediction function; i is the index of the training sample, from 1 to N; N is the number of training samples; α i is the weight coefficient of the i-th sample; k(x,x i) is the kernel function value, which is used to measure the difference between the new sample x and the training sample x i The similarity between them; λ is an additional length scale used to adjust the smoothness of the prediction function; x d is the value of the new sample in the dth dimension; x i,d is the value of the ith training sample in the dth dimension; β is the bias term, which is used to adjust the baseline level of the predicted value; ω is the frequency parameter of the sine function, which is used to introduce periodic changes; η is the slope parameter of the logistic function, which is used to control the steepness of the logistic function; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data;

[0118] Based on the prediction function, the model hyperparameters are optimized by Bayesian optimization method, and a plurality of different Gaussian process regression models are integrated by weighted averaging to generate a preliminary joint model.

[0119] This method aims to capture the similarities between input data through the design of kernel functions and prediction functions, introduce additional smooth terms, periodic terms and nonlinear terms, improve the generalization and robustness of the model, enable the model to better adapt to different types of data, and provide more accurate prediction results.

[0120] In the kernel function value, the signal variance and the smoothing term Represents the degree of fluctuation of the data and controls the amplitude of the output; the length scale l controls the decay speed of the similarity and affects the smoothness of the kernel function; the characteristic scale γ d Adjust the importance of different dimensions to enhance the impact of key features; Noise variance Represents the measurement error and ensures the robustness of the model to noise;

[0121] in, It is estimated from the data by maximum likelihood estimation or cross-validation method; l is automatically tuned by Bayesian optimization method; γ d Determined through correlation analysis and feature selection; Estimated by minimizing the prediction error; δ ij is fixed, it is 1 when i=j, otherwise it is 0; x i,d and x j,d The value of the training sample in the dth dimension extracted from the actual spectral data;

[0122] In the prediction function, the weight coefficient is related to the similarity α i k(x,x i ): The weight of each sample and its similarity with the new sample, reflecting its contribution to the prediction result; additional smoothing term Adjust the smoothness of the prediction function to control local changes; periodic terms Introducing periodic changes to enhance the model's ability to capture periodic features; nonlinear terms Control the steepness of the logistic function and enhance the model's ability to capture nonlinear relationships; Deviation term β: adjusts the baseline level of the predicted value to ensure the stability of the predicted results;

[0123] Among them, α i It is obtained by solving the Gaussian process regression conditional distribution; λ is automatically tuned by the Bayesian optimization method; β is estimated by minimizing the prediction error; ω is set by frequency domain analysis or experience; η is automatically tuned by the Bayesian optimization method; x d The value of the new sample extracted from the new spectral data in the dth dimension; x i,d The value of the training sample in the dth dimension extracted from the actual spectral data; k(x,x i ) is calculated by a preset kernel function formula;

[0124] Suppose researchers need to test the potassium sorbate content in an energy drink;

[0125] Assumptions l=0.1,γ1=0.5, α i =0.02,λ=0.2,β=0.05,ω=0.1,η=10; Assume there are 3 training samples x1,x2,x3 and a new sample x, each sample is in a 1-dimensional feature space, the sample value is x1=[1.0],x2=[1.5],x3=[2.0];x=[1.2];

[0126]

[0127] Assuming that the threshold is set to 0.05, since the final calculation result 0.058 is greater than the set threshold 0.05, it shows that through the design of the above kernel function and prediction function, the model can effectively capture the features in the spectral data, and optimize the hyperparameters through the Bayesian optimization method to improve the prediction accuracy of the model. When the prediction result exceeds the set threshold, it can be considered that the functional beverage sample contains a higher concentration of potassium sorbate. Through the above steps, an efficient multi-task Gaussian process regression model can be generated, which can not only accurately identify potassium sorbate, but also has high generalization ability and robustness, and can provide reliable detection results in practical applications.

[0128] Optionally, based on the preliminary model for multi-data processing, a Bayesian optimization method is used to automatically tune hyperparameters, define a model performance measurement objective function, iteratively select hyperparameter combinations to update the objective function prior knowledge, efficiently search for the optimal hyperparameter combination, and generate optimized hyperparameter settings, including: based on the preliminary model for multi-data processing, comprehensively consider prediction accuracy and robustness to define the objective function, measure model performance under different hyperparameter combinations, and generate performance evaluation criteria; based on the performance evaluation criteria, a Bayesian optimization method is used to initialize the hyperparameter search space and prior distribution, automatically tune the hyperparameters, and generate an initial selection of hyperparameters; based on the initial selection of hyperparameters, the preliminary model for multi-data processing is trained, the objective function is used to evaluate model performance, and feedback is given to the Bayesian optimization method to update the objective function prior knowledge and generate optimized prior knowledge; based on the optimized prior knowledge, new hyperparameter combinations are iteratively selected to efficiently explore the hyperparameter space, gradually approach the optimal hyperparameter combination, and generate optimized hyperparameter settings.

[0129] The Bayesian optimization method is a global optimization method that automatically searches for the optimal hyperparameter combination to improve model performance by constructing a probability model of the objective function (usually a Gaussian process).

[0130] The objective function is an indicator to measure the performance of the model, usually including prediction accuracy and robustness.

[0131] Hyperparameters are parameters that need to be set in advance in machine learning models, such as learning rate, regularization coefficient, etc. These parameters affect the training process and final performance of the model.

[0132] The prior distribution is the initial hypothesis distribution of hyperparameters in Bayesian optimization, which is used to guide the search process.

[0133] The optimized hyperparameter settings are a set of optimal hyperparameter settings generated after Bayesian optimization, which can make the model achieve the best in terms of prediction accuracy and robustness.

[0134] In the embodiments of the present application, first, based on the preliminary model of multi-data processing, the prediction accuracy and robustness are comprehensively considered to define the objective function, the model performance under different hyperparameter combinations is measured, and a performance evaluation standard is generated; secondly, based on the performance evaluation standard, the Bayesian optimization method is used to initialize the hyperparameter search space and the prior distribution, the hyperparameters are automatically tuned, and the initial selection of the hyperparameters is generated; thirdly, based on the initial selection of the hyperparameters, the preliminary model of multi-data processing is trained, the objective function is used to evaluate the model performance, and feedback is given to the Bayesian optimization method to update the objective function prior knowledge and generate optimized prior knowledge; finally, based on the optimized prior knowledge, new hyperparameter combinations are iteratively selected to efficiently explore the hyperparameter space, gradually approach the optimal hyperparameter combination, and generate optimized hyperparameter settings.

[0135] Suppose you need to optimize the hyperparameters of a multi-task Gaussian process regression model to improve its performance in detecting food additives;

[0136] First, based on the preliminary model of multi-data processing, an objective function is defined by comprehensively considering the prediction accuracy (such as mean square error) and robustness (such as the consistency of the model's performance on different data sets). The objective function is used to measure the model performance under different hyperparameter combinations and generate a performance evaluation standard. Secondly, based on the performance evaluation standard, the Bayesian optimization method is used to initialize the hyperparameter search space (such as the learning rate range, the kernel function parameter range, etc.) and the prior distribution (such as the Gaussian distribution), and the hyperparameters are automatically tuned to generate a set of initial hyperparameter selections. Thirdly, based on this set of initial hyperparameter selections, the preliminary model of multi-data processing is trained, and the model performance is evaluated using the objective function. The evaluation results are fed back to the Bayesian optimization method, the prior knowledge of the objective function is updated, and the optimized prior knowledge is generated. Finally, based on the optimized prior knowledge, new hyperparameter combinations are iteratively selected to efficiently explore the hyperparameter space, gradually approach the optimal hyperparameter combination, and generate optimized hyperparameter settings.

[0137] Through the above steps, a set of optimized hyperparameter settings can be generated, so that the multi-task Gaussian process regression model achieves the best prediction accuracy and robustness, thereby improving the accuracy and reliability of food additive detection.

[0138] 103. Based on the optimized model parameters, a recurrent neural network enhanced by an attention mechanism is used to dynamically allocate attention weights at different time steps, capture long-term dependencies, and use transfer learning technology to fine-tune specific types of food additives to generate a food additive detection model;

[0139] The attention-enhanced recurrent neural network is a recurrent neural network combined with an attention mechanism, which can dynamically assign attention weights to different time steps and effectively capture long-term dependencies in time series data.

[0140] Transfer learning technology is a machine learning method that quickly adapts to new tasks or data sets by leveraging the knowledge and experience of existing models, reducing training time and data requirements.

[0141] The food additive detection model is the final generated model, which can accurately detect specific types of food additives.

[0142] In this step, first, based on the optimized model parameters, the basic structure of the recurrent neural network is configured, including setting the number of network layers, activation functions, etc., to adapt to the characteristics of food additive spectral data; secondly, the attention mechanism is introduced to construct a recurrent neural network enhanced by the attention mechanism, and the long-term dependencies in the time series data are effectively captured by dynamically allocating attention weights at different time steps to generate enhanced feature representations; thirdly, the transfer learning technology is used, combined with a small amount of labeled data of a specific type of food additives, to fine-tune the last few layers of the model, while freezing most of the layers to generate a transfer learning model; finally, the transfer learning model is tested and verified in detail, the performance under different conditions is compared and evaluated, and necessary adjustments and optimizations are made to generate the final food additive detection model.

[0143] Optionally, the method in step 103 uses a recurrent neural network enhanced by an attention mechanism based on the optimized model parameters, dynamically allocates attention weights for different time steps, captures long-term dependencies, and adopts transfer learning technology to fine-tune specific types of food additives to generate a food additive detection model, including: configuring the recurrent neural network based on the optimized model parameters, setting the number of network layers and activation functions, adapting to the characteristics of food additive spectral data, and generating a basic network structure; based on the basic network structure, introducing an attention mechanism, constructing a recurrent neural network enhanced by an attention mechanism, dynamically allocating attention weights for different time steps, effectively capturing long-term dependencies of time series data, and generating enhanced feature representation; based on the enhanced feature representation, adopting transfer learning technology, combined with a small amount of specific type of food additive annotation data, fine-tuning the last few layers, freezing most of the layers, and generating a transfer learning model; based on the transfer learning model, conducting detailed testing and verification, comparing and evaluating the performance under different conditions to make necessary adjustments and optimizations, and generating a food additive detection model.

[0144] Among them, based on the basic network structure, the attention mechanism is introduced, a recurrent neural network enhanced with the attention mechanism is constructed, the attention weights of different time steps are dynamically allocated, the long-term dependencies of time series data are effectively captured, and an enhanced feature representation is generated, including: based on the basic network structure, an attention mechanism module is introduced, the dynamic characteristics of the input data are analyzed, the attention weight of each time step is calculated, important features are highlighted, and an attention weight allocation scheme is generated; based on the attention weight allocation scheme, a recurrent neural network enhanced with the attention mechanism is constructed, and the attention mechanism module is combined with the basic network structure to generate an enhanced network structure; based on the enhanced network structure, the spectral data of food additives are processed, and the attention weights of different time steps are dynamically adjusted through the attention mechanism to effectively capture the long-term dependencies in the time series data and generate a dynamically adjusted feature representation; based on the dynamically adjusted feature representation, performance evaluation and optimization adjustment processing are performed to ensure accurate identification of different types of food additives and generate an enhanced feature representation.

[0145] The attention mechanism is a method to enhance neural networks. It highlights important features by dynamically assigning attention weights to different time steps and effectively captures long-term dependencies in time series data.

[0146] A recurrent neural network is a type of neural network suitable for processing sequence data and can capture dependencies in time series.

[0147] Transfer learning technology is a machine learning method that uses the knowledge and experience of existing models to quickly adapt to new tasks or data sets, reducing training time and data requirements.

[0148] The optimized model parameters are a set of optimal hyperparameter settings generated after Bayesian optimization, which can make the model achieve the best in terms of prediction accuracy and robustness.

[0149] Enhanced feature representation is a richer and more representative feature representation generated by introducing an attention mechanism, which helps to improve the performance of the model.

[0150] In the embodiment of the present application, first, based on the optimized model parameters, the recurrent neural network is configured, the number of network layers and the activation function are set to adapt to the characteristics of the food additive spectral data, and the basic network structure is generated; secondly, based on the basic network structure, the attention mechanism module is introduced to analyze the dynamic characteristics of the input data, the attention weight of each time step is calculated, the important features are highlighted, and the attention weight allocation scheme is generated; thirdly, based on the attention weight allocation scheme, a recurrent neural network enhanced by the attention mechanism is constructed, and the enhanced network structure is generated by combining the attention mechanism module with the basic network structure; then, based on the enhanced network structure, the food additive spectral data is processed, and the attention weights of different time steps are dynamically adjusted through the attention mechanism to effectively capture the long-term dependencies in the time series data and generate a dynamically adjusted feature representation; then, based on the dynamically adjusted feature representation, performance evaluation and optimization adjustment processing are performed to ensure accurate identification of different types of food additives and generate an enhanced feature representation; finally, based on the enhanced feature representation, the transfer learning technology is adopted, combined with a small amount of specific type of food additive annotation data, the last several layers are fine-tuned, most of the layers are frozen, a transfer learning model is generated, and detailed testing and verification are performed, and the performance under different conditions is compared and evaluated to make necessary adjustments and optimizations to generate a food additive detection model.

[0151] Suppose an experimenter wants to build a food additive detection model for detecting sodium benzoate;

[0152] Firstly, based on the optimized model parameters, the recurrent neural network is configured, and three layers of long short-term memory network units are set, with 128 hidden units in each layer, and the ReLU activation function is used to generate the basic network structure. Secondly, based on the basic network structure, the attention mechanism module is introduced to analyze the dynamic characteristics of the input data, calculate the attention weight of each time step, highlight the important features, and generate the attention weight allocation scheme. Thirdly, based on the attention weight allocation scheme, a recurrent neural network enhanced with the attention mechanism is constructed, and the enhanced network structure is generated by combining the attention mechanism module with the basic network structure. Then, based on the enhanced network structure, the spectral data of food additives are processed. The attention weights of different time steps are dynamically adjusted through the attention mechanism to effectively capture the long-term dependencies in the time series data and generate dynamically adjusted feature representations. Then, based on the dynamically adjusted feature representations, performance evaluation and optimization adjustment are performed to ensure accurate identification of different types of food additives and generate enhanced feature representations. Finally, based on the enhanced feature representations, transfer learning technology is used, combined with a small amount of labeled data of sodium benzoate, to fine-tune the last two layers of long short-term memory network units, freeze the previous network layers, generate a transfer learning model, and conduct detailed testing and verification. The performance under different conditions is compared and evaluated to make necessary adjustments and optimizations to generate the final food additive detection model.

[0153] Through the above steps, an efficient food additive detection model can be generated, which can not only accurately identify sodium benzoate, but also has high generalization ability and robustness, and can provide reliable detection results in practical applications.

[0154] This application takes into account that in a recurrent neural network enhanced by an attention mechanism, by introducing an attention weight distribution scheme, the long-term dependencies in time series data can be effectively captured, while introducing periodicity and local feature capture capabilities to generate more powerful feature representations. The Gaussian kernel function further enhances the model's ability to capture local features, optimizes hyperparameters through cross-validation, and integrates multiple models to improve overall performance.

[0155] Optionally, based on the attention weight allocation scheme, a recurrent neural network enhanced with an attention mechanism is constructed, and an attention mechanism module is combined with a basic network structure to generate an enhanced network structure, including:

[0156] Based on the attention weight allocation scheme, the hidden state of the previous time step is initialized and concatenated with the input data into a joint feature vector;

[0157] Mapping to the new feature space through a nonlinear activation function to generate an unnormalized attention score;

[0158] The unnormalized attention score is calculated using the following formula:

[0159]

[0160] Among them, e t is the unnormalized attention score at the t-th time step; v a is the weight vector of attention score; W a is the weight matrix of attention score; h t-1 is the hidden state at the t-1th time step; x t is the input data of the tth time step; b a is the bias term of the attention score; w d is the period weight of the dth dimension; L is the period length; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data; t is the current time step;

[0161] Based on the unnormalized attention score, the softmax function is used to normalize it into an attention weight, which is applied to the hidden state of each time step, and a time step difference smoothing term is introduced to reduce the influence of long-distance time steps to generate a hidden state;

[0162] The hidden state is calculated using the following formula:

[0163]

[0164] Among them, h t is the hidden state at the tth time step; W h is the weight matrix of the hidden state; x t is the input data of the tth time step; α t' is the attention weight of the t'th time step; h t'-1 is the hidden state of the t'-1th time step; σ is the smoothing parameter of the time step difference; b h is the bias term of the hidden state; w' d is the cycle weight of the dth dimension; L is the cycle length; β d is the Gaussian kernel weight of the dth dimension; μ d is the mean of the dth dimension; σ d is the standard deviation of the dth dimension; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data; t is the current time step; t' is the time step, which is used to calculate the mutual influence between the hidden states of different time steps;

[0165] Based on the hidden state, the local features of different dimensions of the input data are captured by the Gaussian kernel function, the model performance is evaluated using cross-validation to optimize the hyperparameters, and multiple recurrent neural network models enhanced by different attention mechanisms are integrated to generate an enhanced network structure.

[0166] This method aims to enhance the recurrent neural network through the attention mechanism and Gaussian kernel function, improve the model's ability to capture long-term dependencies and local features in time series data, and thus improve the model's prediction accuracy and robustness.

[0167] In the unnormalized attention score, the weight vector of the attention score is related to the nonlinear activation function part By replacing the hidden state h of the previous time step t-1 and the input data x at the current time step t spliced ​​into a joint feature vector and mapped to the new feature space through the nonlinear activation function tanh, the weight vector v a and the weight matrix W a and the bias term b a Used to calculate the importance of each time step, so as to dynamically assign different attention weights to data at different time steps, which helps the model better capture the key information in the time series; periodic items Introducing periodic changes enhances the model’s ability to capture periodic features; using the periodic weight w d and cycle length L, the model is able to identify and exploit periodic patterns in the data, thereby improving the understanding and prediction accuracy of time series data;

[0168] Among them, v a , W a and b a Automatically learned through the training process; h t-1 Directly obtain from the hidden state of the previous time step; x t Directly obtain from the input data of the current time step; w d It is automatically learned through the training process; L is set according to the periodic characteristics of the data; d and D are directly obtained according to the dimensions of the input data; t is directly obtained according to the current time step;

[0169] In the hidden state, the input data and the weighted historical hidden state part By taking the input data x of the current time step t With the weighted historical hidden state h t'-1 Combined to generate a new hidden state, the weight matrix W h and the bias term b h Used to map to the new feature space, through the attention weight α t' and the time step difference smoothing term exp(-(t-t') 2 / (2σ 2 )) can dynamically emphasize the information of important moments while reducing the influence of distant time steps, thereby more effectively capturing long-term dependencies; periodic terms Introducing periodic changes enhances the model's ability to capture periodic features, and using the periodic weight w' d and cycle length L, the model can identify and exploit periodic patterns in the data, thereby improving the understanding and prediction accuracy of time series data; local feature capture part The Gaussian kernel function is used to capture the local features of the input data in different dimensions. The Gaussian kernel weight β d , mean μ d and standard deviation σ d Used to define the center and width of the Gaussian kernel function, thereby enhancing the model's sensitivity to local patterns and improving its ability to capture local features;

[0170] Among them, W h and b h Automatically learned through the training process; x t Directly obtained from the input data of the current time step; α t' The unnormalized attention score is normalized by the softmax function; g t'-1 Directly obtained from the hidden state of the previous time step; σ is automatically tuned by the Bayesian optimization method; w' dIt is automatically learned through the training process; L is set according to the periodic characteristics of the data; d and D are directly obtained according to the dimensions of the input data; t is directly obtained according to the current time step; β d , μ d and σ d It is automatically learned through the training process; d and D are directly obtained according to the dimension of the input data; x t Directly obtained from the input data of the current time step;

[0171] Suppose you need to analyze the sodium benzoate content in a cake during a food additive testing process;

[0172] The parameter is assumed to be v a =[0.3,0.4], b a =0.1,h t-1 =[0.2,0.3],x t =[0.4,0.5],w d =[0.1,0.2], L=10, d and D are 1 and 2 respectively, t=3;

[0173]

[0174] The parameters are assumed to be b h =0.2,α t' =[0.7,0.8,0.9], h t'-1 =[0.1,0.2;0.3,0.4;0.5,0.6],,σ=0.5,w' d =[0.1,0.2],β d =[0.3,0.4],μ d =[0.2,0.3],σ d =[0.1,0.2];

[0175]

[0176] Assuming that the threshold is set to 0.5, since the first element 0.79 of the final calculation result is greater than the set threshold 0.5, it shows that through the design of the recurrent neural network enhanced by the above attention mechanism, the model can effectively capture the long-term dependencies and local features in the time series data. The attention mechanism enables the model to dynamically emphasize the information of important moments, and the Gaussian kernel function enhances the model's ability to capture local features. Therefore, when the value of the hidden state exceeds the set threshold, it can be considered that the cake sample contains a higher concentration of sodium benzoate. Through the above steps, an efficient attention mechanism enhanced recurrent neural network model can be generated. The model can not only accurately identify sodium benzoate, but also has high generalization ability and robustness, and can provide reliable detection results in practical applications.

[0177] 104. Based on the food additive detection model, the physical and chemical properties of the food samples are comprehensively considered, the test results are interpreted and verified, and a food additive detection plan is generated.

[0178] The physicochemical properties of food samples refer to the physical and chemical characteristics of food samples, such as pH value, moisture content, fat content, etc. These properties will affect the detection results of food additives.

[0179] Test result interpretation and verification is the interpretation and verification of test results to ensure the scientificity and reliability of the test plan.

[0180] The food additive testing plan is the final complete testing plan, including testing methods, steps, expected results and explanations.

[0181] In this step, first, based on the generated food additive detection model, the detection results of food samples are obtained; second, the physical and chemical properties of food samples are comprehensively considered, the detection results are interpreted, and the rationality and consistency of the detection results are analyzed; third, the detection results are further verified through experimental verification or other methods to ensure the accuracy and reliability of the detection results; finally, based on the results of interpretation and verification, a detailed food additive detection plan is generated, including detection methods, steps, expected results and explanations, to provide guidance for practical applications.

[0182] Optionally, the method in step 104 is based on the food additive detection model, comprehensively considers the physicochemical properties of food samples, interprets and verifies the test results, and generates a food additive detection plan, including: based on the food additive detection model, predicting the Fourier transform infrared spectroscopy data of food samples, and generating a preliminary prediction of food additives; based on the preliminary prediction of food additives, comprehensively considers the physicochemical properties of food samples, interprets the test results, ensures that the test results are reasonable and reliable, and generates a food additive prediction interpretation; based on the food additive prediction interpretation, verifies the accuracy of the test results by comparing the test results with known historical data, identifies and corrects potential errors, and generates a test result verification report; based on the test result verification report, conducts a detailed assessment of the types of additives in the food samples, and generates a food additive detection plan in combination with potential food safety impacts.

[0183] The food additive detection model is a machine learning model generated through training and optimization, which is used to predict the type and content of additives in food samples.

[0184] Fourier transform infrared spectroscopy data is spectral data collected by a Fourier transform infrared spectrometer and is used to analyze the chemical composition of food samples.

[0185] The physical and chemical properties of food samples include pH value, moisture content, fat content and other physical and chemical characteristics of food samples, which will affect the detection results of food additives.

[0186] The preliminary prediction of food additives is to predict the spectral data based on the detection model and generate preliminary estimates of the types and contents of additives.

[0187] The prediction and interpretation of food additives is the interpretation of the preliminary prediction results in combination with the physical and chemical properties of food samples to ensure rationality and reliability.

[0188] The test result verification report is a report that verifies the accuracy of the test results by comparing the test results with known historical data, and identifies and corrects potential errors.

[0189] The food additive testing plan is the final detailed plan, including the testing methods, steps, expected results and explanations, and food safety impact assessment.

[0190] In the embodiments of the present application, first, based on the food additive detection model, the Fourier transform infrared spectroscopy data of the food sample is predicted to generate a preliminary prediction of food additives; secondly, based on the preliminary prediction of food additives, the physical and chemical properties of the food sample are comprehensively considered to interpret the test results, ensure that the test results are reasonable and reliable, and generate a food additive prediction interpretation; thirdly, based on the food additive prediction interpretation, by comparing the test results with known historical data, the accuracy of the test results is verified, potential errors are identified and corrected, and a test result verification report is generated; finally, based on the test result verification report, the types of additives in the food sample are evaluated in detail, and a food additive detection plan is generated in combination with potential food safety impacts.

[0191] Suppose you need to test the potassium sorbate content in a biscuit;

[0192] First, based on the trained food additive detection model, the Fourier transform infrared spectroscopy data of the biscuits was predicted to generate a preliminary prediction of food additives. The results showed that the biscuits might contain potassium sorbate. Secondly, based on the preliminary prediction of food additives, the physical and chemical properties of the biscuits (such as pH value of 6.5 and moisture content of 3%) were comprehensively considered to interpret the test results, confirm the stability of potassium sorbate in a neutral environment and its preservation in a low-moisture environment, ensure that the test results are reasonable and reliable, and generate a food additive prediction interpretation. Thirdly, based on the food additive prediction interpretation, the accuracy of the test results was verified by comparing the test results with known historical data (such as the test results of other batches of biscuits). It was found that the test results were consistent with the historical data and no obvious errors were found, and a test result verification report was generated. Finally, based on the test result verification report, the types of additives in the biscuits were evaluated in detail, and a food additive detection plan was generated in combination with the safe use standards of potassium sorbate and the potential food safety impact. It is recommended to monitor the potassium sorbate content regularly to ensure that it does not exceed the safety limit.

[0193] Through the above steps, a detailed food additive testing program can be generated, which not only provides accurate test results, but also combines the physical and chemical properties of food samples and historical data to ensure the rationality and reliability of the test results, and puts forward corresponding food safety recommendations.

[0194] Figure 2 A structural schematic diagram of a food additive detection system based on Fourier transform infrared spectroscopy is provided for an embodiment of the present application, such as Figure 2 As shown, the device comprises:

[0195] The acquisition module 21 is used to collect multiple sets of Fourier transform infrared spectrum data at different depths of the food sample, record external acquisition environment parameters, and generate comprehensive spectrum information;

[0196] A generation module 22 is used to perform joint modeling based on the comprehensive spectral information using a multi-task Gaussian process regression algorithm to capture shared information between spectral data of different food additives, automatically tune hyperparameters using a Bayesian optimization method, improve model prediction accuracy and robustness, and generate optimized model parameters;

[0197] An allocation module 23 is used to dynamically allocate attention weights of different time steps based on the optimized model parameters, use a recurrent neural network enhanced by an attention mechanism, capture long-term dependencies, and use transfer learning technology to fine-tune specific types of food additives to generate a food additive detection model;

[0198] The verification module 24 is used to interpret and verify the test results based on the food additive detection model and comprehensively consider the physical and chemical properties of the food samples to generate a food additive detection plan.

[0199] Figure 2 The food additive detection system based on Fourier transform infrared spectroscopy can perform Figure 1 The implementation principle and technical effect of the food additive detection method based on Fourier transform infrared spectroscopy described in the illustrated embodiment will not be described in detail. The specific manner in which each module and unit performs operations in the food additive detection system based on Fourier transform infrared spectroscopy in the above embodiment has been described in detail in the embodiment of the method, and will not be described in detail here.

[0200] In one possible design, Figure 2 The food additive detection system based on Fourier transform infrared spectroscopy of the embodiment shown can be implemented as a computing device, such as Figure 3 As shown, the computing device may include a storage component 31 and a processing component 32;

[0201] The storage component 31 stores one or more computer instructions, wherein the one or more computer instructions are called and executed by the processing component 32 .

[0202] The processing component 32 is used to: collect multiple groups of Fourier transform infrared spectral data at different depths of food samples, record external collection environment parameters, and generate comprehensive spectral information; based on the comprehensive spectral information, use a multi-task Gaussian process regression algorithm to perform joint modeling, capture shared information between spectral data of different food additives, use a Bayesian optimization method to automatically tune hyperparameters, improve model prediction accuracy and robustness, and generate optimized model parameters; based on the optimized model parameters, use a recurrent neural network enhanced by an attention mechanism to dynamically allocate attention weights for different time steps, capture long-term dependencies, use transfer learning technology to fine-tune specific types of food additives, and generate a food additive detection model; based on the food additive detection model, comprehensively consider the physical and chemical properties of food samples, interpret and verify the detection results, and generate a food additive detection plan.

[0203] The processing component 32 may include one or more processors to execute computer instructions to complete all or part of the steps in the above method. Of course, the processing component may also be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0204] The storage component 31 is configured to store various types of data to support operations at the terminal. The storage component can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0205] Of course, the computing device may also include other components, such as input / output interfaces, display components, communication components, etc.

[0206] The input / output interface provides an interface between the processing component and the peripheral interface module, which may be an output device, an input device, etc.

[0207] The communication component is configured to facilitate, among other things, wired or wireless communications between the computing device and other devices.

[0208] Among them, the computing device can be a physical device or an elastic computing host provided by a cloud computing platform, etc. In this case, the computing device can refer to a cloud server, and the above-mentioned processing components, storage components, etc. can be basic server resources rented or purchased from the cloud computing platform.

[0209] The present application also provides a computer storage medium storing a computer program, wherein the computer program can achieve the above-mentioned Figure 1 The illustrated embodiment is a method for detecting food additives based on Fourier transform infrared spectroscopy.

[0210] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0211] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0212] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0213] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A food additive detection method based on Fourier transform infrared spectroscopy, characterized in that: include: Collect multiple sets of Fourier transform infrared spectral data at different depths of food samples, record external collection environment parameters, and generate comprehensive spectral information; Based on the comprehensive spectral information, a multi-task Gaussian process regression algorithm is used to perform joint modeling to capture the shared information between the spectral data of different food additives, and a Bayesian optimization method is used to automatically tune the hyperparameters to improve the prediction accuracy and robustness of the model and generate optimized model parameters; Based on the optimized model parameters, a recurrent neural network enhanced by an attention mechanism is used to dynamically allocate attention weights at different time steps, capture long-term dependencies, and adopt transfer learning technology to perform fine-tuning for specific types of food additives to generate a food additive detection model; Based on the food additive detection model, the physical and chemical properties of food samples are comprehensively considered, the test results are interpreted and verified, and a food additive detection plan is generated.

2. The method according to claim 1, characterized in that Based on the comprehensive spectral information, a multi-task Gaussian process regression algorithm is used to perform joint modeling, capture the shared information between the spectral data of different food additives, and automatically tune the hyperparameters using the Bayesian optimization method to improve the model prediction accuracy and robustness, and generate optimized model parameters, including: Based on the comprehensive spectral information, collect and integrate spectral data of different food additives to generate a comprehensive database; Based on the comprehensive database, a multi-task Gaussian process regression algorithm is used to perform joint modeling to capture the shared information and unique features between the spectral data of different food additives and generate a preliminary model for multi-data processing; Based on the preliminary multi-data processing model, the Bayesian optimization method is used to automatically tune the hyperparameters, define the model performance measurement objective function, iteratively select hyperparameter combinations to update the objective function prior knowledge, efficiently search for the optimal hyperparameter combination, and generate optimized hyperparameter settings; Based on the optimized hyperparameter settings, multiple trainings are performed to adjust and optimize, capture the inherent laws of food additive spectral data, and generate optimized model parameters.

3. The method according to claim 2, characterized in that Based on the comprehensive database, a multi-task Gaussian process regression algorithm is used to perform joint modeling, capture the shared information and unique features between the spectral data of different food additives, and generate a preliminary model for multi-data processing, including: Based on the comprehensive database, data cleaning is performed to remove outliers and noise, increase the generalization ability of the model, and generate a consistent data set; Based on the consistency data set, a multi-task Gaussian process regression algorithm is used to pre-set the kernel function for joint modeling, so as to capture the shared information and unique features between the spectral data of different food additives and generate a preliminary joint model; Based on the preliminary joint model, a multi-task learning framework is set up to simultaneously learn the spectral characteristics of multiple food additives, and the correlation between different tasks is used to improve the learning efficiency, so as to generate a multi-task learning framework model; Based on the multi-task learning framework model, the generalization ability of the model for different food additive data is cross-validated, the model learning effect is visualized, and a preliminary model for multi-data processing is generated.

4. The method according to claim 3, characterized in that Based on the consistency data set, a multi-task Gaussian process regression algorithm is used to pre-set the kernel function for joint modeling, capture the shared information and unique features between the spectral data of different food additives, and generate a preliminary joint model, including: Based on the consistent data set, standardization is performed to eliminate dimensional differences to improve convergence speed; Feature selection is performed through correlation analysis to remove redundant and noisy features of the data set to generate kernel function values; The kernel function value is calculated using the following formula: Among them, k(x i ,x j ) is the kernel function value; is the signal variance, representing the degree of fluctuation of the data; l is the length scale, controlling the decay speed of the similarity; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data; x i,d and x j,d are the values ​​of the i-th and j-th samples in the d-th dimension respectively; γ d is the characteristic scale of the dth dimension, which is used to adjust the importance of different dimensions; is the noise variance, indicating the measurement error; δ ij is the Kronecker delta function, which is 1 when i=j and 0 otherwise; Based on the kernel function value, a covariance matrix between training data is constructed, a Gaussian process regression conditional distribution is solved to obtain a prediction function statistical index, and a task correlation matrix is ​​introduced to generate a prediction function; The prediction function is calculated using the following formula: Where f(x) is the prediction function; i is the index of the training sample, from 1 to N; N is the number of training samples; α i is the weight coefficient of the i-th sample; k(x,x i ) is the kernel function value, which is used to measure the difference between the new sample x and the training sample x i The similarity between them; λ is an additional length scale used to adjust the smoothness of the prediction function; x d is the value of the new sample in the dth dimension; x i,d is the value of the ith training sample in the dth dimension; β is the bias term, which is used to adjust the baseline level of the predicted value; ω is the frequency parameter of the sine function, which is used to introduce periodic changes; η is the slope parameter of the logistic function, which is used to control the steepness of the logistic function; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data; Based on the prediction function, the model hyperparameters are optimized by Bayesian optimization method, and a plurality of different Gaussian process regression models are integrated by weighted averaging to generate a preliminary joint model.

5. The method according to claim 2, characterized in that: Based on the preliminary model of multi-data processing, the Bayesian optimization method is used to automatically tune the hyperparameters, define the model performance measurement objective function, iteratively select the hyperparameter combination to update the prior knowledge of the objective function, efficiently search for the optimal hyperparameter combination, and generate optimized hyperparameter settings, including: Based on the preliminary multi-data processing model, the prediction accuracy and robustness are comprehensively considered to define the objective function, measure the model performance under different hyperparameter combinations, and generate a performance evaluation standard; Based on the performance evaluation criteria, a Bayesian optimization method is used to initialize the hyperparameter search space and the prior distribution, automatically tune the hyperparameters, and generate an initial selection of the hyperparameters; Based on the initial selection of the hyperparameters, the preliminary multi-data processing model is trained, the model performance is evaluated using the objective function, and the feedback is fed back to the Bayesian optimization method to update the objective function prior knowledge and generate optimized prior knowledge; Based on the optimized prior knowledge, new hyperparameter combinations are iteratively selected to efficiently explore the hyperparameter space, gradually approach the optimal hyperparameter combination, and generate optimized hyperparameter settings.

6. The method according to claim 1, characterized in that Based on the optimized model parameters, the recurrent neural network enhanced by the attention mechanism is used to dynamically allocate attention weights of different time steps, capture long-term dependencies, and adopt transfer learning technology to fine-tune specific types of food additives to generate a food additive detection model, including: Based on the optimized model parameters, the recurrent neural network is configured, the number of network layers and activation functions are set, the basic network structure is generated to adapt to the characteristics of food additive spectral data; Based on the basic network structure, the attention mechanism is introduced to construct a recurrent neural network enhanced with the attention mechanism, dynamically allocate attention weights at different time steps, effectively capture the long-term dependency of time series data, and generate enhanced feature representation; Based on the enhanced feature representation, transfer learning technology is used, combined with a small amount of annotated data of specific types of food additives, the last several layers are fine-tuned, most of the layers are frozen, and a transfer learning model is generated; Based on the transfer learning model, detailed testing and verification are carried out to compare and evaluate the performance under different conditions to make necessary adjustments and optimizations to generate a food additive detection model.

7. The method according to claim 6, characterized in that Based on the basic network structure, the attention mechanism is introduced to construct a recurrent neural network enhanced with the attention mechanism, dynamically allocate attention weights of different time steps, effectively capture the long-term dependency of time series data, and generate enhanced feature representation, including: Based on the basic network structure, an attention mechanism module is introduced to analyze the dynamic characteristics of the input data, calculate the attention weight of each time step, highlight important features, and generate an attention weight allocation scheme; Based on the attention weight allocation scheme, a recurrent neural network enhanced with attention mechanism is constructed, and an enhanced network structure is generated by combining the attention mechanism module with the basic network structure; Based on the enhanced network structure, the food additive spectral data is processed, and the attention weights of different time steps are dynamically adjusted through the attention mechanism to effectively capture the long-term dependencies in the time series data and generate dynamically adjusted feature representations; Based on the dynamically adjusted feature representation, performance evaluation and optimization adjustment processing are performed to ensure accurate identification of different types of food additives and generate enhanced feature representation.

8. The method according to claim 6, characterized in that Based on the attention weight allocation scheme, a recurrent neural network enhanced with attention mechanism is constructed, and the attention mechanism module is combined with the basic network structure to generate an enhanced network structure, including: Based on the attention weight allocation scheme, the hidden state of the previous time step is initialized and concatenated with the input data into a joint feature vector; Mapping to the new feature space through a nonlinear activation function to generate an unnormalized attention score; The unnormalized attention score is calculated using the following formula: Among them, e t is the unnormalized attention score at the t-th time step; v a is the weight vector of attention score; W a is the weight matrix of attention score; h t-1 is the hidden state at the t-1th time step; x t is the input data of the tth time step; b a is the bias term of the attention score; w d is the period weight of the dth dimension; L is the period length; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data; t is the current time step; Based on the unnormalized attention score, the softmax function is used to normalize it into an attention weight, which is applied to the hidden state of each time step, and a time step difference smoothing term is introduced to reduce the influence of long-distance time steps to generate a hidden state; The hidden state is calculated using the following formula: Among them, h t is the hidden state at the tth time step; W h is the weight matrix of the hidden state; x t is the input data of the tth time step; α t' is the attention weight of the t'th time step; h t'-1 is the hidden state of the t'-1th time step; σ is the smoothing parameter of the time step difference; b h is the bias term of the hidden state; w' d is the cycle weight of the dth dimension; L is the cycle length; β d is the Gaussian kernel weight of the dth dimension; μ d is the mean of the dth dimension; σ d is the standard deviation of the dth dimension; d is the dimension index of the input data, from 1 to D; D is the dimension of the input data; t is the current time step; t' is the time step, which is used to calculate the mutual influence between the hidden states of different time steps; Based on the hidden state, the local features of different dimensions of the input data are captured by the Gaussian kernel function, the model performance is evaluated using cross-validation to optimize the hyperparameters, and multiple recurrent neural network models enhanced by different attention mechanisms are integrated to generate an enhanced network structure.

9. The method according to claim 1, characterized in that: Based on the food additive detection model, the physical and chemical properties of the food sample are comprehensively considered, the detection results are interpreted and verified, and a food additive detection scheme is generated, including: Based on the food additive detection model, predicting the Fourier transform infrared spectroscopy data of the food sample to generate a preliminary prediction of the food additive; Based on the preliminary prediction of food additives, the physical and chemical properties of food samples are comprehensively considered to interpret the test results, ensure that the test results are reasonable and reliable, and generate a food additive prediction interpretation; Based on the food additive prediction interpretation, by comparing the test results with known historical data, verify the accuracy of the test results, identify and correct potential errors, and generate a test result verification report; Based on the test result verification report, the types of additives in food samples are evaluated in detail, and a food additive testing plan is generated in combination with potential food safety impacts.

10. A food additive detection system based on Fourier transform infrared spectroscopy, characterized in that: include: The acquisition module is used to collect multiple sets of Fourier transform infrared spectral data at different depths of food samples, record external acquisition environment parameters, and generate comprehensive spectral information; A generation module is used to perform joint modeling based on the comprehensive spectral information using a multi-task Gaussian process regression algorithm to capture shared information between spectral data of different food additives, automatically tune hyperparameters using a Bayesian optimization method, improve model prediction accuracy and robustness, and generate optimized model parameters; An allocation module is used to dynamically allocate attention weights of different time steps based on the optimized model parameters, using a recurrent neural network enhanced by an attention mechanism, capturing long-term dependencies, and using transfer learning technology to perform fine-tuning for specific types of food additives to generate a food additive detection model; The verification module is used to interpret and verify the test results based on the food additive detection model and to generate a food additive detection plan by comprehensively considering the physical and chemical properties of the food samples.

Citation Information

Patent Citations

  • Multispectral radiation temperature measurement inversion method based on improved Bayesian optimization generalized regression neural network

    CN118298144A

  • Time sequence characteristic estimation method and system

    CN118568458A

Cited By

  • Pumpkin sugar degree efficient detection method and system for enhancing multitask deep attention network collaborative near infrared spectrum

    CN120385642A

  • Method for identifying plastics and additives thereof based on bimodal multi-task neural network

    CN121545614A