Food safety detection analysis method and system based on Internet of Things

Through the Internet of Things food safety detection and analysis method, and the index analysis algorithm and risk assessment model are used to solve the problem of low food safety detection efficiency in the existing technology, realizing the timeliness and accuracy of food safety supervision, and ensuring food safety.

CN119294830AInactive Publication Date: 2025-01-10JIANGSU LIWU FOOD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411661493.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-01-10
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing food safety testing technologies are difficult to deeply analyze the ingredient characteristic data, cannot accurately identify food safety risks, and cannot provide quantitative safety assessment indicators, resulting in low efficiency in food safety risk assessment, and the inability to automatically implement safety isolation measures to prevent problematic food from entering the market. .

Method used

Using the Internet of Things food safety detection and analysis method, the food production ingredient data is obtained for pre-processing, and the index analysis algorithm is used for in-depth analysis, a food safety risk assessment model is established, and food safety is evaluated, and food safety is judged based on the evaluation results. Standard, automatic implementation of isolation measures.

Benefits of technology

It achieves the timely and accurate food safety supervision, can accurately identify potential risks, improve food safety testing efficiency, prevent food safety incidents, and ensure that food meets safety standards before entering the market.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119294830A_ABST
    Figure CN119294830A_ABST
Patent Text Reader

Abstract

The invention discloses a food safety detection analysis method and system based on the Internet of Things, and relates to the technical field of food safety detection.The food safety detection analysis method based on the Internet of Things comprises the following steps that production component feature data is obtained; obtaining a food safety risk assessment index; evaluating the safety of the food through the food safety risk evaluation model; according to a safety evaluation result, judging whether a food safety standard is met or not, if yes, marking as safety and allowing to enter the market for circulation, and if not, isolating the food. By establishing the food safety risk assessment model, the food safety can be automatically assessed, the food safety supervision efficiency is greatly improved, and whether the food meets the food safety standard or not can be judged according to the safety assessment result, so that the health of consumers is guaranteed, and the food safety supervision efficiency and accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of food safety detection, and in particular to a food safety detection and analysis method and system based on the Internet of Things. Background Art

[0002] With the continuous improvement of people's living standards and the continuous strengthening of health awareness, food, as the most basic necessity in people's lives, its safety has become the most common concern of people, and various food safety issues are emerging in an endless stream. Food safety means ensuring that food is non-toxic and harmless, meets dietary nutrition requirements, and does not cause any acute or chronic harm to the human body after use or consumption. Food safety involves multiple links, including production, harvesting, processing, production, packaging, storage, transportation, consumption and many other contents. Any problem in any of them may cause food safety hazards and harm human health. At the same time, food safety also involves ensuring that the food supply is at a safe level, ensuring food hygiene, quality safety, etc. With the continuous improvement of people's living standards and the continuous strengthening of health awareness, food, as the most basic necessity in people's lives, its safety has become the most common concern of people, but various food safety issues are emerging in an endless stream. Therefore, strengthening food safety testing has become an urgent issue at present.

[0003] In the existing food safety testing and analysis, it is not convenient to analyze the ingredient characteristic data in depth, and it is not possible to accurately identify food safety risks. It is also not convenient to accurately evaluate the safety of food, and it cannot provide quantitative safety assessment indicators. At the same time, when the food safety risk assessment model finds that a batch of food may have risks, it is not convenient to notify relevant personnel or automatically implement safety isolation measures to prevent problematic food from entering the market, thereby reducing the efficiency of food safety testing.

[0004] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention

[0005] In view of the deficiencies of the prior art, the present invention proposes a food safety detection and analysis method and system based on the Internet of Things, which solves the problem that the prior art is not convenient for accurately identifying food safety risks through in-depth analysis of ingredient feature data. It is also not convenient to accurately assess the safety of food and cannot provide quantitative safety assessment indicators. At the same time, when the food safety risk assessment model finds that a batch of food may have risks, it is not convenient to notify relevant personnel or automatically implement safety isolation measures to prevent problematic food from entering the market, thereby reducing the efficiency of food safety detection.

[0006] To achieve the above objectives, the present invention is implemented through the following technical solutions: According to one aspect of the present invention, a food safety detection and analysis method based on the Internet of Things is provided, and the food safety detection and analysis method based on the Internet of Things comprises the following steps: S1. Obtaining food production ingredient data, and preprocessing the production ingredient data to obtain production ingredient characteristic data; S2. Use an indicator analysis algorithm to perform in-depth analysis on the obtained production component characteristic data to obtain food safety risk assessment indicators; S3. Based on the obtained food safety risk assessment indicators, a food safety risk assessment model is established, and the safety of food is assessed through the food safety risk assessment model; S4. Based on the safety assessment results, determine whether the food meets the food safety standards. If it does, it will be marked as safe and allowed to enter the market. If it does not, the food will be isolated.

[0007] Furthermore, obtaining the production ingredient data of the food and preprocessing the production ingredient data to obtain the production ingredient characteristic data includes the following steps: S11. Obtain duplicate data, missing values ​​and outliers of food production ingredient data, and perform denoising, filtering and smoothing on the duplicate data, missing values ​​and outliers; S12. Connect the unprocessed data in the food production ingredient data to generate a new data table, associate different data tables through external key values, generate a complete data table, and obtain an accurate data set; S13. Extract features from the accurate data set and obtain production component feature data.

[0008] Further, using the index analysis algorithm to deeply analyze the obtained production component characteristic data to obtain the food safety risk assessment index includes the following steps: S21. Correspond the obtained production component characteristic data and food safety incidents to the rows and columns of the contingency table, and calculate the frequency of each cross item; S22. Calculate the chi-square value of each cross term in the contingency table according to the observed frequency and expected frequency in the contingency table, and add up the chi-square values ​​of all cross terms to obtain the total chi-square value; S23, calculating the degrees of freedom of the chi-square test based on the number of rows and columns of the contingency table, and determining the critical value of the chi-square distribution; S24. Compare the chi-square value and the critical value and determine whether there is a statistical correlation between the production ingredient characteristic data and food safety incidents; S25. The cross-terms that show correlation in the chi-square test are used as food safety risk assessment indicators.

[0009] Furthermore, the formula for calculating the chi-square value of each cross term in the contingency table is: ; Among them, among them, K represents the chi-square value of each cross term; h represents the number of rows in the contingency table; l represents the number of columns in the contingency table; Indicates a Line b The observed frequency of the column; Indicates a Line b The expected frequency of the column.

