A food shelf life prediction method and system based on multi-source data

By constructing a multi-source database and a dynamic response knowledge graph, combined with a self-attention mechanism and historical similar cases, the problems of single data and static models in traditional food shelf-life prediction are solved, achieving efficient and accurate food shelf-life prediction.

CN120541403BActive Publication Date: 2025-12-05CHINA NAT INST OF STANDARDIZATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510603816.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-12
Publication Date
2025-12-05
Estimated Expiration
2045-05-12

AI Technical Summary

Technical Problem

Traditional food shelf-life prediction technologies suffer from problems such as limited data dimensions, static models, lack of causal reasoning, and weak correction mechanisms, making it difficult to cope with the impact of microbial mutations and environmental anomalies.

Method used

A multi-source database is constructed, and a self-attention mechanism is used to obtain the importance weight of data sources. A food dynamic reaction knowledge graph is established to infer the chain reaction of abnormal factors in real time. Combined with a process deviation correction model based on similar historical cases, a dual calibration of shelf life prediction is achieved.

Benefits of technology

It improves the accuracy and efficiency of food shelf-life prediction, adapts to the prediction needs of different food systems, has universality and real-time capability, and optimizes supply chain management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120541403B_ABST
    Figure CN120541403B_ABST
Patent Text Reader

Abstract

The application discloses a food shelf life prediction method and system based on multi-source data, which comprises the following steps: obtaining corrected food data by repairing food multi-source data, obtaining food abnormal factors by performing abnormal detection, determining the shelf life influence degree by performing abnormal evolution, inputting the corrected food data into a food influence function to obtain the internal and external influence degree of food, inputting the corrected food data into a food basic shelf life prediction model to obtain a first predicted shelf life, obtaining a historical similar shelf life and a process component deviation, correcting the historical similar shelf life to obtain a second predicted shelf life, obtaining internal and external influence weights, determining a shelf life influence coefficient, and obtaining a food predicted shelf life according to the first predicted shelf life, the second predicted shelf life and the shelf life influence coefficient. The method can not only improve the efficiency and accuracy of food shelf life prediction, but also has good interpretability and can be directly applied to a food shelf life prediction system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of shelf-life prediction, and in particular to a method and system for predicting the shelf-life of food based on multi-source data. Background Technology

[0002] As consumers increasingly demand higher food quality and safety, and with the growing globalization and complexity of the food industry's supply chain, the accuracy requirements for food shelf-life forecasting are gradually increasing. Accurate food shelf-life forecasting is crucial for ensuring food safety, reducing waste, and optimizing supply chain management. Meanwhile, the development of big data and artificial intelligence technologies provides technical support for improving food shelf-life forecasting techniques.

[0003] While traditional methods for predicting food shelf life have made some progress, they still suffer from several major drawbacks: First, the technical data dimensions are limited, neglecting the influence of biochemical characteristics and process parameters; second, traditional technical models are static and cannot handle nonlinear processes such as microbial mutations; third, traditional techniques lack causal reasoning, and prediction models based on statistical correlation struggle to explain the actual impact paths of environmental anomalies on shelf life; and finally, traditional techniques have weak correction mechanisms, lacking dynamic compensation for deviations in raw material composition and fluctuations in process parameters. To address these issues, this invention proposes a food shelf life prediction method and system based on multi-source data. By constructing a multi-source database, employing a self-attention mechanism to obtain the importance weights of different data sources, and building a food dynamic response knowledge graph to simulate chain reactions triggered by abnormal factors in real time, this method combines a process deviation correction model based on historical similar cases to achieve dual calibration of shelf life prediction. This effectively overcomes the shortcomings of traditional techniques, providing a novel solution for the field of food shelf life prediction and possessing significant theoretical and practical value. Summary of the Invention

[0004] The purpose of this invention is to provide a method and system for predicting the shelf life of food based on multi-source data.

[0005] To achieve the above objectives, the present invention is implemented according to the following technical solution:

[0006] This invention includes the following steps:

[0007] Acquire multi-source data of the food to be predicted, repair the multi-source data of the food to obtain corrected food data, and perform anomaly detection on the corrected food data to obtain abnormal factors of the food.

[0008] A food dynamic response knowledge graph is determined, and the abnormal evolution of abnormal factors in the food is determined according to the food dynamic response knowledge graph to determine the shelf life impact. The corrected food data is input into the food impact function to obtain the internal and external impact of the food.

[0009] Obtain historical food information, construct a basic food shelf life prediction model based on the historical food information, and input the corrected food data into the basic food shelf life prediction model to obtain a first predicted shelf life.

[0010] Based on the corrected food data, the historical food information is matched to obtain historical similar shelf life and process component deviation. Based on the process component deviation and the internal and external influence of the food, the historical similar shelf life is corrected to obtain a second predicted shelf life.

[0011] The self-attention module is used to process the corrected food data and the process component deviation to obtain the internal and external influence weights. The shelf life influence coefficient is determined based on the shelf life influence degree, the food's internal and external influences, and the internal and external influence weights.

[0012] The predicted shelf life of food is obtained based on the first predicted shelf life, the second predicted shelf life, and the shelf life influence coefficient.

[0013] Furthermore, the method for obtaining abnormal factors in food includes:

[0014] The process involves acquiring multi-source data on the food to be predicted and aligning this data according to a time series. Specifically, the multi-source data includes biochemical parameters, material parameters, apparent parameters, production process parameters, and storage and transportation parameters of the food raw materials. The biochemical parameters are obtained through near-infrared spectroscopy, electrochemical methods, and molecular biology. The apparent parameters are obtained by image processing of high-resolution images of the food. The storage and transportation parameters are obtained through a sensor network covering the storage and transportation process.

[0015] Repairing multi-source food data to obtain corrected food data involves the following specific operations: using regression imputation to supplement missing values ​​of biochemical parameters, production process parameters, and storage and transportation parameters; using mode imputation to supplement missing values ​​of additive components and apparent characteristics; and processing erroneous values ​​in multi-source food data according to the logical relationships and business rules of the food data.

[0016] The corrected food data includes storage and transportation environment characteristics, process characteristics, biochemical characteristics, material characteristics, and appearance characteristics; the material characteristics include additive components and raw material components.