[0010] Further, based on the obtained food safety risk assessment indicators, a food safety risk assessment model is established, and the food safety is assessed by the food safety risk assessment model, including the following steps: S31. Convert the obtained food safety risk assessment indicators into a risk assessment cycle; S32, replacing the risk assessment cycle into the cycle index adjustment algorithm, dividing the obtained food safety risk assessment index into a cycle index and a trend index, and constructing and training a food safety risk assessment model through the cycle index and the trend index to predict future food safety trends; S33. Use mean absolute percentage error as the evaluation criterion for the accuracy of food safety risk assessment models; S34. Based on the model optimization algorithm, adjust and optimize the parameters of the food safety risk assessment model according to the trend indicators and find the optimal parameter configuration; S35. Apply the optimal parameter configuration to the constructed food safety risk assessment model, use the second-order adaptive coefficient method to predict the trend data, and obtain the trend of food safety risks at future moments; S36. Convert the trends of food safety risks in the future into actual risk assessments, build a final food safety risk assessment model, and evaluate food safety.

[0011] Furthermore, based on the model optimization algorithm, adjusting and optimizing the parameters of the food safety risk assessment model according to the trend indicators and finding the optimal parameter configuration include the following steps: S341, initializing key parameters of the model optimization algorithm; S342. Randomly initialize the parameter configuration of the food safety risk assessment model, calculate the initial risk assessment value of each parameter configuration, and use it as the maximum risk indicator of the parameter; S343. Calculate the relative importance of each risk indicator and determine the direction of adjusting the parameters of the food safety risk assessment model based on the relative importance; S344. Update the parameter configuration of the food safety risk assessment model based on relative importance and trend indicators, and randomly perturb the optimal parameter configuration; S345. Re-evaluate the accuracy and effectiveness of the model based on the updated parameter configuration; S346. If the maximum number of iterations is reached, stop the optimization; otherwise, continue iterating and adjust the parameter configuration; S347. When the optimization process is completed, the optimal parameter configuration and the optimized food safety risk assessment model are output.

[0012] Furthermore, the formula for updating the parameter configuration of the food safety risk assessment model is: ; in, Indicates the current parameter configuration; Represented as the optimal parameter configuration; Expressed as step size factor; It is expressed as the attractiveness coefficient; Represented as a random number.

[0013] Furthermore, based on the safety assessment results, it is determined whether the food meets the food safety standards. If it does, it is marked as safe and allowed to enter the market for circulation. If it does not, the food is isolated, including the following steps: S41. Determine the key parameters affecting food safety and set the initial search scope; S42. Set the initial value and number of iterations of the food safety assessment cycle as the termination condition of the assessment process; S43, comparing the identified key factor parameters of food safety with known safety standard parameters, and updating the factor parameters according to the comparison results; S44. Evaluate food safety and compliance after each iteration through food safety verification methods; S45. Calculate the fitness score for each iteration based on the food safety and compliance test results; S46, comparing the fitness score after each iteration with the previous iteration, and selecting the factor parameter with the greatest impact on food safety and market access as the current optimal solution; S47, increasing the initial value of the evaluation cycle, and if the preset maximum number of iterations is reached, terminating the evaluation process; S48. Analyze and evaluate the results of food safety tests after completion, and compare them with preset safety standards to determine whether the food meets the safety standards. If so, it will be marked as safe and allowed to enter the market; if not, the food will be isolated and feedback will be given to the producer for adjustment.

[0014] Further, through the food safety verification method, evaluating food safety and compliance after each iteration includes the following steps: S441, initialize the first round of food safety testing, and divide the key factor parameter set affecting food safety into several subsets; S442. Use the adjusted parameters of key factors affecting food safety on the training set to train the validation model, and test the prediction performance of the validation model on food safety and compliance on the test set; S443. Calculate the generalization error of the validation model based on the actual performance of the key factor parameters affecting food safety on the test set; S444, looping step S441 to step S443 until each subset is used as a test set; S445. Obtain the average value of the generalization errors calculated in all rounds as the overall assessment of food safety and compliance after each comparison of key factor parameters affecting food safety.

[0015] According to another aspect of the present invention, a food safety detection and analysis system based on the Internet of Things is also provided, and the food safety detection and analysis system based on the Internet of Things includes: The data acquisition module is used to acquire the production ingredient data of the food and pre-process the production ingredient data to obtain the production ingredient characteristic data; An indicator analysis module is used to perform in-depth analysis on the obtained production component characteristic data using an indicator analysis algorithm to obtain food safety risk assessment indicators; A model building module is used to build a food safety risk assessment model based on the obtained food safety risk assessment indicators, and evaluate the safety of food through the food safety risk assessment model; The safety determination module is used to determine whether the food meets the food safety standards based on the safety assessment results. If it does, it is marked as safe and allowed to enter the market. If it does not, the food is isolated; Among them, the data acquisition module is connected with the model establishment module through the indicator analysis module, and the model establishment module is connected with the safety judgment module.

[0016] The beneficial effects of the present invention are: 1. The present invention makes food safety supervision more timely and accurate by collecting food production ingredient data in real time. Through in-depth analysis of production ingredient characteristic data, food safety risk assessment indicators can be obtained, which can help regulatory authorities and enterprises make more scientific decisions. By establishing a food safety risk assessment model, the safety of food can be automatically assessed, greatly improving the efficiency of food safety supervision. According to the safety assessment results, it can be determined whether the food meets the food safety standards, thereby protecting the health of consumers. For foods that do not meet the food safety standards, they can be isolated and prevented from entering the market, thereby preventing the occurrence of food safety incidents, and further improving the efficiency and accuracy of food safety supervision.

[0017] 2. The present invention performs statistical analysis on the correlation between production ingredient characteristic data and food safety incidents, so as to accurately identify ingredients with potential risks, which is helpful for early prevention and timely response, and reduces the occurrence of food safety incidents. Through chi-square test analysis, it can provide data-based decision support for policy makers and food production companies, which can not only be used to monitor food safety risks, but also to improve product formulas and production processes, thereby improving food safety.

[0018] 3. The present invention, through the application of periodic indicators and trend indicators, combined with the adjustment of model parameters by model optimization algorithm, can more accurately predict the future trend of food safety risks, help to timely identify potential food safety issues, so as to take preventive measures. The use of model optimization algorithm can dynamically adjust the parameters of the food safety risk assessment model to ensure that the model is continuously optimized with the access of new data, maintain the accuracy and timeliness of its assessment, and thus improve the efficiency and effectiveness of food safety supervision.