[0017] The corrected food data was categorized according to the data type within the corresponding data source. For each cluster, a heterogeneous hypersphere is constructed based on corrected food data from different data sources. Anomaly scores are determined based on the learning results of the macroscopic and mesoscopic hyperspheres. Anomaly factors are then identified based on these scores, expressed as:

[0018] ;

[0019] ;

[0020] in For multi-source hypersphere joint learning loss function, For sample data Abnormal scores, For the number of data sources, for Dynamic source weights of the data source For activation function, For attention mechanisms, For sample data exist Feature representation under data source As training samples, For the training sample set, for The center of the hypersphere of the data source, The square of the second norm, For regularization weights, for Macro-level anomaly weights of data sources, For mesoscopic anomaly weights, For sample data In the cluster The following features are represented. For clusters The local hypersphere center, For cross-data source anomaly weighting coefficients, This is a cross-modal difference measurement function.

[0021] Furthermore, the method for determining the impact of shelf life includes:

[0022] Design a knowledge graph structure for food dynamics; the knowledge graph structure includes node types and relationship types; the node types include food material activity, microbial community, and environmental parameters; the relationship types include positive promotion, negative inhibition, and cascade reactions;

[0023] This paper describes a method for injecting knowledge into a food dynamic response knowledge graph structure by modifying the biochemical, material, apparent, and storage and transportation environmental characteristics of food data. Physical laws are then embedded into the dynamic response knowledge graph structure to perform dynamic evolution modeling and obtain the food dynamic response knowledge graph. The material characteristics include additive characteristics and raw material characteristics; the physical laws include the Arrhenius temperature effect and microbial growth models.

[0024] The anomaly propagation dynamics equation is determined, and food anomaly factors are input into a food dynamic response knowledge graph to obtain the deviation of key parameters through anomaly evolution; the expression of the anomaly propagation dynamics equation is:

[0025] ;

[0026] in for Time Node Abnormal situation, For nodes abnormal intensity, This represents the number of nodes in the graph. For nodes and The weight of the connecting edges, It is a non-linear activation function. For nodes Self-recovery coefficient, for External disturbances at all times;

[0027] The impact of shelf life is determined based on the deviation of key parameters and the propagation path of abnormal factors, expressed as follows:

[0028] ;

[0029] in To the extent that the shelf life affects the product, The number of abnormal factors. Abnormal factors The weighting coefficients, The time decay coefficient, Abnormal factors The resulting deviation of key parameters Key parameters Deviation from the threshold, The initial stage of food production. The time to be predicted.

[0030] Furthermore, the method for obtaining the internal and external influence of food includes:

[0031] The internal and external influence of food includes the influence of additives and the influence of storage and transportation. The influence of additives is obtained by inputting the characteristics of additives into the food influence function, and the expression is as follows:

[0032] ;

[0033] ;

[0034] in For the influence of additives, To suppress the amount of additives, for The basic energy efficiency coefficient of additives, for Additive concentration, for The additives began to inhibit growth concentration. for The environmental adaptability function of the additive is related to the temperature T and pH value at the time of detection. As an activating energy for food, The gas constant is It is a temperature constant. The temperature-over-limit attenuation coefficient is... For optimal operating temperature, For reference temperature, The piecewise function is the effect of pH concentration.

[0035] The storage and transportation environment characteristics are input into the food impact function to obtain the storage and transportation impact degree, expressed as follows:

[0036] ;

[0037] in For the impact of storage and transportation, Weighted by storage and transportation temperature. For storage and transportation humidity weighting, for Storage and transportation temperature at all times Optimal food storage temperature absolute value of deviation For temperature sensitivity coefficient, for Humidity during storage and transportation Optimal humidity for food storage and transportation absolute value of deviation Let H be an indicator function of humidity H, and when humidity H exceeds a critical value... Choose 1, otherwise Take 0, For the types and quantities of gases in the storage and transportation environment, For the weighting of storage and transportation gases, for Gas storage and transportation at all times concentration Corresponding optimal storage and transportation gas concentration absolute value of deviation Average light intensity for storage and transportation With optimal light intensity for storage and transportation The absolute value of the deviation.

[0038] Furthermore, the method for obtaining the first predicted shelf life includes:

[0039] Historical food information is obtained and randomly divided into a training set and a test set in a 7:3 ratio. The historical food information includes historical process characteristics, historical biochemical characteristics, historical material characteristics, and historical shelf life.

[0040] A basic food shelf-life prediction model is trained using a training set and evaluated using a test set. The basic food shelf-life prediction model includes an ensemble tree algorithm, a mean absolute error loss function, and a Bayesian optimization algorithm.

[0041] The ensemble tree algorithm captures the interaction of food information features and uses regression to predict the shelf life of food.

[0042] The mean absolute error loss function is used to evaluate the difference between the predicted and actual shelf-life values ​​of food.

[0043] The Bayesian optimization algorithm is used to search for the optimal parameter combination of the basic shelf-life prediction model for food.

[0044] The process characteristics, biochemical characteristics, and material characteristics of the corrected food data are input into the basic shelf life prediction model of the food to obtain the first predicted shelf life.

[0045] Furthermore, the method for obtaining the second predicted shelf life includes:

[0046] The process characteristics, material characteristics, and biochemical characteristics of the corrected food data are combined to form the food prediction characteristics. The cosine similarity between the food prediction characteristics and historical food information is calculated. The historical shelf life of the historical food information with the highest similarity is taken as the historical similar shelf life. The process component deviation is determined based on the historical food information with the highest similarity and the food prediction characteristics. The process component deviation includes raw material deviation, additive deviation, and process deviation.

[0047] A second predicted shelf life is obtained by correcting historical similar shelf life based on process component deviation and the degree of internal and external influence of food; the second predicted shelf life is positively correlated with historical similar shelf life and the degree of internal and external influence of food; the second predicted shelf life is positively correlated with the absolute value of process component deviation.

[0048] Furthermore, the method for obtaining the predicted shelf life of food includes:

[0049] The internal and external influence weights include the additive influence weight and the storage and transportation influence weight;

[0050] Additive influence weights are obtained by inputting additive deviations and additive characteristics of corrected food data into the self-attention module, and storage and transportation environment characteristics and standard storage and transportation environment characteristics are obtained by inputting storage and transportation influence weights into the self-attention module.

[0051] The self-attention module uses a sliding window to dynamically update sparse coefficients, performs sparse sampling based on these coefficients, adjusts the scoring function according to KL divergence and entropy, and uses a softmax function to convert the scoring function output into an attention distribution, expressed as follows:

[0052] ;

[0053] ;

[0054] in The sparsity coefficient is . Based on the sparsity coefficient, As a regulating factor, The current sequence length. For the reference sequence length, For the scoring function, For query vector, The key matrix, For key vectors, For learning parameters, For vectors and distance, The length of the key sequence. For query The probability distribution of element k in the knowledge base K;

[0055] The additive coefficient is obtained by multiplying the additive influence degree and the additive influence weight; the storage and transportation coefficient is obtained by multiplying the storage and transportation influence degree and the storage and transportation influence weight; and the shelf life influence coefficient is determined based on the additive coefficient, the storage and transportation coefficient, and the shelf life influence degree; the shelf life influence coefficient is positively correlated with the additive coefficient, the storage and transportation coefficient, and the shelf life influence degree.

[0056] The first and second predicted shelf life are weighted and combined to obtain the third predicted shelf life. The predicted shelf life of the food is determined based on the third predicted shelf life and the shelf life influence coefficient. The predicted shelf life of the food is positively correlated with the third predicted shelf life. The predicted shelf life of the food is negatively correlated with the shelf life influence coefficient.

[0057] Secondly, a food shelf-life prediction system based on multi-source data includes:

[0058] Data module: used to repair multi-source food data, perform anomaly detection on the repaired multi-source food data to obtain abnormal factors in food, and input the corrected food data into the food influence function to obtain the internal and external influence degree of food.

[0059] Reaction Graph Module: Used to determine the food dynamic reaction knowledge graph, and to determine the degree of impact on shelf life by abnormal evolution of abnormal factors of the food according to the food dynamic reaction knowledge graph;

[0060] Prediction module: used to construct a basic shelf life prediction model for food based on historical food information, input the corrected food data into the basic shelf life prediction model to obtain a first predicted shelf life, and use to match the corrected food data with the historical food information to obtain historical similar shelf life and process component deviation, and correct the historical similar shelf life based on the process component deviation and the internal and external influence of the food to obtain a second predicted shelf life;

[0061] Adjustment module: used to process the corrected food data and the process component deviation to obtain internal and external influence weights, determine the shelf life influence coefficient based on the shelf life influence degree, the food internal and external influence degree and the internal and external influence weights, and obtain the food predicted shelf life based on the first predicted shelf life, the second predicted shelf life and the shelf life influence coefficient;

[0062] Management module: Used to store, manage and view the historical food information, multi-source data of the food, abnormal factors of the food and the predicted shelf life of the food, and to trace the source of abnormalities based on the abnormal factors of the food, and adjust the food materials, production process and storage and transportation environment.

[0063] The beneficial effects of this invention are:

[0064] This invention is a method and system for predicting the shelf life of food based on multi-source data. Compared with the prior art, this invention has the following technical advantages:

[0065] This invention, through steps of data correction and anomaly detection, reaction spectrum anomaly evolution, model construction, dynamic weight acquisition, and data correction and dynamic weight acquisition, can improve data preprocessing capabilities in food shelf-life prediction. It can enhance the adaptability of multi-source food data to the model, thereby improving the efficiency and accuracy of food shelf-life prediction. Optimizing food shelf-life prediction technology can significantly save resources, improve work efficiency, and enable multi-dimensional, real-time viewing of urban management data. It provides more reliable technical support for food shelf-life prediction, promoting the industry's upgrade towards precision and intelligence. It can adapt to the food shelf-life prediction needs of different food shelf-life prediction systems and different users, possessing a certain degree of universality. Attached Figure Description

[0066] Figure 1 This is a flowchart illustrating the steps of a food shelf-life prediction method based on multi-source data according to the present invention. Detailed Implementation

[0067] The present invention will be further described below through specific embodiments. The illustrative embodiments and descriptions herein are used to explain the present invention, but are not intended to limit the present invention.

[0068] The present invention provides a method and system for predicting the shelf life of food based on multi-source data, comprising the following steps:

[0069] like Figure 1 As shown, this embodiment includes the following steps:

[0070] Acquire multi-source data of the food to be predicted, repair the multi-source data of the food to obtain corrected food data, and perform anomaly detection on the corrected food data to obtain abnormal factors of the food.

[0071] A food dynamic response knowledge graph is determined, and the abnormal evolution of abnormal factors in the food is determined according to the food dynamic response knowledge graph to determine the shelf life impact. The corrected food data is input into the food impact function to obtain the internal and external impact of the food.

[0072] Obtain historical food information, construct a basic food shelf life prediction model based on the historical food information, and input the corrected food data into the basic food shelf life prediction model to obtain a first predicted shelf life.

[0073] Based on the corrected food data, the historical food information is matched to obtain historical similar shelf life and process component deviation. Based on the process component deviation and the internal and external influence of the food, the historical similar shelf life is corrected to obtain a second predicted shelf life.

[0074] The self-attention module is used to process the corrected food data and the process component deviation to obtain the internal and external influence weights. The shelf life influence coefficient is determined based on the shelf life influence degree, the food's internal and external influences, and the internal and external influence weights.

[0075] The predicted shelf life of food is obtained based on the first predicted shelf life, the second predicted shelf life, and the shelf life influence coefficient.

[0076] In this embodiment, the method for obtaining abnormal factors in food includes:

[0077] The process involves acquiring multi-source data on the food to be predicted and aligning this data according to a time series. Specifically, the multi-source data includes biochemical parameters, material parameters, apparent parameters, production process parameters, and storage and transportation parameters of the food raw materials. The biochemical parameters are obtained through near-infrared spectroscopy, electrochemical methods, and molecular biology. The apparent parameters are obtained by image processing of high-resolution images of the food. The storage and transportation parameters are obtained through a sensor network covering the storage and transportation process.