[0019] 4. The present invention can accurately predict which factors may cause food safety problems by subdividing the key factors of food safety and testing them using the verification model. At the same time, real-time data analysis can quickly identify potential risks, respond in a timely manner, and reduce the occurrence of food safety accidents. Through periodic evaluation and iteration processes, the parameters of the food safety risk assessment model are continuously optimized, which not only ensures that the verification model is updated with the update of new data and new standards, but also can continuously improve the accuracy and efficiency of food safety assessments. Through detailed testing and evaluation processes, it ensures that all foods meet the preset safety standards before entering the market, which helps to improve the efficiency of regulatory authorities and the compliance of enterprises. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 is a flow chart of a food safety detection and analysis method based on the Internet of Things according to an embodiment of the present invention; Figure 2 It is a principle block diagram of a food safety detection and analysis system based on the Internet of Things according to an embodiment of the present invention.

[0022] In the figure: 1. Data acquisition module; 2. Index analysis module; 3. Model building module; 4. Safety judgment module. DETAILED DESCRIPTION

[0023] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0024] In the description of the present invention, unless otherwise specified, the meaning of "plurality" is two or more. In addition, the terms "first", "second", "third", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0025] According to an embodiment of the present invention, a food safety detection and analysis method and system based on the Internet of Things are provided.

[0026] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, according to the food safety detection and analysis method based on the Internet of Things according to an embodiment of the present invention, the food safety detection and analysis method based on the Internet of Things includes the following steps: S1. Obtaining food production ingredient data, and preprocessing the production ingredient data to obtain production ingredient characteristic data; It should be explained that obtaining the production ingredient data of food includes the following steps: Step 1: Prepare food test samples and crush and dissolve them; Step 2: Set the chromatographic parameters of the HPLC instrument; Step 3: introducing the dissolved food test sample into the HPLC instrument through a sample injector for separation; Step 4: Separate the compounds in the food test sample by HPLC technology to obtain the peaks of different components at different time points; Step 5: Use the standard method and external standard method to analyze the content of each compound in the food test sample (i.e. production ingredient data) for the peak values ​​of different components appearing at different time points.

[0027] It needs to be explained that the standard method is to calculate the content of a compound in an unknown sample by establishing a standard curve based on a compound of known purity (standard). The standard curve can be prepared and measured by a series of standard samples with different but known concentrations, and then the standard curve is drawn, so that the corresponding concentration value can be found on the standard curve according to the sample test results.

[0028] It should be explained that the external standard method is to add a standard with a known concentration to the sample to be tested and then test it together. By comparing the peak height or peak area of ​​a certain component in the sample to be tested and the mixed solution of the standard with a known concentration, the content of the production component in the food sample to be tested is calculated.

[0029] It should be explained that chromatographic technology is high performance liquid chromatography (HPLC), a separation technology widely used in chemistry, biology, pharmacy and other fields. It uses the differences between the mobile phase and the stationary phase of different substances to separate them to different degrees along the column under high pressure, thereby achieving separation, detection and quantification of sample components. It has the advantages of high separation efficiency, high separation accuracy, high detection sensitivity, wide application range and simple operation, high degree of automation, and can achieve fast and efficient sample detection, and has high repeatability and stability.

[0030] Specifically, production component data includes: Raw material composition: including the types and proportions of all raw materials.

[0031] Additives and excipients: added ingredients such as preservatives, pigments, flavor enhancers, etc.

[0032] Nutrients: such as protein, fat, carbohydrates, vitamins and minerals.

[0033] Physical and chemical properties: including pH, moisture content, stability, etc.

[0034] Microbiological indicators: microbial content related to food safety, such as Salmonella, Escherichia coli, etc.

[0035] Pollutants: May contain pesticide residues, heavy metals or other harmful substances.

[0036] S2. Use an indicator analysis algorithm to perform in-depth analysis on the obtained production component characteristic data to obtain food safety risk assessment indicators; It should be explained that food safety risk assessment indicators refer to a series of parameters or indicators used to assess potential risk factors in food, including: Microbiological indicators: the presence and quantity of pathogenic microorganisms such as coliform bacteria, Salmonella, Staphylococcus aureus, etc., which are the main causes of foodborne diseases.

[0037] Chemical pollutants: including pesticide residues, heavy metals (such as lead and mercury), persistent organic pollutants (such as polychlorinated biphenyls), harmful substances produced during processing (such as acrylamide), etc.

[0038] Nutrient content: High or low levels of certain nutrients may also pose health risks, such as excessive intake of vitamin A or heavy metals.

[0039] Food additives: such as usage and safety assessment of preservatives, antioxidants, sweeteners, etc.

[0040] Physical parameters: such as pH value, water activity, temperature, etc. of food, these parameters can affect the stability of food and the growth of microorganisms.

[0041] Processing parameters: such as cooking temperature, time, and food processing methods, which affect food safety.

[0042] Sensory indicators: sensory characteristics such as color, smell, and taste. Although these indicators do not directly reflect the safety of food, they can indicate possible quality changes in food.

[0043] Genetic factors: such as the presence of genetically modified ingredients, need to be evaluated for their impact on food safety.

[0044] Safety of packaging materials: such as harmful substances in packaging materials that may migrate into food.

[0045] Supply chain indicators: such as the origin, storage, transportation and distribution of food and the effectiveness of control measures.

[0046] S3. Based on the obtained food safety risk assessment indicators, a food safety risk assessment model is established, and the safety of food is assessed through the food safety risk assessment model; S4. Based on the safety assessment results, determine whether the food meets the food safety standards. If it does, it will be marked as safe and allowed to enter the market. If it does not, the food will be isolated.

[0047] Preferably, obtaining the production ingredient data of the food and preprocessing the production ingredient data to obtain the production ingredient characteristic data comprises the following steps: S11. Obtain duplicate data, missing values ​​and outliers of food production ingredient data, and perform denoising, filtering and smoothing on the duplicate data, missing values ​​and outliers; It needs to be explained that the application example is: suppose we have an Excel table containing food ingredient data, including information such as raw material name, ingredient percentage, additive type, etc. When processing this data, we may find some duplicate records, missing data (such as the percentage of certain ingredients is not recorded), and outliers (such as the percentage of a certain ingredient exceeds 100%).

[0048] Theoretical basis: Duplicate data: may be caused by data entry errors or system synchronization problems and need to be removed to avoid analysis bias.

[0049] Missing values: may be due to measurement or recording errors and need to be filled in or estimated to maintain data integrity.

[0050] Outliers: May indicate data entry errors or true anomalies that need to be identified and handled to avoid interference with analytical results.