[0078] Repairing multi-source food data to obtain corrected food data involves the following specific operations: using regression imputation to supplement missing values ​​of biochemical parameters, production process parameters, and storage and transportation parameters; using mode imputation to supplement missing values ​​of additive components and apparent characteristics; and processing erroneous values ​​in multi-source food data according to the logical relationships and business rules of the food data.

[0079] The corrected food data includes storage and transportation environment characteristics, process characteristics, biochemical characteristics, material characteristics, and appearance characteristics; the material characteristics include additive components and raw material components.

[0080] The corrected food data was categorized according to the data type within the corresponding data source. For each cluster, a heterogeneous hypersphere is constructed based on corrected food data from different data sources. Anomaly scores are determined based on the learning results of the macroscopic and mesoscopic hyperspheres. Anomaly factors are then identified based on these scores, expressed as:

[0081] ;

[0082] ;

[0083] in For multi-source hypersphere joint learning loss function, For sample data Abnormal scores, For the number of data sources, for Dynamic source weights of the data source For activation function, For attention mechanisms, For sample data exist Feature representation under data source As training samples, For the training sample set, for The center of the hypersphere of the data source, The square of the second norm, For regularization weights, for Macro-level anomaly weights of data sources, For mesoscopic anomaly weights, For sample data In the cluster The following features are represented. For clusters The local hypersphere center, For cross-data source anomaly weighting coefficients, A cross-modal difference measurement function;

[0084] In the actual assessment, multi-source data was obtained for a certain batch of yogurt. Taking the parameter repair of the storage and transportation process of the yogurt as an example (May 1, 2024 to May 7, 2024): Temperature / ℃ [4.0, 4.2, none, 4.5, 4.8, 9.5, 3.8], Humidity / %- [78.5, 79.2, 85.3, 80.1, 79.8, 80.5, 78.9], Light intensity / lux [100, 105, 107, 110, 105, 400, 95], Oxygen concentration [2.2, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.0], Carbon dioxide concentration / ppm [350, 380, 390, 390, 440, 440], Yeast concentration / (CFU / mL) [2.22×10³, 2.30] ×10³, 2.31×10³, 2.32×10³, 2.33×10³, 2.5×10³, 2.55×10³], a linear model of temperature and time was established using historical data. The missing temperature value on day 6 was filled by regression, and the missing value was 4.4℃. In addition, the mode was used to fill in the missing value of the apparent feature / (reflectivity / R / G / B) [15.2 / 245 / 240 / 230, 16.5 / 242 / 238 / 228, 14.8 / 248 / 242 / 232, 16.1 / 240 / 236 / 230, 15.7 / 246 / 241 / 231, 16.1 / 242 / 238 / 231, none], and the missing value was 16.1 / 242 / 238 / 230. Logical verification was used to check the relationship between pH value and sterilization time and sterilization temperature.

[0085] The corrected food data was divided into 5 clusters. Taking the detection of abnormal characteristics of storage and transportation environment as an example, a heterogeneous hypersphere was constructed to determine the storage and transportation data center [4.5,80,105,2.1,390,2.33×10³]. Abnormalities in temperature / light intensity / carbon dioxide concentration / yeast on day 6 and carbon dioxide concentration / yeast concentration on day 7 were detected.

[0086] In this embodiment, the method for determining the impact of shelf life includes:

[0087] Design a knowledge graph structure for food dynamics; the knowledge graph structure includes node types and relationship types; the node types include food material activity, microbial community, and environmental parameters; the relationship types include positive promotion, negative inhibition, and cascade reactions;

[0088] This paper describes a method for injecting knowledge into a food dynamic response knowledge graph structure by modifying the biochemical, material, apparent, and storage and transportation environmental characteristics of food data. Physical laws are then embedded into the dynamic response knowledge graph structure to perform dynamic evolution modeling and obtain the food dynamic response knowledge graph. The material characteristics include additive characteristics and raw material characteristics; the physical laws include the Arrhenius temperature effect and microbial growth models.

[0089] The anomaly propagation dynamics equation is determined, and food anomaly factors are input into a food dynamic response knowledge graph to obtain the deviation of key parameters through anomaly evolution; the expression of the anomaly propagation dynamics equation is:

[0090] ;

[0091] in for Time Node Abnormal situation, For nodes abnormal intensity, This represents the number of nodes in the graph. For nodes and The weight of the connecting edges, It is a non-linear activation function. For nodes Self-recovery coefficient, for External disturbances at all times;

[0092] The impact of shelf life is determined based on the deviation of key parameters and the propagation path of abnormal factors, expressed as follows:

[0093] ;

[0094] in To the extent that the shelf life affects the product, The number of abnormal factors. Abnormal factors The weighting coefficients, The time decay coefficient, Abnormal factors The resulting deviation of key parameters Key parameters Deviation from the threshold, The initial stage of food production. The time to be predicted;

[0095] In practical assessments, taking the determination of the impact on the shelf life of a certain batch of yogurt as an example, the activity of the food materials is related to their biochemical and apparent characteristics, including protein denaturation rate, lipid oxidation degree, water activity, and pH value; the microbial community is related to its biochemical and apparent characteristics, including the growth relationship of spoilage bacteria and the threshold concentration of toxin-producing bacteria; the environmental parameters are related to the characteristics of the storage and transportation environment, including temperature, relative humidity, light intensity, and gas concentration; the positive promotion specifically refers to the increase in temperature promoting the microbial proliferation rate; the negative inhibition specifically refers to the decrease in water activity inhibiting mold growth; the cascade reaction specifically refers to lipid oxidation promoting the generation of free radicals leading to vitamin decomposition;

[0096] The physical law is expressed as follows:

[0097] ;

[0098] ;

[0099] in For temperature T The reaction rate of food under the following conditions A The reaction rate of food under the following conditions As an activating energy for food, R The gas constant is For time t The number of microorganisms at that time This represents the initial number of microorganisms. The maximum specific growth rate under ideal conditions. The environmental constraints represent the effective specific growth rate. For food substrate concentration, It is the half-saturation constant. To suppress the amount of additives, for i Additive concentration, for i The additive began to inhibit growth concentration;