[0051] Implementation method: Use data cleaning software (such as Python's pandas library) to identify and delete duplicate records. For missing values, you can use filling (such as filling with the mean or median) or interpolation methods to estimate missing data. Outliers can be identified and processed using statistical methods (such as box plots to identify outliers) or machine learning methods (such as using anomaly detection algorithms).

[0052] S12. Connect the unprocessed data in the food production ingredient data to generate a new data table, associate different data tables through external key values, generate a complete data table, and obtain an accurate data set; To explain, let's say we have a master data table about food ingredients, and a secondary data table with additional information, such as supplier information or batch numbers. We need to combine this data to get a more comprehensive analytical perspective.

[0053] Theoretical basis: Data integration can improve data availability and analytical depth, and can provide a more comprehensive perspective by merging different data sources.

[0054] Implementation method: Use database management systems (such as SQL) or data processing software (such as pandas) to perform data join operations. Use external key values ​​(such as product ID or batch number) to associate different data tables to ensure correct data matching.

[0055] Generate complete data tables, ensuring that every data point is properly incorporated into the analysis.

[0056] S13. Extract features from the accurate data set and obtain production component feature data.

[0057] It needs to be explained that the application example is: after processing data cleaning and integration, we hope to extract the most important features for food safety assessment from the complete data set.

[0058] Theoretical basis: Feature extraction is the process of identifying and selecting the most useful information from raw data, which can improve the performance of the model and reduce the data dimension.

[0059] Implementation method: Use feature selection techniques (such as correlation analysis, variance analysis, principal component analysis) to identify the most important features. Machine learning algorithms (such as random forests, gradient boosting machines) can be used to evaluate the importance of features. Based on the importance of features, select the most influential features for food safety assessment to form a production component feature dataset.

[0060] Preferably, using an index analysis algorithm to perform in-depth analysis on the obtained production component characteristic data to obtain food safety risk assessment indicators includes the following steps: S21. Correspond the obtained production component characteristic data and food safety incidents to the rows and columns of the contingency table, and calculate the frequency of each cross item; It needs to be explained that the application example is: suppose we are analyzing the relationship between the production ingredient characteristics (such as additive type, storage conditions, etc.) of a set of food samples and recorded food safety incidents (such as food poisoning, foreign matter, etc.). First, we will collect these data and correspond different production ingredient characteristics and food safety incidents to the rows and columns of the contingency table.

[0061] Theoretical basis: A contingency table is a table used in statistical analysis to show the distribution between two categorical variables. Rows and columns represent different variable categories.

[0062] S22. Calculate the chi-square value of each cross term in the contingency table according to the observed frequency and expected frequency in the contingency table, and add up the chi-square values ​​of all cross terms to obtain the total chi-square value; It should be explained that the application example is: based on the constructed contingency table, the observed frequency of each cross term (i.e. the combination of a specific production component characteristic and a specific food safety incident) is calculated. Then, the chi-square value of each cross term is calculated based on the expected frequency (the theoretical frequency if the two categorical variables are independent of each other), and all chi-square values ​​are accumulated to obtain the total chi-square value.

[0063] Theoretical basis: The chi-square value is a statistic that measures the difference between the observed frequency and the expected frequency. The larger the chi-square value, the greater the deviation between the observation and the expectation, and the worse the independence between the two variables.

[0064] S23, calculating the degrees of freedom of the chi-square test based on the number of rows and columns of the contingency table, and determining the critical value of the chi-square distribution; It should be explained that the application example is: to calculate the degrees of freedom of the chi-square test, the formula is: degrees of freedom = (number of rows - 1) × (number of columns - 1). Then, according to the degrees of freedom and the preset significance level (usually 0.05), the corresponding critical value is found from the chi-square distribution table.

[0065] Theoretical basis: Degrees of freedom is the amount of independent information required to estimate the distribution of a statistic when conducting a statistical test. The critical value is the threshold that determines whether the statistical result is significant.

[0066] S24. Compare the chi-square value and the critical value and determine whether there is a statistical correlation between the production ingredient characteristic data and food safety incidents; It should be explained that the application example is to compare the calculated total chi-square value with the critical value. If the chi-square value is greater than the critical value, it means that the null hypothesis of "two variables are independent" is statistically rejected, that is, it is believed that there is a correlation between the production ingredient characteristics and food safety incidents.

[0067] Theoretical basis: The chi-square test is used to test whether two categorical variables are independent. If the actual calculated chi-square value exceeds the critical value, it means that there is a statistical association between the two.

[0068] S25. The cross-terms that show correlation in the chi-square test are used as food safety risk assessment indicators.

[0069] It should be explained that the application example is: from the contingency table, select those cross-terms that show statistical correlation and use them as key food safety risk assessment indicators. These indicators will be used for further analysis and formulation of prevention and control strategies.

[0070] Theoretical basis: Determining food safety risk assessment indicators can help identify key factors that may lead to safety incidents in the food production process, so as to take effective prevention and control measures.

[0071] Preferably, the formula for calculating the chi-square value of each cross term in the contingency table is: ; Among them, among them, K represents the chi-square value of each cross term; h represents the number of rows in the contingency table; l represents the number of columns in the contingency table; Indicates a Line b The observed frequency of the column; Indicates a Line b The expected frequency of the column.

[0072] Preferably, establishing a food safety risk assessment model based on the obtained food safety risk assessment indicators, and evaluating the safety of food by the food safety risk assessment model comprises the following steps: S31. Convert the obtained food safety risk assessment indicators into a risk assessment cycle; It should be explained that, in an application example: Assume that we obtain a set of food safety risk assessment indicators from the above step S25, such as the association between the frequency of use of a certain additive and food contamination events. We can periodize these indicators, for example, based on the time series analysis of past data, determine that the assessment should be conducted once a quarter or once a year.

[0073] Theoretical basis: Periodic risk assessment can help monitor and respond to risk trends over time and provide a basis for regularly updating and adjusting risk management strategies.

[0074] S32, replacing the risk assessment cycle into the cycle index adjustment algorithm, dividing the obtained food safety risk assessment index into a cycle index and a trend index, and constructing and training a food safety risk assessment model through the cycle index and the trend index to predict future food safety trends; It should be explained that the application example is: using the obtained periodic indicators and trend indicators, such as the increase and decrease trend of additive use, to construct a food safety risk assessment, for example, using time series analysis or machine learning algorithms (such as ARIMA model, random forest) to predict future food safety trends.

[0075] Theoretical basis: Time series analysis and machine learning algorithms can effectively predict future events based on historical data patterns, helping companies prepare and respond to possible risks in advance.

[0076] S33. Use mean absolute percentage error as the evaluation criterion for the accuracy of food safety risk assessment models; It should be explained that the application example is to use the mean absolute percentage error (MAPE) to evaluate the accuracy of the food safety risk assessment model. MAPE is a common indicator to measure the deviation between the predicted value and the actual value, and is particularly suitable for food safety risk assessment models with continuous output.

[0077] Theoretical basis: MAPE provides an intuitive error percentage, making the performance evaluation of food safety risk assessment models clearer and easier to understand and compare.

[0078] S34. Based on the model optimization algorithm, adjust and optimize the parameters of the food safety risk assessment model according to the trend indicators and find the optimal parameter configuration; It should be explained that the application examples are: using model optimization algorithms, such as firefly algorithm, genetic algorithm or gradient descent method, to adjust model parameters according to trend indicators and find the optimal parameter configuration to improve the prediction accuracy and responsiveness of the model.

[0079] Theoretical basis: Model optimization algorithms can help automatically find optimal parameters, reduce human intervention, and improve model efficiency and effectiveness.

[0080] S35. Apply the optimal parameter configuration to the constructed food safety risk assessment model, use the second-order adaptive coefficient method to predict the trend data, and obtain the trend of food safety risks at future moments; It is important to explain that the second-order adaptive coefficient method usually involves the use of second-order exponential smoothing techniques in time series forecasting. This method is an extension of the exponential smoothing technique and is suitable for situations where the data exhibits trend changes. The "second-order" here mainly refers to the fact that the food safety risk assessment model contains two smoothing coefficients: one for the data level (level) and the other for the trend level (slope or trend).

[0081] Specifically, the second-order adaptive coefficient method includes: Initialization: Select appropriate initial values ​​to set the level and trend components of the food safety risk assessment model.

[0082] Smoothing coefficient selection: Select appropriate smoothing coefficients for the level and trend components. These coefficients determine how quickly the food safety risk assessment model responds to new data points and trend changes.

[0083] Recursive formulas: Level and trend estimates are updated using recursive formulas that combine new observations, previous level estimates, and trend estimates to produce forecasts for future time periods.

[0084] S36. Convert the trends of food safety risks in the future into actual risk assessments, build a final food safety risk assessment model, and evaluate food safety.

[0085] It should be explained that the application example is: converting the future food safety risk trend obtained into an actual risk assessment, building a final food safety risk assessment model, and using food safety risk assessment to evaluate and manage food safety.

[0086] Theoretical basis: By converting the output of food safety risk assessment into specific risk assessment measures, it is possible to achieve application from theory to practice and ensure that food safety risks are effectively managed.

[0087] Preferably, based on the model optimization algorithm, adjusting and optimizing the parameters of the food safety risk assessment model according to the trend indicators, and finding the optimal parameter configuration includes the following steps: S341, initializing key parameters of the model optimization algorithm; It needs to be explained that the application example is: choose an algorithm suitable for parameter optimization, such as genetic algorithm or particle swarm optimization (PSO), and initialize its key parameters such as population size, number of iterations, crossover rate and mutation rate (genetic algorithm) or particle speed and position (PSO).

[0088] Theoretical basis: Initialization parameter setting is the basis of the optimization process. Correct parameter setting can effectively improve the optimization efficiency and success rate.

[0089] S342. Randomly initialize the parameter configuration of the food safety risk assessment model, calculate the initial risk assessment value of each parameter configuration, and use it as the maximum risk indicator of the parameter; It should be explained that the application example is: a set of initial parameter configurations are randomly generated in the parameter space, each parameter configuration represents a possible solution. The risk assessment value of the model under each parameter configuration is calculated and used as the basis for evaluating the quality of the parameter configuration.

[0090] Theoretical basis: Random initialization helps explore the parameter space, ensures the diversity of solutions, and prevents the algorithm from converging to the local optimal solution too early.

[0091] S343. Calculate the relative importance of each risk indicator and determine the direction of adjusting the parameters of the food safety risk assessment model based on the relative importance; It needs to be explained that the application example is: using methods such as sensitivity analysis or impact assessment to calculate the degree of influence of each parameter on the output of the food safety risk assessment model (food safety risk assessment value) to determine which parameters are more critical.

[0092] Theoretical basis: Relative importance assessment can help determine which parameters should be adjusted first during the optimization process to more effectively improve the performance of food safety risk assessment models.

[0093] S344. Update the parameter configuration of the food safety risk assessment model based on relative importance and trend indicators, and randomly perturb the optimal parameter configuration; It is necessary to explain that the application example is: according to the relative importance of each parameter and the observed trend, the parameter value is adjusted. This step can be combined with random perturbations to prevent the model optimization algorithm from falling into the local optimum.

[0094] Theoretical basis: Parameter updating and perturbation are key strategies to maintain optimization dynamics and avoid local optimality.

[0095] S345. Re-evaluate the accuracy and effectiveness of the model based on the updated parameter configuration; It should be explained that the application example is: using the updated parameter configuration, re-running the food safety risk assessment model, and using pre-set evaluation indicators (such as MAPE) to evaluate the accuracy and effectiveness of the food safety risk assessment model.

[0096] Theoretical basis: Continuous evaluation ensures that the effects of adjustments to the food safety risk assessment model can be accurately captured and evaluated.

[0097] S346. If the maximum number of iterations is reached, stop the optimization; otherwise, continue iterating and adjust the parameter configuration; It needs to be explained that the application example is: repeatedly executing the parameter update and food safety risk assessment model evaluation process until the set maximum number of iterations is reached or the performance of the food safety risk assessment model is no longer significantly improved.

[0098] Theoretical basis: The iterative process helps to fine-tune the parameters and gradually approach the optimal solution.

[0099] S347. When the optimization process is completed, the optimal parameter configuration and the optimized food safety risk assessment model are output.

[0100] It should be explained that in the application example, after the optimization process is completed, the parameter configuration that achieves the best performance index and the corresponding food safety risk assessment model version are output, and this version will be used for actual food safety risk assessment.

[0101] Theoretical basis: The final food safety risk assessment model should be highly accurate and reliable and able to support actual food safety management decisions.

[0102] Specifically, the model optimization algorithm is the firefly algorithm, which contains two elements, namely brightness and attractiveness. Brightness reflects the pros and cons of the firefly's position and determines its moving direction, and attractiveness determines the distance the firefly moves. By continuously updating brightness and attractiveness, the target optimization is achieved.

[0103] Preferably, the formula for updating the parameter configuration of the food safety risk assessment model is: ; in, Indicates the current parameter configuration; Represented as the optimal parameter configuration; Expressed as step size factor; Specifically, the step factor is a [0, 1] constant, which is used to determine the scale of random perturbations and help the model optimization algorithm escape from the local optimal solution; It is expressed as the attractiveness coefficient; Specifically, the attractiveness coefficient determines the degree to which the current parameter configuration moves toward a better parameter configuration during parameter update.

[0104] Represented as a random number.

[0105] Specifically, is a random number uniformly distributed on [0, 1], which is used to introduce randomness and increase the diversity of the search.

[0106] Specifically, in the formula for updating the parameter configuration of the food safety risk assessment model, use rand -0.5 is to introduce randomness, which can help the algorithm avoid falling into the local optimal solution and enable more extensive exploration in the search space.

[0107] It needs to be explained that rand is a uniformly distributed random number in the range [0, 1], and its expected value is 0.5. rand When 0.5 is subtracted from rand The range of -0.5 becomes [-0.5, 0.5], and its expected value becomes 0. After this processing, the center position of the random number is near 0, which allows the algorithm to have the opportunity to move towards the "good" solution during the search process, as well as the opportunity to move away from the current position and explore other possible solutions. In the firefly algorithm, the step size factor α is related to rand -0.5 multiplication means that the algorithm will introduce a certain degree of random exploration in each update step, which helps the algorithm to jump out of the local optimal solution and find the global optimal solution. rand The expected value of -0.5 is 0. In the long run, this randomness will not have a negative impact on the convergence trend of the algorithm.

[0108] Preferably, judging whether the food meets the food safety standards according to the safety assessment results, if so, marking it as safe and allowing it to enter the market for circulation, and if not, isolating the food includes the following steps: S41. Determine the key parameters affecting food safety and set the initial search scope; It needs to be explained that the application example is: Identify key factors that may affect food safety, such as heavy metal content, bacterial levels, chemical residues, etc. Set an initial search range for these parameters based on historical data and scientific literature.

[0109] Rationale: Identifying key parameters that affect food safety helps to systematically manage and monitor these risk factors, while the initial search scope provides a benchmark for subsequent optimization and adjustment.

[0110] S42. Set the initial value and number of iterations of the food safety assessment cycle as the termination condition of the assessment process; It should be explained that the application example is: set the cycle of food safety assessment, such as conducting a comprehensive assessment every quarter. At the same time, set an iteration number as the termination condition of the assessment process to ensure the continuous update and reasonable termination of the assessment.

[0111] Theoretical basis: Periodic assessment helps to regularly check and update the food safety status. The number of iterations ensures that the assessment process has a clear start and end, improving management efficiency.

[0112] S43, comparing the identified key factor parameters of food safety with known safety standard parameters, and updating the factor parameters according to the comparison results; It needs to be explained that the application example is: comparing the identified key food safety factor parameters with the preset food safety standards, and adjusting and updating the factor parameters based on the comparison results.

[0113] Theoretical basis: Benchmarking against safety standards ensures that food production and processing processes comply with regulatory requirements and protect consumer health.

[0114] S44. Evaluate food safety and compliance after each iteration through food safety validation methods (i.e., k-fold cross validation); Specifically, k-fold cross validation is a machine learning model evaluation method, which refers to dividing the collected data set of key food safety factors into k subsets, one of which is used as a validation set, and the remaining k-1 subsets are used as training sets.

[0115] For clarification, an application example is to evaluate the safety and compliance of food samples after each iteration, such as microbiological testing and chemical analysis, through laboratory testing and other validation methods (such as k-fold cross validation).

[0116] Rationale: Laboratory testing provides scientific evidence for food safety, ensuring that every batch of food meets safety standards.

[0117] S45. Calculate the fitness score for each iteration based on the food safety and compliance test results; For clarification, an application example is to calculate a fitness score for each iteration of food samples based on the test results for food safety and compliance. The fitness score can be based on a series of standardized indicators, such as reduction in contaminant levels, reduction in bacteria counts, etc.

[0118] Rationale: The fitness score helps quantify the degree of food safety improvement and provides an objective evaluation criterion for comparing the performance of different iterations.

[0119] S46, comparing the fitness score after each iteration with the previous iteration, and selecting the factor parameter with the greatest impact on food safety and market access as the current optimal solution; It should be explained that the application example is: the fitness score of the current iteration is compared with the previous iteration, and the best performing parameter configuration is selected as the current optimal solution.

[0120] Theoretical basis: Continuous optimization and selection of the best solution ensure that the food safety management process is constantly improved and adapted to new challenges and changes.

[0121] S47, increasing the initial value of the evaluation cycle, and if the preset maximum number of iterations is reached, terminating the evaluation process; It should be explained that in the application example, after reaching the preset maximum number of iterations, the evaluation process is terminated. At the same time, consider adjusting the future evaluation cycle based on the performance of the current optimal solution, such as adjusting from quarterly evaluation to half-year evaluation.

[0122] Rationale: Adjust the assessment cycle flexibly according to actual needs to ensure efficient use of resources without sacrificing food safety.

[0123] S48. Analyze and evaluate the results of food safety tests after completion, and compare them with preset safety standards to determine whether the food meets the safety standards. If so, it will be marked as safe and allowed to enter the market; if not, the food will be isolated and feedback will be given to the producer for adjustment.

[0124] It should be explained that after the evaluation process is completed, all test results are analyzed and compared with the preset safety standards. If the test results meet the standards, the product is marked as safe and allowed to enter the market. If not, the product is isolated and feedback is given to the producer for adjustment.

[0125] Rationale: Result analysis and decision-making are key parts of the food safety assessment process, ensuring that only products that meet safety standards can enter the market and protect public health and safety.

[0126] Specifically, the safety assessment algorithm is used to determine whether the food safety standards are met. The safety assessment algorithm is an SVM parameter selection method based on an improved bird flock model optimization algorithm, which is a strategy that applies nature-inspired algorithms to machine learning parameter optimization. In this method, the improved bird flock model optimization algorithm is used to select or optimize the parameters of the SVM to improve the performance of the model.

[0127] Specifically, SVM is a supervised learning algorithm based on the principle of structural risk minimization. It uses expected risk minimization as the evaluation criterion and aims to obtain a decision function with high generalization ability through finite sample training, that is, to find an optimal hyperplane to completely separate the samples under the condition of linear separability.

[0128] Specifically, the improved bird flock model optimization algorithm refers to an improvement and variant of the traditional particle swarm optimization algorithm (PSO). The particle swarm model optimization algorithm is an optimization technology based on swarm intelligence, which simulates the social behavior of bird flocks or fish schools to solve optimization problems.

[0129] Specifically, the improved bird flock model optimization algorithm includes the following improvements: Improvements in speed and position update rules: In standard PSO, the movement of particles is based on their best historical position and the best position of the entire group. Improved algorithms may use different rules to adjust the speed and position of particles to improve convergence speed and avoid falling into local optimality.

[0130] Parameter adjustment and control: Improved algorithms may include dynamic adjustment mechanisms for PSO parameters such as inertia weight, individual best and group best learning factors to balance exploration (global search) and exploitation (local search) during the search process.

[0131] Customization to adapt to specific problems: For specific types of problems (such as nonlinear problems, multi-objective problems, etc.), the improved bird flock model optimization algorithm may be specially designed to solve these problems more effectively.

[0132] Preferably, through the food safety verification method, evaluating food safety and compliance after each iteration includes the following steps: S441, initialize the first round of food safety testing, and divide the key factor parameter set affecting food safety into several subsets; What needs to be explained is the application example: suppose we have a set of data including multiple parameters that affect food safety, such as temperature, humidity, pH value, chemical residue content, etc. First, we split these data into several subsets in preparation for cross-validation. In the first round, one subset is selected as the test set and the rest as the training set.

[0133] Theoretical basis: Data set segmentation is a common practice in machine learning training, which can effectively avoid overfitting of the model and ensure the performance of the model on unknown data.

[0134] S442. Use the adjusted parameters of key factors affecting food safety on the training set to train the validation model, and test the prediction performance of the validation model on food safety and compliance on the test set; It should be explained that the application example is: use the adjusted parameters on the remaining data set (training set) to train the validation model (i.e., SVM model). Then, use the validation model to make predictions on the test set to evaluate the model's predictive performance on food safety and compliance.

[0135] Theoretical basis: SVM is a powerful classification technique that classifies data by maximizing the edge of the decision boundary and is suitable for complex classification problems.

[0136] S443. Calculate the generalization error of the validation model (i.e., SVM model) based on the actual performance of the key factor parameters affecting food safety on the test set; It should be explained that the generalization error of the SVM model is calculated based on the actual performance of the SVM model on the test set. The generalization error is usually calculated by comparing the model's predicted results with the actual results, which can be measured by error rate or other related indicators.

[0137] Theoretical basis: Generalization error is a key indicator for evaluating the performance of a model on unknown data, reflecting the reliability and predictive ability of the model.

[0138] Specifically, calculating the generalization error of the validation model refers to calculating the prediction error of the SVM model on the test set.

[0139] S444, looping step S441 to step S443 until each subset is used as a test set; It should be explained that, in the application example, steps S441 to S443 are looped, and different subsets are selected as test sets in each iteration, and the rest are used as training sets, until each subset is used as a test set at least once. This method is called cross validation.

[0140] Theoretical basis: Cross-validation is a statistical analysis method used to evaluate the generalization ability of a model. Through multiple training and validation, the randomness of model evaluation can be reduced and a more stable performance estimate can be provided.

[0141] S445. Obtain the average value of the generalization errors calculated in all rounds as the overall assessment of food safety and compliance after each comparison of key factor parameters affecting food safety.

[0142] It should be explained that the application example is: after all rounds of validation, the average of all calculated generalization errors is calculated. This average generalization error represents the average performance of the validation model on the entire data set, which serves as an indicator for evaluating the overall food safety and compliance of key food safety factor parameters.

[0143] Theoretical basis: The average generalization error provides a comprehensive evaluation indicator, reflecting the average performance of the verification model under various different situations. It is an important basis for determining the final effect of the verification model.

[0144] According to another embodiment of the present invention, Figure 2 As shown, a food safety detection and analysis system based on the Internet of Things is also provided, and the food safety detection and analysis system based on the Internet of Things includes: The data acquisition module 1 is used to acquire the production component data of the food and pre-process the production component data to obtain the production component characteristic data; Index analysis module 2, used to perform in-depth analysis on the obtained production component characteristic data using an index analysis algorithm to obtain food safety risk assessment indicators; A model building module 3 is used to build a food safety risk assessment model based on the obtained food safety risk assessment indicators, and evaluate the safety of food through the food safety risk assessment model; Safety determination module 4 is used to determine whether the food meets the food safety standards according to the safety assessment results. If it meets the standards, it is marked as safe and allowed to enter the market for circulation. If it does not meet the standards, the food is isolated; Among them, the data acquisition module 1 is connected with the model establishment module 3 through the indicator analysis module 2, and the model establishment module 3 is connected with the safety determination module 4.

[0145] In summary, with the aid of the above technical solutions of the present invention, the present invention can accurately identify ingredients with potential risks by statistically analyzing the correlation between production ingredient characteristic data and food safety incidents, which is helpful for early prevention and timely response, and reduces the occurrence of food safety incidents. Through chi-square test analysis, it can provide data-based decision support for policy makers and food production companies, which can not only be used to monitor food safety risks, but also to improve product formulas and production processes, thereby improving food safety. The present invention can more accurately predict the future trend of food safety risks through the application of periodic indicators and trend indicators, combined with the model optimization algorithm to adjust the model parameters, and help to identify potential food safety problems in a timely manner, so as to take preventive measures. The use of the model optimization algorithm can dynamically adjust the parameters of the food safety risk assessment model to ensure that the model is continuously optimized with the access of new data, and maintain the accuracy and timeliness of its evaluation, thereby improving the efficiency and effectiveness of food safety supervision. The present invention can accurately predict which factors may lead to food safety problems by subdividing the key factors of food safety and testing them with the verification model. At the same time, real-time data analysis can quickly identify potential risks, respond in time, and reduce the occurrence of food safety accidents. Through periodic evaluation and iteration processes, the parameters of the food safety risk assessment model are continuously optimized, which not only ensures that the verification model is updated with the update of new data and new standards, but also can continuously improve the accuracy and efficiency of food safety assessment. Through detailed testing and evaluation processes, it ensures that all foods meet the preset safety standards before entering the market, which helps to improve the efficiency of regulatory authorities and the compliance of enterprises.

[0146] 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 principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A food safety detection and analysis method based on the Internet of Things, characterized in that: The food safety detection and analysis method based on the Internet of Things includes the following steps: S1. Obtaining food production ingredient data, and preprocessing the production ingredient data to obtain production ingredient characteristic data; S2. Use an indicator analysis algorithm to perform in-depth analysis on the obtained production component characteristic data to obtain food safety risk assessment indicators; S3. Based on the obtained food safety risk assessment indicators, a food safety risk assessment model is established, and the safety of food is assessed through the food safety risk assessment model; S4. Based on the safety assessment results, determine whether the food meets the food safety standards. If it does, it will be marked as safe and allowed to enter the market. If it does not, the food will be isolated.

2. A food safety detection and analysis method based on the Internet of Things according to claim 1, characterized in that: The method of obtaining the production ingredient data of the food and preprocessing the production ingredient data to obtain the production ingredient characteristic data comprises the following steps: S11. Obtain duplicate data, missing values ​​and outliers of food production ingredient data, and perform denoising, filtering and smoothing on the duplicate data, missing values ​​and outliers; S12. Connect the unprocessed data in the food production ingredient data to generate a new data table, associate different data tables through external key values, generate a complete data table, and obtain an accurate data set; S13. Extract features from the accurate data set and obtain production component feature data.

3. The food safety detection and analysis method based on the Internet of Things according to claim 1 is characterized in that: The in-depth analysis of the obtained production component characteristic data using the index analysis algorithm to obtain the food safety risk assessment index comprises the following steps: S21. Correspond the obtained production component characteristic data and food safety incidents to the rows and columns of the contingency table, and calculate the frequency of each cross item; S22. Calculate the chi-square value of each cross term in the contingency table according to the observed frequency and expected frequency in the contingency table, and add up the chi-square values ​​of all cross terms to obtain the total chi-square value; S23, calculating the degrees of freedom of the chi-square test based on the number of rows and columns of the contingency table, and determining the critical value of the chi-square distribution; S24. Compare the chi-square value and the critical value and determine whether there is a statistical correlation between the production ingredient characteristic data and food safety incidents; S25. The cross-terms that show correlation in the chi-square test are used as food safety risk assessment indicators.

4. A food safety detection and analysis method based on the Internet of Things according to claim 3, characterized in that: The formula for calculating the chi-square value of each cross term in the contingency table is: ; Among them, among them, K represents the chi-square value of each cross term; h represents the number of rows in the contingency table; l represents the number of columns in the contingency table; Indicates a Line b The observed frequency of the column; Indicates a Line b The expected frequency of the column.

5. The food safety detection and analysis method based on the Internet of Things according to claim 1 is characterized in that: The method of establishing a food safety risk assessment model based on the obtained food safety risk assessment indicators and evaluating the safety of food by using the food safety risk assessment model comprises the following steps: S31. Convert the obtained food safety risk assessment indicators into a risk assessment cycle; S32, replacing the risk assessment cycle into the cycle index adjustment algorithm, dividing the obtained food safety risk assessment index into a cycle index and a trend index, and constructing and training a food safety risk assessment model through the cycle index and the trend index to predict future food safety trends; S33. Use mean absolute percentage error as the evaluation criterion for the accuracy of food safety risk assessment models; S34. Based on the model optimization algorithm, adjust and optimize the parameters of the food safety risk assessment model according to the trend indicators and find the optimal parameter configuration; S35. Apply the optimal parameter configuration to the constructed food safety risk assessment model, use the second-order adaptive coefficient method to predict the trend data, and obtain the trend of food safety risks at future moments; S36. Convert the trends of food safety risks in the future into actual risk assessments, build a final food safety risk assessment model, and evaluate food safety.

6. A food safety detection and analysis method based on the Internet of Things according to claim 5, characterized in that: The method of adjusting and optimizing the parameters of the food safety risk assessment model based on the model optimization algorithm according to the trend indicators and finding the optimal parameter configuration includes the following steps: S341, initializing key parameters of the model optimization algorithm; S342. Randomly initialize the parameter configuration of the food safety risk assessment model, calculate the initial risk assessment value of each parameter configuration, and use it as the maximum risk indicator of the parameter; S343. Calculate the relative importance of each risk indicator and determine the direction of adjusting the parameters of the food safety risk assessment model based on the relative importance; S344. Update the parameter configuration of the food safety risk assessment model based on relative importance and trend indicators, and randomly perturb the optimal parameter configuration; S345. Re-evaluate the accuracy and effectiveness of the model based on the updated parameter configuration; S346. If the maximum number of iterations is reached, stop the optimization; otherwise, continue iterating and adjust the parameter configuration; S347. When the optimization process is completed, the optimal parameter configuration and the optimized food safety risk assessment model are output.

7. A food safety detection and analysis method based on the Internet of Things according to claim 6, characterized in that: The formula for updating the parameter configuration of the food safety risk assessment model is: ; in, Indicates the current parameter configuration; Represented as the optimal parameter configuration; Expressed as step size factor; It is expressed as the attractiveness coefficient; Represented as a random number.

8. The food safety detection and analysis method based on the Internet of Things according to claim 1 is characterized in that: The method of judging whether the food meets the food safety standards according to the safety assessment results, if it meets the standards, marking it as safe and allowing it to enter the market for circulation, and if it does not meet the standards, isolating the food includes the following steps: S41. Determine the key parameters affecting food safety and set the initial search scope; S42. Set the initial value and number of iterations of the food safety assessment cycle as the termination condition of the assessment process; S43, comparing the identified key factor parameters of food safety with known safety standard parameters, and updating the factor parameters according to the comparison results; S44. Evaluate food safety and compliance after each iteration through food safety verification methods; S45. Calculate the fitness score for each iteration based on the food safety and compliance test results; S46, comparing the fitness score after each iteration with the previous iteration, and selecting the factor parameter with the greatest impact on food safety and market access as the current optimal solution; S47, increasing the initial value of the evaluation cycle, and if the preset maximum number of iterations is reached, terminating the evaluation process; S48. Analyze and evaluate the results of food safety tests after completion, and compare them with preset safety standards to determine whether the food meets the safety standards. If so, it will be marked as safe and allowed to enter the market; if not, the food will be isolated and feedback will be given to the producer for adjustment.

9. A food safety detection and analysis method based on the Internet of Things according to claim 8, characterized in that: The food safety verification method described above includes the following steps to evaluate food safety and compliance after each iteration: S441, initialize the first round of food safety testing, and divide the key factor parameter set affecting food safety into several subsets; S442. Use the adjusted parameters of key factors affecting food safety on the training set to train the validation model, and test the prediction performance of the validation model on food safety and compliance on the test set; S443. Calculate the generalization error of the validation model based on the actual performance of the key factor parameters affecting food safety on the test set; S444, looping step S441 to step S443 until each subset is used as a test set; S445. Obtain the average value of the generalization errors calculated in all rounds as the overall assessment of food safety and compliance after each comparison of key factor parameters affecting food safety.

10. A food safety detection and analysis system based on the Internet of Things according to claim 1, used to implement the food safety detection and analysis method based on the Internet of Things according to any one of claims 1-9, characterized in that: The food safety detection and analysis system based on the Internet of Things includes: The data acquisition module is used to acquire the production ingredient data of the food and pre-process the production ingredient data to obtain the production ingredient characteristic data; An indicator analysis module is used to perform in-depth analysis on the obtained production component characteristic data using an indicator analysis algorithm to obtain food safety risk assessment indicators; A model building module is used to build a food safety risk assessment model based on the obtained food safety risk assessment indicators, and evaluate the safety of food through the food safety risk assessment model; The safety determination module is used to determine whether the food meets the food safety standards based on the safety assessment results. If it does, it is marked as safe and allowed to enter the market. If it does not, the food is isolated; Among them, the data acquisition module is connected with the model establishment module through the indicator analysis module, and the model establishment module is connected with the safety judgment module.