[0100] Take frequency factor A 1.2×10 8 gas constant R The maximum specific growth rate of yeast under ideal conditions is 8.314 J / (mol*K). Take 0.8h -1 Environmental constraints represent the effective growth rate. It is 0.198h -1 The substrate for yogurt is lactose, and the half-saturation constant is... Take 50 g / L, the inhibitory additives include pectin and nisin, and take the corresponding additive concentration / additional growth inhibition concentration as 0.3 and 0.2, and construct a food dynamic response knowledge graph;

[0101] The anomaly propagation dynamics equations were determined (the self-recovery coefficients for the temperature-yeast, light-yeast, yeast-carbon dioxide concentration, and yeast-pH nodes were set to 0.3, 0.2, 0.5, and 0.7, respectively, and the external disturbance coefficient was set to 0.2). The food anomaly factors were input into the food dynamic response knowledge graph to obtain the deviation of key parameters (temperature deviation +5℃, light intensity +295 lux, carbon dioxide content +50 ppm, total microbial count +0.5×10³, pH value -0.3, and water activity +0.07).

[0102] Number of abnormal factors The value is 6, and the weighting coefficient corresponds to the deviation of the key parameter. The time decay coefficients are 0.2, 0.2, 0.1, 0.4, 0.4, and 0.3, respectively. The value is 0.03. The deviation thresholds of key parameters are 2℃, 100lux, 20ppm, 0.2×10³, 0.1, and 0.05, respectively. The time difference between the initial time of food production and the time to be predicted is 5 days. The impact of this on the shelf life of yogurt is calculated to be 0.506.

[0103] The preliminary assessment indicates that the cold chain was interrupted for a period of time on the sixth day, which triggered the lighting to be turned on. This promoted anaerobic and mild aerobic respiration of the yeast, leading to an increase in yeast concentration, carbon dioxide concentration, and water activity. At the same time, the pH value decreased, accelerating protein denaturation or lipid oxidation, and affecting the shelf life.

[0104] In this embodiment, the method for obtaining the internal and external influence of food includes:

[0105] The internal and external influence of food includes the influence of additives and the influence of storage and transportation. The influence of additives is obtained by inputting the characteristics of additives into the food influence function, and the expression is as follows:

[0106] ;

[0107] ;

[0108] in For the influence of additives, To suppress the amount of additives, for The basic energy efficiency coefficient of additives, for Additive concentration, for The additives began to inhibit growth concentration. for The environmental adaptability function of the additive is related to the temperature T and pH value at the time of detection. As an activating energy for food, The gas constant is It is a temperature constant. The temperature-over-limit attenuation coefficient is... For optimal operating temperature, For reference temperature, The piecewise function is the effect of pH concentration.

[0109] The storage and transportation environment characteristics are input into the food impact function to obtain the storage and transportation impact degree, expressed as follows:

[0110] ;

[0111] in For the impact of storage and transportation, Weighted by storage and transportation temperature. For storage and transportation humidity weighting, for Storage and transportation temperature at all times Optimal food storage temperature absolute value of deviation For temperature sensitivity coefficient, for Humidity during storage and transportation Optimal humidity for food storage and transportation absolute value of deviation Let H be an indicator function of humidity H, and when humidity H exceeds a critical value... Choose 1, otherwise Take 0, For the types and quantities of gases in the storage and transportation environment, For the weighting of storage and transportation gases, for Gas storage and transportation at all times concentration Corresponding optimal storage and transportation gas concentration absolute value of deviation Average light intensity for storage and transportation With optimal light intensity for storage and transportation The absolute value of the deviation;

[0112] In actual evaluation, taking the internal and external influence calculation of a certain batch of yogurt as an example, the basic energy efficiency coefficients of added pectin and nisin are taken as 0.6 and 0.8, respectively, corresponding to added concentrations / initial growth inhibition concentrations of 0.3% / 0.25% and 0.02% / 0.01%, respectively. The food activation energy... 60000 J / mol, temperature constant The attenuation coefficient for temperature exceeding the limit is 0.5. The value is 0.02, the optimal operating temperature is 4℃, the reference temperature is 4.5℃, the piecewise function of pH concentration effect is 1 when pH is less than 4.6, and 0.5 otherwise, the calculated additive influence degree is 2.284;

[0113] Take storage and transportation temperature as the weight The weighting for storage and transportation humidity is 0.6. The temperature sensitivity coefficient is 0.3. The weight of storage and transportation gases (oxygen / carbon dioxide) is 0.1, the weights of storage and transportation gases (oxygen / carbon dioxide) are 0.3 and 0.2 respectively, the critical value of humidity is 85%, the storage and transportation humidity, storage and transportation gas concentration and storage and transportation average light intensity are taken as the mean of the corresponding corrected food data, the optimal storage and transportation humidity, optimal storage and transportation gas concentration and optimal storage and transportation light intensity are taken as the standard specified values, and the storage and transportation impact is calculated to be 5.60.

[0114] In this embodiment, the method for obtaining the first predicted shelf life includes:

[0115] Historical food information is obtained and randomly divided into a training set and a test set in a 7:3 ratio. The historical food information includes historical process characteristics, historical biochemical characteristics, historical material characteristics, and historical shelf life.

[0116] A basic food shelf-life prediction model is trained using a training set and evaluated using a test set. The basic food shelf-life prediction model includes an ensemble tree algorithm, a mean absolute error loss function, and a Bayesian optimization algorithm.

[0117] The ensemble tree algorithm captures the interaction of food information features and uses regression to predict the shelf life of food.

[0118] The mean absolute error loss function is used to evaluate the difference between the predicted and actual shelf-life values ​​of food.

[0119] The Bayesian optimization algorithm is used to search for the optimal parameter combination of the basic shelf-life prediction model for food.

[0120] The process characteristics, biochemical characteristics, and material characteristics of the corrected food data are input into the basic shelf life prediction model of the food to obtain the first predicted shelf life.

[0121] In the actual assessment, 1,000 records of the shelf life of flavored yogurt were used as historical food information to construct a basic shelf life prediction model for food. The process characteristics, biochemical characteristics and material characteristics of the corrected food data were input into the basic shelf life prediction model to obtain a first predicted shelf life of 20.5 days.

[0122] In this embodiment, the method for obtaining the second predicted shelf life includes:

[0123] The process characteristics, material characteristics, and biochemical characteristics of the corrected food data are combined to form the food prediction characteristics. The cosine similarity between the food prediction characteristics and historical food information is calculated. The historical shelf life of the historical food information with the highest similarity is taken as the historical similar shelf life. The process component deviation is determined based on the historical food information with the highest similarity and the food prediction characteristics. The process component deviation includes raw material deviation, additive deviation, and process deviation.

[0124] A second predicted shelf life is obtained by correcting historical similar shelf life based on process component deviations and the degree of internal and external influences on the food; the second predicted shelf life is positively correlated with historical similar shelf life and the degree of internal and external influences on the food; the second predicted shelf life is also positively correlated with the absolute value of process component deviations.

[0125] In actual evaluation, taking the calculation of the second predicted shelf life of a certain batch of yogurt as an example, the process characteristics (origin, dairy cow breed, sterilization time and temperature, fermentation time and temperature), material characteristics (raw materials, milk fat content, additives and content), and biochemical characteristics (pH value, yeast content, water activity) of the food data are corrected to form the predicted food characteristics [Guangxi Lingshan, Raffia buffalo, 83℃, 13min, 41℃, 7.5h, buffalo milk, 3.1%, pectin 0.3%, nisin 0.02%, 4.55, 2.55×10³, 0.96]. The numerical characteristics are standardized and the cosine similarity with historical food information is calculated. The historical shelf life of 20 days corresponding to the historical food information with the highest similarity of 0.92 is taken as the historical similar shelf life.

[0126] The deviations in process composition (raw materials: milk fat content deviation 3%, origin latitude and longitude deviation 5%, dairy cow genome deviation 0.1%; additives: pectin content deviation 8%, nisin content deviation -0.5%; process: sterilization time deviation 5%, sterilization temperature deviation 10%, fermentation time deviation -5%, fermentation temperature deviation -8%) and the internal and external influences of the food (additive influence is 2.284, storage and transportation influence is 5.60) were used to correct for historically similar shelf life and obtain a second predicted shelf life of 20 + 20 * {2.284 * (8% - 0.5%) / 2 + 5.6 * [ (3% + 5% + 0.1%) / 3 + (5% + 10% - 5% - 8%) / 4] / 2} = 23.51 days.

[0127] In this embodiment, the method for obtaining the predicted shelf life of food includes:

[0128] The internal and external influence weights include the additive influence weight and the storage and transportation influence weight;

[0129] Additive influence weights are obtained by inputting additive deviations and additive characteristics of corrected food data into the self-attention module, and storage and transportation environment characteristics and standard storage and transportation environment characteristics are obtained by inputting storage and transportation influence weights into the self-attention module.

[0130] The self-attention module uses a sliding window to dynamically update sparse coefficients, performs sparse sampling based on these coefficients, adjusts the scoring function according to KL divergence and entropy, and uses a softmax function to convert the scoring function output into an attention distribution, expressed as follows:

[0131] ;

[0132] ;

[0133] in The sparsity coefficient is . Based on the sparsity coefficient, As a regulating factor, The current sequence length. For the reference sequence length, For the scoring function, For query vector, The key matrix, For key vectors, For learning parameters, For vectors and distance, The length of the key sequence. For query The probability distribution of element k in the knowledge base K;

[0134] The additive coefficient is obtained by multiplying the additive influence degree and the additive influence weight; the storage and transportation coefficient is obtained by multiplying the storage and transportation influence degree and the storage and transportation influence weight; and the shelf life influence coefficient is determined based on the additive coefficient, the storage and transportation coefficient, and the shelf life influence degree; the shelf life influence coefficient is positively correlated with the additive coefficient, the storage and transportation coefficient, and the shelf life influence degree.

[0135] The first and second predicted shelf life are weighted and combined to obtain the third predicted shelf life. The predicted shelf life of the food is then determined based on the third predicted shelf life and the shelf life influence coefficient. The predicted shelf life of the food is positively correlated with the third predicted shelf life and negatively correlated with the shelf life influence coefficient.

[0136] In actual evaluation, taking the calculation of the predicted shelf life of a certain batch of yogurt products as an example, it is used as the learning parameter. The adjustment factor is 0.1. The additive influence weights were 0.04 and 0.06, respectively, obtained by inputting the additive deviation and additive characteristics of the corrected food data into the attention module. Based on the shelf life influence degree of 0.506, the additive influence degree of 2.284, and the storage and transportation influence degree of 5.60, the shelf life influence coefficient was determined to be 0.216.

[0137] The first predicted shelf life of 20.5 days and the second predicted shelf life of 23.51 days are weighted and combined to obtain the third predicted shelf life of 20.5*0.2+23.51*0.8=22.306 days. Based on the third predicted shelf life and the shelf life influence coefficient, the predicted shelf life of the food is determined to be 22.306*(1-0.216)≈18 days.

[0138] Based on the abnormal factors such as "cold chain interruption" and "triggering the activation of lighting", inspect the equipment in the storage and transportation process and strengthen storage and transportation management measures to reduce abnormal fluctuations in the storage and transportation environment; or increase the content of nisin to inhibit the respiration of yeast and pH changes, thereby mitigating changes in food quality caused by abnormal storage and transportation environments.

[0139] Secondly, a food shelf-life prediction system based on multi-source data includes:

[0140] Data module: used to repair multi-source food data, perform anomaly detection on the repaired multi-source food data to obtain abnormal factors in food, and input the corrected food data into the food influence function to obtain the internal and external influence degree of food.

[0141] Reaction Graph Module: Used to determine the food dynamic reaction knowledge graph, and to determine the degree of impact on shelf life by abnormal evolution of abnormal factors of the food according to the food dynamic reaction knowledge graph;

[0142] Prediction module: used to construct a basic shelf life prediction model for food based on historical food information, input the corrected food data into the basic shelf life prediction model to obtain a first predicted shelf life, and use to match the corrected food data with the historical food information to obtain historical similar shelf life and process component deviation, and correct the historical similar shelf life based on the process component deviation and the internal and external influence of the food to obtain a second predicted shelf life;

[0143] Adjustment module: used to process the corrected food data and the process component deviation to obtain internal and external influence weights, determine the shelf life influence coefficient based on the shelf life influence degree, the food internal and external influence degree and the internal and external influence weights, and obtain the food predicted shelf life based on the first predicted shelf life, the second predicted shelf life and the shelf life influence coefficient;

[0144] Management module: Used to store, manage and view the historical food information, multi-source data of the food, abnormal factors of the food and the predicted shelf life of the food, and to trace the source of abnormalities based on the abnormal factors of the food, and adjust the food materials, production process and storage and transportation environment.

[0145] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for predicting the shelf life of food based on multi-source data, characterized in that, Includes the following steps: S1. Obtain multi-source data of the food to be predicted, repair the multi-source data of the food to obtain corrected food data, and perform anomaly detection on the corrected food data to obtain abnormal factors of the food. S2. Determine the food dynamic response knowledge graph, determine the shelf-life impact degree of the abnormal evolution of the abnormal factors of the food according to the food dynamic response knowledge graph, and input the corrected food data into the food impact function to obtain the internal and external impact degree of the food; the internal and external impact degree of the food includes the additive impact degree and the storage and transportation impact degree. S3. Obtain historical food information, construct a basic food shelf life prediction model based on the historical food information, and input the corrected food data into the basic food shelf life prediction model to obtain the first predicted shelf life. S4. Based on the corrected food data, match the historical food information to obtain historical similar shelf life and process component deviation. Based on the process component deviation and the internal and external influence of the food, correct the historical similar shelf life to obtain a second predicted shelf life. S5. The self-attention module is used to process the corrected food data and the process component deviation to obtain the internal and external influence weights. The shelf life influence coefficient is determined based on the shelf life influence degree, the food internal and external influence degree, and the internal and external influence weights. The internal and external influence weights include the additive influence weight and the storage and transportation influence weight. S6. Obtain the predicted shelf life of the food based on the first predicted shelf life, the second predicted shelf life, and the shelf life influence coefficient.

2. The food shelf-life prediction method based on multi-source data according to claim 1, characterized in that, The method for obtaining abnormal factors in food includes: The process involves acquiring multi-source data on the food to be predicted and aligning this data according to a time series. Specifically, the multi-source data includes biochemical parameters, material parameters, apparent parameters, production process parameters, and storage and transportation parameters of the food raw materials. The biochemical parameters are obtained through near-infrared spectroscopy, electrochemical methods, and molecular biology. The apparent parameters are obtained by image processing of high-resolution images of the food. The storage and transportation parameters are obtained through a sensor network covering the storage and transportation process. Repairing multi-source food data to obtain corrected food data involves the following specific operations: using regression imputation to supplement missing values ​​of biochemical parameters, production process parameters, and storage and transportation parameters; using mode imputation to supplement missing values ​​of additive components and apparent characteristics; and processing erroneous values ​​in multi-source food data according to the logical relationships and business rules of the food data. The corrected food data includes storage and transportation environment characteristics, process characteristics, biochemical characteristics, material characteristics, and appearance characteristics; the material characteristics include additive components and raw material components. The corrected food data was categorized according to the data type within the corresponding data source. For each cluster, a heterogeneous hypersphere is constructed based on corrected food data from different data sources. Anomaly scores are determined based on the learning results of the macroscopic and mesoscopic hyperspheres. Anomaly factors are then identified based on these scores, expressed as: ; ; in For multi-source hypersphere joint learning loss function, For sample data Abnormal scores, For the number of data sources, for Dynamic source weights of the data source For activation function, For attention mechanisms, For sample data exist Feature representation under data source As training samples, For the training sample set, for The center of the hypersphere of the data source, The square of the second norm, For regularization weights, for Macro-level anomaly weights of data sources, For mesoscopic anomaly weights, For sample data In the cluster The following features are represented. For clusters The local hypersphere center, For cross-data source anomaly weighting coefficients, This is a cross-modal difference measurement function.

3. The food shelf-life prediction method based on multi-source data according to claim 1, characterized in that, The method for determining the impact of shelf life includes: Design a knowledge graph structure for food dynamics; the knowledge graph structure includes node types and relationship types; the node types include food material activity, microbial community, and environmental parameters; the relationship types include positive promotion, negative inhibition, and cascade reactions; This paper describes a method for injecting knowledge into a food dynamic response knowledge graph structure by modifying the biochemical, material, apparent, and storage and transportation environmental characteristics of food data. Physical laws are then embedded into the dynamic response knowledge graph structure to perform dynamic evolution modeling and obtain the food dynamic response knowledge graph. The material characteristics include additive characteristics and raw material characteristics; the physical laws include the Arrhenius temperature effect and microbial growth models. The anomaly propagation dynamics equation is determined, and food anomaly factors are input into a food dynamic response knowledge graph to obtain the deviation of key parameters through anomaly evolution; the expression of the anomaly propagation dynamics equation is: ; in for Time Node Abnormal situation, For nodes abnormal intensity, This represents the number of nodes in the graph. For nodes and The weight of the connecting edges, It is a non-linear activation function. For nodes Self-recovery coefficient, for External disturbances at all times; The impact of shelf life is determined based on the deviation of key parameters and the propagation path of abnormal factors, expressed as follows: ; in To the extent that the shelf life affects the product, The number of abnormal factors. Abnormal factors The weighting coefficients, The time decay coefficient, Abnormal factors The resulting deviation of key parameters Key parameters Deviation from the threshold, The initial stage of food production. The time to be predicted.

4. The method for predicting the shelf life of food based on multi-source data according to claim 1, characterized in that, The method for obtaining the internal and external influence of food includes: The internal and external influence of food includes the influence of additives and the influence of storage and transportation. The influence of additives is obtained by inputting the characteristics of additives into the food influence function, and the expression is as follows: ; ; in For the influence of additives, To suppress the amount of additives, for The basic energy efficiency coefficient of additives, for Additive concentration, for The additives began to inhibit growth concentration. for The environmental adaptability function of the additive is related to the temperature T and pH value at the time of detection. As an activating energy for food, The gas constant is It is a temperature constant. The temperature-over-limit attenuation coefficient is... For optimal operating temperature, For reference temperature, The piecewise function is the effect of pH concentration. The storage and transportation environment characteristics are input into the food impact function to obtain the storage and transportation impact degree, expressed as follows: ; in For the impact of storage and transportation, Weighted by storage and transportation temperature. For storage and transportation humidity weighting, for Storage and transportation temperature at all times Optimal food storage temperature absolute value of deviation For temperature sensitivity coefficient, for Humidity during storage and transportation Optimal humidity for food storage and transportation absolute value of deviation Let H be an indicator function of humidity H, and when humidity H exceeds a critical value... Choose 1, otherwise Take 0, For the types and quantities of gases in the storage and transportation environment, For the weighting of storage and transportation gases, for Gas storage and transportation at all times concentration Corresponding optimal storage and transportation gas concentration absolute value of deviation Average light intensity for storage and transportation With optimal light intensity for storage and transportation The absolute value of the deviation.

5. The method for predicting the shelf life of food based on multi-source data according to claim 1, characterized in that, The method for obtaining the first predicted shelf life includes: Historical food information is obtained and randomly divided into a training set and a test set at a ratio of 7:

3. The historical food information includes historical process characteristics, historical biochemical characteristics, historical material characteristics, and historical shelf life. A basic food shelf-life prediction model is trained using a training set and evaluated using a test set. The basic food shelf-life prediction model includes an ensemble tree algorithm, a mean absolute error loss function, and a Bayesian optimization algorithm. The ensemble tree algorithm captures the interaction of food information features and uses regression to predict the shelf life of food. The mean absolute error loss function is used to evaluate the difference between the predicted and actual shelf-life values ​​of food. The Bayesian optimization algorithm is used to search for the optimal parameter combination of the basic shelf-life prediction model for food. The process characteristics, biochemical characteristics, and material characteristics of the corrected food data are input into the basic shelf life prediction model of the food to obtain the first predicted shelf life.

6. The method for predicting the shelf life of food based on multi-source data according to claim 1, characterized in that, The method for obtaining the second predicted shelf life includes: The process characteristics, material characteristics, and biochemical characteristics of the corrected food data are combined to form the food prediction characteristics. The cosine similarity between the food prediction characteristics and historical food information is calculated. The historical shelf life of the historical food information with the highest similarity is taken as the historical similar shelf life. The process component deviation is determined based on the historical food information with the highest similarity and the food prediction characteristics. The process component deviation includes raw material deviation, additive deviation, and process deviation. A second predicted shelf life is obtained by correcting historical similar shelf life based on process component deviation and the degree of internal and external influence of food; the second predicted shelf life is positively correlated with historical similar shelf life and the degree of internal and external influence of food; the second predicted shelf life is positively correlated with the absolute value of process component deviation.

7. The method for predicting the shelf life of food based on multi-source data according to claim 1, characterized in that, The method for obtaining the predicted shelf life of food includes: Additive influence weights are obtained by inputting additive deviations and additive characteristics of corrected food data into the self-attention module, and storage and transportation environment characteristics and standard storage and transportation environment characteristics are obtained by inputting storage and transportation influence weights into the self-attention module. The self-attention module uses a sliding window to dynamically update sparse coefficients, performs sparse sampling based on these coefficients, adjusts the scoring function according to KL divergence and entropy, and uses a softmax function to convert the scoring function output into an attention distribution, expressed as follows: ; ; in The sparsity coefficient is . Based on the sparsity coefficient, As a regulating factor, The current sequence length. For the reference sequence length, For the scoring function, For query vector, The key matrix, For key vectors, For learning parameters, For vectors and distance, The length of the key sequence. For query The probability distribution of element k in the knowledge base K; The additive coefficient is obtained by multiplying the additive influence degree and the additive influence weight; the storage and transportation coefficient is obtained by multiplying the storage and transportation influence degree and the storage and transportation influence weight; and the shelf life influence coefficient is determined based on the additive coefficient, the storage and transportation coefficient, and the shelf life influence degree; the shelf life influence coefficient is positively correlated with the additive coefficient, the storage and transportation coefficient, and the shelf life influence degree. The first and second predicted shelf life are weighted and combined to obtain the third predicted shelf life. The predicted shelf life of the food is determined based on the third predicted shelf life and the shelf life influence coefficient. The predicted shelf life of the food is positively correlated with the third predicted shelf life. The predicted shelf life of the food is negatively correlated with the shelf life influence coefficient.

8. A food shelf-life prediction system based on multi-source data, used to perform the method according to any one of claims 1-7, characterized in that, include: Data module: used to repair multi-source food data, perform anomaly detection on the repaired multi-source food data to obtain abnormal factors in food, and input the corrected food data into the food influence function to obtain the internal and external influence degree of food. Reaction Graph Module: Used to determine the food dynamic reaction knowledge graph, and to determine the degree of impact on shelf life by abnormal evolution of abnormal factors of the food according to the food dynamic reaction knowledge graph; Prediction module: used to construct a basic shelf life prediction model for food based on historical food information, input the corrected food data into the basic shelf life prediction model to obtain a first predicted shelf life, and use to match the corrected food data with the historical food information to obtain historical similar shelf life and process component deviation, and correct the historical similar shelf life based on the process component deviation and the internal and external influence of the food to obtain a second predicted shelf life; Adjustment module: used to process the corrected food data and the process component deviation to obtain internal and external influence weights, determine the shelf life influence coefficient based on the shelf life influence degree, the food internal and external influence degree and the internal and external influence weights, and obtain the food predicted shelf life based on the first predicted shelf life, the second predicted shelf life and the shelf life influence coefficient; Management module: Used to store, manage and view the historical food information, multi-source data of the food, abnormal factors of the food and the predicted shelf life of the food, and to trace the source of abnormalities based on the abnormal factors of the food, and adjust the food materials, production process and storage and transportation environment.

Citation Information

Patent Citations

  • Risk early warning method and system based on food operation risk information base

    CN118863552A

  • Method for predicting the shelf life of non-ferrous metals in closed spaces

    RU2020123088A