Preserved egg freshness analysis method and device, electronic equipment and storage medium
By performing dual calibration of ambient temperature and humidity and batch sample detection in the freshness detection of pineapple eggs, the problems of unstable and poor consistency of the detection results in the prior art are solved, and the accuracy and reliability of the freshness grading results are achieved.
Patent Information
- Application Number
- CN202510325059.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2045-03-19
AI Technical Summary
The prior art lacks adaptive optimization for the specific environmental conditions of the warehouse and the difference in the batches of pineapple eggs in fresh food storage centers, resulting in unstable and poor consistency of the test results.
By collecting the ambient temperature and humidity data of the storage center for the first calibration, sample detection and second calibration were performed for each batch of pineapple eggs, and the freshness grading model parameters were adjusted to adapt to the characteristics of the current batch of pineapple eggs.
It realizes the accuracy and reliability of freshness grading results during long-term operation, and improves the stability and consistency of detection results.
Smart Images

Figure CN120102815A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of fermented food analysis, and in particular to a method, device, electronic equipment and storage medium for analyzing the freshness of preserved eggs. Background Art
[0002] Fresh food storage centers of large supermarket chains need to process a large number of preserved eggs every day. In order to ensure the quality of the goods on the shelves, it is crucial to test the freshness of each batch of preserved eggs. The traditional manual sampling and testing method is not only time-consuming and labor-intensive, but the sampling results are difficult to accurately represent the overall freshness level of the entire batch of preserved eggs. Therefore, fresh food storage centers urgently need a portable, non-destructive and fast freshness analysis device to improve detection efficiency and reduce labor costs.
[0003] At present, there are some gas sensor-based devices on the market that are used to detect the freshness of food. Such devices usually use gas sensors to capture volatile components released by food, and analyze sensor data through machine learning algorithms to achieve freshness grading. However, the environment of fresh food storage centers is complex and changeable, with frequent fluctuations in temperature and humidity. In addition, different batches of preserved eggs have different initial qualities due to factors such as production processes and storage conditions. These environmental factors and differences in the products themselves will significantly affect the detection results of gas sensors, resulting in unstable test results and poor consistency between batches.
[0004] Existing gas sensors and machine learning algorithms, when directly applied to the freshness detection of preserved eggs in fresh food storage centers, lack adaptive optimization for the specific environmental conditions of warehouses and the differences in batches of preserved eggs, and are difficult to meet the needs of practical applications, especially in terms of long-term stable operation and ensuring the consistency of test results.
[0005] There is currently no effective technical solution to the above problems. Summary of the invention
[0006] The purpose of the present invention is to provide a method, device, electronic device and storage medium for analyzing the freshness of preserved eggs, so as to solve the problem that the prior art lacks adaptive optimization for specific environmental conditions of warehouses and differences in batches of preserved eggs, so as to ensure the accuracy and reliability of freshness grading results during long-term operation.
[0007] In a first aspect, the present invention provides a method for analyzing the freshness of preserved eggs, comprising the following steps:
[0008] S1. Collect the ambient temperature and humidity data of the storage center;
[0009] S2. Calibrate the freshness grading model parameters for the first time according to the ambient temperature and humidity data;
[0010] S3. Before the next step of processing each batch of preserved eggs, a small amount of samples are taken for testing and the freshness grading model parameters are calibrated for the second time according to the test results;
[0011] S4. Collecting the volatile component data of the corresponding batch of Songhua eggs and inputting the volatile component data into the freshness grading model after the second calibration to obtain a freshness score;
[0012] S5. Classify the freshness grades of the corresponding batches of preserved eggs according to the freshness scores.
[0013] The method for analyzing the freshness of Songhua eggs provided by the present invention is based on the calibration of environmental temperature and humidity, and then superimposed with batch calibration parameters, so that the model can better adapt to the overall characteristics of the current batch of Songhua eggs. After completing the batch calibration, the device can quickly and accurately analyze the freshness of a large number of Songhua eggs remaining in the batch.
[0014] Furthermore, the specific steps in step S3 include:
[0015] S31. When the same batch of Songhua eggs is tested multiple times, the time interval between the current test and the previous test is obtained;
[0016] S32. If the time interval is greater than the preset threshold, the number of samples required for this test is increased and tested;
[0017] S33. Calculate the difference between this test result and previous test results;
[0018] S34. Adjusting the calibration amplitude of the freshness grading model parameters according to the difference;
[0019] S35. Based on the adjusted calibration amplitude, perform a second calibration on the freshness grading model parameters.
[0020] It effectively solves the accuracy and reliability problems that may exist in the simple second calibration method in multiple detection scenarios, and improves the stability and accuracy of the preserved egg freshness analysis method.
[0021] Furthermore, the specific steps in step S33 include:
[0022] S331. Determine the selection strategy of the previous test results, the selection strategy includes: setting a time window, selecting the most recent N test results before the current test within the time window as the historical test data set;
[0023] S332. According to the selection strategy, select a plurality of previous test results for calculating the difference from the historical test data set;
[0024] S333. Calculate the degree of difference based on the current test result and the selected previous test results.
[0025] The historical data included in the difference calculation are all the most recent test data within the time window, ensuring the relevance of the historical data to the freshness status of the current batch of preserved eggs.
[0026] Furthermore, the specific steps in step S333 include:
[0027] S3331. Collect the volatile component data of the samples taken for this test and use it as the test result;
[0028] S3332. Collect the volatile component data sets of the samples corresponding to the previous test results selected in step S332 and combine them as the previous test results;
[0029] S3333. Calculate the mean vector and standard deviation vector of each volatile component in the volatile component data set;
[0030] S3334. According to the mean vector and the standard deviation vector, the current test result and the previous test results are standardized based on Z-score to obtain the standardized current test result and the standardized previous test results;
[0031] S3335. Set a weight vector for each volatile component, and based on the weight vector, calculate the weighted Euclidean distance between the standardized current test result and the standardized previous test results;
[0032] S3336. Set a time decay coefficient and obtain the timestamps corresponding to the previous test results, where the time decay coefficient is used to control the degree of influence of the timeliness of the previous test results;
[0033] S3337. Calculate the timeliness weights of all the test results according to the time decay coefficient and the timestamps corresponding to all the test results, and normalize the timeliness weights to obtain normalized timeliness weights;
[0034] S3338. Calculate the degree of difference based on the weighted Euclidean distance and the normalized timeliness weight.
[0035] The difference between the current test result and the previous test results can be calculated more accurately and effectively, providing a reliable basis for the calibration of the subsequent freshness grading model parameters.
[0036] Furthermore, the specific steps in step S34 include:
[0037] S341. Obtaining the preset basic calibration amplitude, maximum adjustment coefficient, steepness coefficient and time threshold, as well as the time interval obtained in step S31 and the difference calculated in step S33;
[0038] S342. Calculate a dynamic adjustment coefficient according to the time interval, the time threshold, the maximum adjustment coefficient and the steepness coefficient;
[0039] S343. Calculate the calibration amplitude according to the difference, the basic calibration amplitude and the dynamic adjustment coefficient.
[0040] Furthermore, the specific steps in step S5 include:
[0041] S51. Determine whether the freshness score exceeds a preset range;
[0042] S52. If it exceeds the preset range, the exception handling mechanism is activated, and the score conversion strategy is adjusted according to the distribution characteristics of the volatile component data;
[0043] S53. Divide the freshness levels according to the adjusted score conversion strategy.
[0044] Furthermore, the specific steps in step S52 include:
[0045] S521. Determine whether the volatile component data distribution conforms to the preset expected distribution, and if not, perform the following steps:
[0046] S5211. Calculate the degree of deviation of the volatile component data from the expected distribution;
[0047] S5212. Determine the abnormality type according to the degree of deviation;
[0048] S5213. According to the abnormal type, select the corresponding score conversion strategy adjustment plan;
[0049] S5214. Adjust the score conversion strategy according to the corresponding score conversion strategy adjustment plan.
[0050] In a second aspect, the present invention provides a device for analyzing the freshness of preserved eggs, comprising:
[0051] The acquisition module is used to collect the ambient temperature and humidity data of the storage center;
[0052] A first calibration module, used for performing a first calibration on freshness grading model parameters according to the environmental temperature and humidity data;
[0053] The second calibration module is used to extract a small amount of samples for testing before the next step of processing of each batch of preserved eggs, and then calibrate the freshness grading model parameters for the second time according to the test results;
[0054] A scoring module, used for collecting volatile component data of a corresponding batch of preserved eggs and inputting the volatile component data into a freshness grading model after the second calibration to obtain a freshness score;
[0055] The classification module is used to classify the freshness level of the corresponding batch of preserved eggs according to the freshness score.
[0056] The device for analyzing the freshness of preserved eggs provided by the present invention improves the accuracy and reliability of the freshness analysis model in an actual warehouse environment, and can more effectively evaluate the freshness of preserved eggs.
[0057] In a third aspect, the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method for analyzing the freshness of preserved eggs provided in the first aspect are executed.
[0058] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps in the method for analyzing the freshness of preserved eggs provided in the first aspect are executed.
[0059] From the above, it can be seen that the method for analyzing the freshness of preserved eggs provided by the present invention is aimed at the application scenario in the fresh food storage center of a large chain supermarket. In order to realize the long-term, stable and consistent non-destructive freshness grading of multiple batches of preserved eggs with different initial qualities, a gas sensor is used to quickly capture the volatile components of preserved eggs, and the grading model can be continuously optimized through a machine learning algorithm to overcome the detection bias caused by the initial quality differences between batches, thereby ensuring the accuracy and reliability of the freshness grading results during long-term operation.
[0060] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by implementing the embodiments of the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 A flow chart of a method for analyzing the freshness of preserved eggs provided in an embodiment of the present invention.
[0062] Figure 2 A schematic diagram of the structure of a device for analyzing the freshness of preserved eggs provided in an embodiment of the present invention.
[0063] Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0064] Description of labels:
[0065] 100, acquisition module; 200, first calibration module; 300, second calibration module; 400, scoring module; 500, division module; 13, electronic device; 1301, processor; 1302, memory; 1303, communication bus. DETAILED DESCRIPTION
[0066] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.
[0067] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0068] Reference Figure 1 The present invention provides a method for analyzing the freshness of preserved eggs, comprising the following steps:
[0069] S1. Collect the ambient temperature and humidity data of the storage center;
[0070] S2. Calibrate the freshness grading model parameters for the first time based on the ambient temperature and humidity data;
[0071] S3. Before the next step of processing each batch of preserved eggs, a small amount of samples are taken for testing and the freshness grading model parameters are calibrated for the second time according to the test results;
[0072] S4. Collect the volatile component data of the corresponding batch of Songhua eggs and input the volatile component data into the freshness grading model after the second calibration to obtain a freshness score;
[0073] S5. Classify the freshness grades of the corresponding batches of preserved eggs according to the freshness scores.
[0074] In step S1, the environmental temperature and humidity data are collected through the temperature and humidity sensor network deployed in the storage center. The sensor network covers the key areas of the storage center to ensure the comprehensiveness and representativeness of the environmental data.
[0075] In step S2, the first calibration process uses the ambient temperature and humidity data to adjust the initial parameters of the freshness grading model. For example, the model can be a machine learning model, and the initial parameters include the weights and bias items of the model. The calibration process can be based on the ambient temperature and humidity data and preset calibration rules. Adjust these parameters so that the model initially adapts to the environmental conditions of the storage center.
[0076] In step S3, the second calibration is performed before processing each batch of preserved eggs in order to eliminate differences between batches. A small number of samples can be randomly selected from each batch of preserved eggs. The test results can be sample volatile component data or other freshness indicators. The calibration process is to further adjust the model parameters based on these test results. For example, an online learning algorithm can be used to update the model parameters in real time based on the newly detected sample data.
[0077] In step S4, volatile component data is collected through a gas sensor, which can non-destructively detect volatile gases released by the preserved eggs. The volatile component data is input into a freshness grading model that has been calibrated twice. The model outputs a freshness score, and the score reflects the freshness of the preserved eggs.
[0078] In step S5, the freshness level is divided according to the freshness score. For example, a score threshold can be preset to divide the freshness score into multiple levels such as excellent, qualified, and unqualified. The grade division results are used to guide subsequent warehousing and sales decisions.
[0079] Specifically, the method for analyzing the freshness of Songhua eggs proposed in this application aims to solve the technical problem of accurately analyzing the freshness of Songhua eggs in a warehouse environment. The method is implemented by a freshness grading model that is calibrated twice. First, step S1 collects the temperature and humidity data of the warehouse environment, which are environmental factors that affect the freshness of Songhua eggs. Step S2 uses the environmental temperature and humidity data to calibrate the parameters of the freshness grading model for the first time, with the aim of adapting the model to the environmental conditions of the current warehouse and eliminating the interference of environmental factors on freshness detection. Then, step S3 extracts a small amount of samples for detection before processing each batch of Songhua eggs, and calibrates the model parameters for the second time according to the detection results, with the aim of eliminating the influence caused by the differences between different batches of Songhua eggs themselves and improving the applicability of the model to different batches of Songhua eggs. Step S4 collects the volatile component data of the batch of Songhua eggs to be tested, and inputs these data into the model that has been calibrated twice to obtain a freshness score. Volatile components are key indicators for measuring freshness, and freshness can be evaluated by analyzing the volatile component data through the model. Finally, step S5 divides Songhua eggs into different freshness grades according to the freshness score. Through dual calibration of ambient temperature and humidity and batch sample testing, this method improves the accuracy and reliability of the freshness analysis model in the actual warehouse environment and can more effectively evaluate the freshness of preserved eggs.
[0080] In some specific embodiments, the freshness grading model can use a support vector machine model. In step S1, temperature and humidity sensors are arranged at different locations in the storage center, and data is collected every ten minutes to ensure the real-time and accuracy of environmental data. In step S2, the first calibration is performed according to the mapping relationship between the preset ambient temperature and humidity and the model parameters. For example, in a high temperature and high humidity environment, the parameters in the model that characterize the decay rate of freshness are increased. In step S3, 5 Songhua egg samples are taken from each batch, and the volatile component data are detected using a portable gas sensor, and the detection time is 3 minutes / sample. The second calibration uses a gradient descent algorithm with an adaptive learning rate to fine-tune the model parameters according to the sample detection results. In step S4, all Songhua eggs in the batch to be tested pass through the gas sensor detection area one by one, and the volatile component data is quickly collected, and the data processing time is less than 1 second / piece. In step S5, the freshness score is divided into three levels: 90 points or more are excellent, 80-90 points are qualified, and 80 points or less are unqualified.
[0081] In some embodiments, the specific steps in step S3 include:
[0082] S31. When the same batch of Songhua eggs is tested multiple times, the time interval between the current test and the previous test is obtained;
[0083] S32. If the time interval is greater than the preset threshold, the number of samples required for this test is increased and tested;
[0084] S33. Calculate the difference between this test result and previous test results;
[0085] S34. Adjusting the calibration amplitude of the freshness grading model parameters according to the difference;
[0086] S35. Based on the adjusted calibration amplitude, perform a second calibration on the freshness grading model parameters.
[0087] Specifically, in the context of multiple freshness tests on the same batch of preserved eggs, simply performing a second calibration may not be able to fully adapt to the fluctuations in the test results over time and the impact of different test time intervals. Therefore, this embodiment introduces a time interval consideration mechanism, and obtains the time interval between this test and the last test through step S31. The acquisition of the time interval can be achieved by recording the timestamp of each test by the system. The difference between the timestamp of this test and the timestamp of the last test is the time interval, which provides a reference in the time dimension for subsequent steps. When step S32 determines that the time interval exceeds the preset threshold, the number of sample extractions is increased to cope with the freshness changes that may be caused by long time intervals and ensure the representativeness of the test samples. Step S33 quantifies the degree of fluctuation of the test results by calculating the difference between the test results of this test and the results of previous tests. Step S34 dynamically adjusts the calibration amplitude of the model parameters according to this difference to achieve the adaptability of the calibration process. If the difference is high, the calibration amplitude is increased, otherwise it is reduced, so that the model parameter calibration can better adapt to data changes. Finally, step S35 performs a second calibration based on the adjusted calibration amplitude, achieving a more refined and reliable model parameter update. Through the above steps, this embodiment effectively solves the accuracy and reliability problems that may exist in the simple second calibration method in multiple detection scenarios, and improves the stability and accuracy of the preserved egg freshness analysis method.
[0088] In some embodiments, the specific steps in step S33 include:
[0089] S331. Determine the selection strategy for the previous test results, the selection strategy includes: setting a time window, selecting the most recent N test results before the current test within the time window as the historical test data set;
[0090] S332. According to the selection strategy, multiple previous test results for calculating the difference are selected from the historical test data set;
[0091] S333. Calculate the difference between the current test result and the selected previous test results.
[0092] In order to ensure that the historical test results used to calculate the difference are timely and relevant, this embodiment sets a selection strategy. The selection strategy specifically sets a time window and selects the most recent N test results before the current test within the time window as the historical test data set. The setting of the time window limits the selection range of historical test results and avoids the introduction of historical data that is too old in time. By selecting the most recent N test results within the time window, the amount of historical data can be taken into account while ensuring the timeliness of the data, thereby achieving a more accurate calculation of the difference between the current test result and the previous test results.
[0093] Specifically, in the method for analyzing the freshness of preserved eggs, in order to more reasonably and effectively calculate the difference between the current test result and the previous test results, the selection strategy of the previous test results is determined. The formulation of the selection strategy aims to solve the technical problem of how to select representative historical test results when calculating the difference. The time window is set, for example, it can be set to the last week or the last month to limit the scope of investigation of historical data. Within the determined time window, the system will further screen and select the latest N test results before the time point of this test. The N value can be adjusted according to the actual test frequency and data volume. For example, the latest 3 or 5 test results can be selected. In this way, the historical data included in the difference calculation are all the latest test data within the time window, which ensures the relevance of the historical data with the freshness of the current batch of preserved eggs. As a result, the historical data that may be introduced by using all historical data and is irrelevant to the freshness of the current batch of preserved eggs is excluded, and the accuracy of the difference calculation is improved. At the same time, by selecting the latest N test results within the time window, while ensuring the timeliness of the data, the quantity of historical data is also taken into account, making the difference calculation result more stable and reliable.
[0094] In some specific embodiments, for the detection of the freshness of preserved eggs, a selection strategy is adopted to determine the previous test results for difference calculation. The time window is set to 7 days, and the N value is set to 3. When the freshness of batch preserved eggs is detected daily, the system will review the test records in the past 7 days when the detection is performed on the same day. If there are 3 or more test records in the past 7 days, the 3 test records closest to the detection time of the day are selected as the historical test data set. If the test record in the past 7 days is less than 3 times, for example, only 2 times, all of these 2 test records are included in the historical test data set. Subsequently, the test result of this test is calculated with the previous test results selected from the historical test data set for difference calculation, and the difference calculation result will be used for the calibration adjustment of the subsequent freshness classification model parameters. Through this implementation, it is guaranteed that the historical data used for the difference calculation is the most recent and representative data, and the rationality and effectiveness of the difference calculation are achieved.
[0095] In some embodiments, the specific steps in step S333 include:
[0096] S3331. Collect the volatile component data of the samples taken for this test and use it as the test result;
[0097] S3332. The volatile component data sets of the samples corresponding to the previous test results selected in step S332 are combined as the previous test results;
[0098] S3333. Calculate the mean vector and standard deviation vector of each volatile component in the volatile component data set;
[0099] S3334. According to the mean vector and the standard deviation vector, the current test result and the previous test results are standardized based on the Z-score to obtain the standardized current test result and the standardized previous test results;
[0100] Specifically, the standardized test result is calculated according to the following formula:
[0101] ; ;
[0102] ;
[0103] in, This is the result of the test Standardized data of volatile components, This is the result of the test Volatile component data, For the The mean vector of volatile component data, For the The standard deviation vector of the volatile component data; is the number of volatile components; is the standardized test result;
[0104] The standardized test results are calculated according to the following formula:
[0105] ; ;
[0106] ;
[0107] in, For the Among all the test results Standardized data of volatile components, For the Among all the test results Volatile component data; is the number of selected test results; After standardization All previous test results;
[0108] S3335. Set a weight vector for each volatile component, and based on the weight vector, calculate the weighted Euclidean distance between the standardized current test result and the standardized previous test results;
[0109] Specifically, the weighted Euclidean distance is calculated according to the following formula:
[0110] ;
[0111] ;
[0112] in, About , and The weighted Euclidean distance of is the weight vector set of all volatile components, For the The weight vector of the volatile components;
[0113] S3336. Set the time decay coefficient and obtain the timestamps corresponding to the previous test results. The time decay coefficient is used to control the influence of the timeliness of the previous test results;
[0114] S3337. Calculate the timeliness weights of all the test results according to the time decay coefficient and the timestamps corresponding to all the test results, and normalize the timeliness weights to obtain normalized timeliness weights;
[0115] Specifically, the timeliness weight is calculated according to the following formula:
[0116] ;
[0117] in, For the The timeliness weight of each test result, is the time attenuation coefficient, is the current time, For the Timestamps of all test results;
[0118] The normalized timeliness weight is calculated according to the following formula:
[0119] ; ; ; ;
[0120] in, No. The normalized timeliness weight of each test result, No. The timeliness weight of each test result; No. Timestamps of all test results;
[0121] S3338. Calculate the difference based on the weighted Euclidean distance and the normalized timeliness weight;
[0122] Specifically, the difference is calculated according to the following formula:
[0123] ;
[0124] in, For the difference.
[0125] Step S333 aims to accurately and effectively calculate the difference between the current test result and the previous test results. In order to achieve this goal, a series of refinement steps are proposed.
[0126] First, step S3333 calculates the mean vector and standard deviation vector of the volatile component data detected in all previous times to provide a benchmark for subsequent standardization processing.
[0127] Step S3334 performs Z-score-based standardization, converting the current and previous test data to the same scale by subtracting the mean and dividing by the standard deviation, eliminating differences in dimensions and numerical ranges, and making different volatile components comparable.
[0128] Furthermore, step S3335 introduces a weight vector, sets weights for different volatile components to highlight important components and reduce interference, and then calculates the weighted Euclidean distance to quantify the degree of difference in component composition.
[0129] In addition, steps S3336 and S3337 take into account the timeliness of historical data, calculate the timeliness weight through the time decay coefficient and timestamp, and normalize it so that data that is more recent in time has a higher weight.
[0130] Therefore, step S3338 combines the weighted Euclidean distance and the normalized timeliness weight, and finally obtains the difference degree that comprehensively considers the component difference and time attenuation.
[0131] Specifically, after obtaining the volatile component data of this test and previous tests, the system first calculates the mean and standard deviation of each volatile component for the previous test data. For example, assuming that three volatile components are detected and the previous test data constitute a component matrix, the mean and standard deviation of each component in previous tests are calculated to form a mean vector and a standard deviation vector. Then, the Z-score standardization formula is used to standardize the data of this test and previous tests. For each volatile component, its mean in previous tests is subtracted and divided by its standard deviation. The standardized data makes the values of different components within a comparable range. In order to reflect the different degrees of influence of different volatile components on freshness, a component weight vector is pre-set. The weight value can be determined according to the contribution of the component to freshness, and important components are given higher weights. When calculating the difference, the weighted Euclidean distance formula is used to calculate the distance between the standardized data of this test and the standardized data of previous tests, and the distance value is weighted and adjusted by the component weight. In order to reflect the timeliness of previous test results, a time decay coefficient is set, for example, 0.9. The farther the previous test results are from the current time, the lower their weights. According to the time decay coefficient and the timestamps of the previous test results, the timeliness weight of each previous test result is calculated and normalized to ensure that the total weight is 1. The final difference is calculated by weighted Euclidean distance and normalized timeliness weight. For example, the weighted Euclidean distance can be multiplied by the normalized timeliness weight, and then the product values of all previous test results can be added to obtain the final difference.
[0132] In some specific embodiments, volatile component data is collected through a gas sensor array, and each gas sensor responds to one or more volatile components. The selection strategy for previous test results is to set a time window and select the five most recent test results within the time window as the historical test data set. The standard deviation used in the Z-score normalization process is the sample standard deviation. The volatile component weight vector is pre-set based on expert experience or component importance analysis method. The time decay coefficient is set to 0.85, which means that the weight of historical data decays to 0.85 times the original value after each time unit. The normalization of the timeliness weight adopts the softmax normalization method. The difference calculation formula is the weighted average of the weighted Euclidean distance and the normalized timeliness weight. Through the above specific steps, the difference between the current test result and the previous test results can be calculated more accurately and effectively, providing a reliable basis for the calibration of the subsequent freshness grading model parameters.
[0133] In some embodiments, the specific steps in step S34 include:
[0134] S341. Obtaining the preset basic calibration amplitude, maximum adjustment coefficient, steepness coefficient and time threshold, as well as the time interval obtained in step S31 and the difference calculated in step S33;
[0135] S342. Calculate the dynamic adjustment coefficient according to the time interval, time threshold, maximum adjustment coefficient and steepness coefficient; specifically, calculate the dynamic adjustment coefficient according to the following formula:
[0136] ;
[0137] in, is the dynamic adjustment coefficient, is the maximum adjustment factor, is the steepness coefficient, is the time interval, is the time threshold;
[0138] S343. Calculate the calibration amplitude according to the difference, the basic calibration amplitude and the dynamic adjustment coefficient; specifically, calculate the calibration amplitude according to the following formula:
[0139] ;
[0140] in, is the calibration amplitude, is the basic calibration amplitude, For the difference, It is a dynamic adjustment coefficient.
[0141] Step S34 aims to dynamically adjust the calibration amplitude. To achieve this goal, step S341 is designed as a parameter acquisition link to collect all parameters required for subsequent calculations. These parameters include a pre-set basic calibration amplitude, which represents the basic adjustment amount for model parameter calibration; a maximum adjustment coefficient, which limits the maximum range of dynamic adjustment; a steepness coefficient, which controls the rate at which the dynamic adjustment coefficient changes with the time interval; a time threshold, which serves as a benchmark for judging the length of the time interval; and the detection time interval and difference obtained from steps S31 and S33.
[0142] Step S342 is the dynamic adjustment coefficient calculation link. The calculation of the dynamic adjustment coefficient is designed to take into account the influence of the detection time interval on the calibration amplitude. Specifically, the dynamic adjustment coefficient can be calculated as the product of the maximum adjustment coefficient and a time-related function, which can be, for example, an exponential decay function or an S-type function, whose independent variable is the ratio of the time interval to the time threshold. In this way, when the time interval is long, the dynamic adjustment coefficient approaches the maximum adjustment coefficient, and vice versa. The role of the steepness coefficient is to adjust the curve shape of the time-related function, thereby controlling how fast the dynamic adjustment coefficient changes with the time interval.
[0143] Step S343 is the calibration amplitude calculation link. The calibration amplitude is calculated by comprehensively considering the difference, the basic calibration amplitude and the dynamic adjustment coefficient. One possible calculation method is to add the basic calibration amplitude to the product of the dynamic adjustment coefficient and the difference. Therefore, the size of the calibration amplitude depends not only on the difference of the test results, but also on the detection time interval, thereby realizing the dynamic adjustment of the calibration amplitude.
[0144] Specifically, this scheme aims to provide a more sophisticated model parameter calibration method. By introducing a dynamic adjustment coefficient, the calibration amplitude can be dynamically adjusted according to the detection time interval. When the interval between two detections is long, the dynamic adjustment coefficient increases, so that the calibration amplitude also increases, thereby adjusting the model parameters more quickly to adapt to potential changes. Conversely, when the detection interval is short, the dynamic adjustment coefficient decreases, and the calibration amplitude also decreases, avoiding excessive adjustment of model parameters and maintaining the stability of the model. This dynamic adjustment mechanism makes the model calibration process more intelligent and adaptive, and can better cope with fluctuations in the environment of fresh storage centers and the quality of preserved eggs themselves.
[0145] In some embodiments, the specific steps in step S2 include:
[0146] S21. Obtain the state of the ambient temperature and humidity sensor, and perform the following steps when the ambient temperature and humidity sensor fails:
[0147] S211. Use a spare ambient temperature and humidity sensor to collect ambient temperature and humidity data, or use a time series prediction model to predict ambient temperature and humidity data based on historical ambient temperature and humidity data;
[0148] S212. Perform temperature drift compensation on the ambient temperature and humidity data;
[0149] S213. Use the compensated ambient temperature and humidity data to perform the first calibration on the freshness grading model parameters.
[0150] In step S21, the acquisition of the state of the ambient temperature and humidity sensor can be implemented by regularly checking whether the sensor reading is within a reasonable range. The sensor state can be defined as normal or failure.
[0151] In step S211, when the main sensor fails, the system can switch to a backup solution. There are two backup solutions. One solution is to pre-install one or more backup environmental temperature and humidity sensors. When the main sensor fails, the system automatically switches to the backup sensor for data collection. Another solution is that the system maintains historical environmental temperature and humidity data and uses this data to train a time series prediction model. When the main sensor fails, the model can predict the current environmental temperature and humidity based on historical data.
[0152] In step S212, temperature drift compensation is performed to improve the accuracy of the data. The compensation method may include regular calibration of the sensor or correction of the data using a statistical model.
[0153] In step S213, the calibration process is to adjust the model parameters according to the environmental temperature and humidity data so that the model can more accurately reflect the freshness of the preserved eggs under the current environmental conditions.
[0154] Specifically, in the method for analyzing the freshness of preserved eggs, the first calibration step S2 is used to adjust the parameters of the freshness grading model according to the ambient temperature and humidity data. Step S2 first executes S21 to obtain the state of the ambient temperature and humidity sensor. The system detects the state of the main sensor and determines whether the sensor is working properly. If the main sensor is working properly, the data collected by the sensor is used directly. If the main sensor is detected to be invalid, step S211 is executed. In S211, the system provides two alternative solutions to continuously obtain ambient temperature and humidity data. The first solution is to enable the backup ambient temperature and humidity sensor. The second solution is to use the time series prediction model to analyze the historical ambient temperature and humidity data, establish a prediction model, and predict the current ambient temperature and humidity data through the model when the main sensor fails. After obtaining the ambient temperature and humidity data, step S212 is executed to compensate the data for temperature drift. Temperature drift compensation technology can correct data errors and improve data accuracy. In step S213, the parameters of the freshness grading model are calibrated for the first time using the ambient temperature and humidity data that has been compensated for temperature drift. Therefore, even if the ambient temperature and humidity sensor fails, the system can still obtain reliable ambient temperature and humidity data, and use this as a basis to complete the first calibration of the freshness grading model parameters, ensuring the stability and reliability of the preserved egg freshness analysis method.
[0155] In some specific embodiments, the state of the ambient temperature and humidity sensor can be obtained by periodically sending a heartbeat signal and monitoring the response. If the main ambient temperature and humidity sensor does not respond to the heartbeat signal within a preset time, it is determined that the main sensor has failed. After the sensor fails, the system automatically switches to the backup sensor. The backup sensor can be a high-precision temperature and humidity sensor of the same model as the main sensor and is pre-installed near the main sensor. Temperature drift compensation can be performed using a Kalman filter algorithm. The calibrated ambient temperature and humidity data is then used to update the parameters of the freshness grading model. For example, the weight coefficient in the model can be adjusted by the gradient descent method to minimize the error between the model-predicted freshness and the actual freshness.
[0156] In some embodiments, the specific steps in step S5 include:
[0157] S51. Determine whether the freshness score exceeds a preset range;
[0158] S52. If it exceeds the preset range, the exception handling mechanism is activated, and the score conversion strategy is adjusted according to the distribution characteristics of the volatile component data;
[0159] S53. Divide the freshness levels according to the adjusted score conversion strategy.
[0160] In step S51, the preset range is set to define the fluctuation range of the normal freshness score. As an implementation method, the preset range can be set to the interval [0,100]. The freshness score is compared with the preset range to determine whether the freshness score is abnormal.
[0161] In step S52, the activation condition of the exception handling mechanism is that the freshness score exceeds the preset range. The analysis of the distribution characteristics of the volatile component data is to explore the reasons for the abnormal freshness score. For example, the distribution of volatile component data may show a skewness or multimodal state that is different from the normal distribution. These distribution characteristics can reflect the specific type of abnormal freshness of the preserved eggs, such as abnormalities caused by corruption and deterioration, or abnormalities caused by interference from environmental factors. The adjustment of the score conversion strategy is based on the analysis results, with the aim of correcting the score deviation caused by abnormal conditions and ensuring the accuracy of the freshness grade division. The score conversion strategy can be a mapping relationship between a pre-set score interval and a freshness grade. Adjusting the score conversion strategy can be adjusting the score interval boundary in the mapping relationship.
[0162] In step S53, the adjusted score conversion strategy will be used to reclassify the freshness levels to ensure that the final freshness level can accurately reflect the actual freshness of the preserved eggs.
[0163] Specifically, after obtaining the freshness score, step S51 is first executed to determine whether the score is within the preset normal range. If the score is within the normal range, the freshness level can be directly divided according to the preset score conversion strategy. On the contrary, if the score exceeds the normal range, for example, the score value is too high or too low, it is determined to be an abnormal score, and the abnormality handling mechanism of step S52 is started at this time. In step S52, the abnormality handling mechanism will further analyze the collected volatile component data and evaluate the characteristics of the data distribution, for example, calculate the mean, variance, skewness, kurtosis and other statistics of the volatile component data, or use a clustering algorithm to perform cluster analysis on the volatile component data. Through the analysis results, it can be determined whether the volatile component data deviates from the normal distribution range, and the specific form of the deviation. According to the data distribution characteristics, the abnormal type is determined. For example, the abnormal type can be divided into multiple types such as the overall high concentration of volatile components, the overall low concentration of volatile components, and the abnormally high concentration of specific volatile components. For different abnormal types, the corresponding score conversion strategy adjustment plan is selected. For example, if the overall concentration of volatile components is high, it may be that the preserved eggs are slightly corrupt. At this time, the scoring interval of the "fresh" level in the scoring conversion strategy can be appropriately tightened, and the scoring intervals of the "acceptable" level and the "not fresh" level can be expanded. If the overall concentration of volatile components is low, it may be that the ambient temperature and humidity are too low, which inhibits the release of volatile components. At this time, the scoring interval of the "fresh" level in the scoring conversion strategy can be appropriately relaxed. After completing the adjustment of the scoring conversion strategy, execute step S53, use the adjusted scoring conversion strategy, re-convert the freshness score into the freshness level, and obtain the final freshness level division result. In this way, it can be ensured that when the freshness score is abnormal, the accuracy and reliability of the freshness level division can be improved.
[0164] In some specific embodiments, the preset range can be set to [10,90]. The score conversion strategy can be set as follows: a score in the interval [80,90] corresponds to an "excellent" level of freshness, a score in the interval [60,80) corresponds to a "good" level of freshness, a score in the interval [40,60) corresponds to a "medium" level of freshness, and a score in the interval [10,40) corresponds to a "poor" level of freshness. When the freshness score exceeds the interval [10,90], the exception handling mechanism is activated. The exception handling mechanism analyzes the distribution of volatile component data. If it is found that the concentration of volatile components indicating corruption, such as hydrogen sulfide and ammonia, is significantly increased, it is determined to be a corruption-type abnormality, and the score conversion strategy is adjusted to: a score in the interval [70,80] corresponds to an "excellent" level of freshness, a score in the interval [50,70) corresponds to a "good" level of freshness, a score in the interval [30,50) corresponds to a "medium" level of freshness, and a score in the interval [10,30) corresponds to a "poor" level of freshness. Compared with the original strategy, the adjusted scoring conversion strategy lowers the upper limit of the scoring range corresponding to each freshness level, reflecting a higher sensitivity to the risk of spoilage. On the contrary, if the overall concentration of volatile component data is low, the scoring range can be appropriately relaxed. In this way, the scoring conversion strategy can be adaptively adjusted according to the distribution characteristics of volatile component data, so that the freshness level classification results are more in line with the actual freshness of the preserved eggs.
[0165] In some embodiments, the specific steps in step S52 include:
[0166] S521. Determine whether the volatile component data distribution conforms to the preset expected distribution, and if not, perform the following steps:
[0167] S5211. Calculate the degree of deviation of volatile component data from the expected distribution;
[0168] S5212. Determine the abnormality type according to the degree of deviation;
[0169] S5213. According to the abnormal type, select the corresponding score conversion strategy adjustment plan;
[0170] S5214. Adjust the score conversion strategy according to the corresponding score conversion strategy adjustment plan.
[0171] In step S521, judging whether the volatile component data distribution conforms to the preset expected distribution can be specifically implemented as follows: using a statistical method, such as a chi-square test, to perform a goodness of fit test on the volatile component data distribution and the expected distribution, thereby achieving a judgment on whether the data distribution conforms to the expected distribution.
[0172] In step S5211, the degree of deviation between the volatile component data and the expected distribution is calculated, which can be specifically implemented as follows: a distance measurement method, such as KL divergence or JS divergence, is used to calculate the distance value between the volatile component data distribution and the expected distribution, and the distance value is used as a quantitative representation of the degree of deviation.
[0173] In step S5212, the abnormality type is determined according to the degree of deviation, which can be specifically implemented as follows: a threshold range of the degree of deviation is pre-set, and different threshold ranges correspond to different abnormality types. By comparing the distance value calculated in step S5211 with the preset threshold range, the abnormality type to which the current volatile component data distribution belongs is determined. For example, when the degree of deviation is high, the abnormality type is determined to be a severe abnormality.
[0174] In step S5213, according to the abnormality type, the corresponding score conversion strategy adjustment plan is selected, which can be specifically implemented as follows: a mapping relationship between the abnormality type and the score conversion strategy adjustment plan is established, each abnormality type corresponds to at least one preset score conversion strategy adjustment plan, and according to the abnormality type determined in step S5212, the mapping relationship table is searched, and the corresponding score conversion strategy adjustment plan is selected. The score conversion strategy adjustment plan includes but is not limited to adjusting the parameters of the scoring function, switching to an alternative scoring function, or introducing a nonlinear scoring mechanism.
[0175] In step S5214, the scoring conversion strategy is adjusted according to the corresponding scoring conversion strategy adjustment plan, which can be specifically implemented as follows: if the selected scoring conversion strategy adjustment plan is to adjust the scoring function parameters, the parameters of the current scoring function are adjusted according to the preset parameter adjustment rules; if the selected scoring conversion strategy adjustment plan is to switch to a backup scoring function, the currently used scoring function is switched to the preset backup scoring function; if the selected scoring conversion strategy adjustment plan is to introduce a nonlinear scoring mechanism, a nonlinear scoring mechanism is introduced into the scoring model, such as segmented scoring or exponential scoring, thereby completing the adjustment of the scoring conversion strategy.
[0176] Through the above steps, when the freshness score exceeds the preset range, the score conversion strategy can be adjusted in a targeted manner according to the specific situation of the volatile component data distribution, thereby ensuring the effectiveness and accuracy of the exception handling mechanism.
[0177] Specifically, for the scenario of preserving eggs freshness level classification, the expected distribution can be set to a Gaussian distribution. In actual applications, the volatile component data of a batch of preserving eggs are first collected. Then, step S521 is performed, and the Kolmogorov-Smirnov test is used to determine whether the volatile component data distribution of this batch of preserving eggs conforms to the Gaussian distribution. If the test result shows that it does not conform to the Gaussian distribution, the subsequent exception handling steps are performed. In step S5211, the JS divergence between the actual data distribution and the Gaussian distribution is calculated to obtain the degree of deviation value. In step S5212, a degree of deviation threshold is preset. For example, when the JS divergence value is greater than 0.1, the abnormal type is determined to be "significant deviation from the distribution". In step S5213, for the abnormal type of "significant deviation from the distribution", the corresponding score conversion strategy adjustment scheme is selected as "switch to piecewise linear scoring function". In step S5214, the original linear scoring function is switched to a preset piecewise linear scoring function, which is configured to use different linear functions in different freshness scoring intervals, thereby adjusting the scoring conversion strategy to adapt to the abnormal distribution of volatile component data. In this way, when the volatile component data distribution is abnormal, the scoring conversion strategy can be dynamically adjusted to ensure the accuracy of the freshness level classification.
[0178] In some specific embodiments, for step S5212, the anomaly type can be refined into multiple types, such as "distribution peak shift", "distribution broadening" and "multi-peak distribution". For the "distribution peak shift" anomaly type, the score conversion strategy adjustment scheme can be selected as "adjusting the translation parameter of the scoring function"; for the "distribution broadening" anomaly type, the score conversion strategy adjustment scheme can be selected as "adjusting the scaling parameter of the scoring function"; for the "multi-peak distribution" anomaly type, the score conversion strategy adjustment scheme can be selected as "introducing a scoring strategy based on cluster analysis". As a result, the anomaly handling mechanism can select a more targeted score conversion strategy adjustment scheme based on a more refined anomaly type, further improving the accuracy and reliability of the freshness level division.
[0179] Please refer to Figure 2 , Figure 2 A device for analyzing the freshness of preserved eggs in some embodiments of the present invention is integrated into a back-end control device in the form of a computer program, and includes:
[0180] The collection module 100 is used to collect the ambient temperature and humidity data of the storage center;
[0181] A first calibration module 200, for performing a first calibration on freshness grading model parameters according to ambient temperature and humidity data;
[0182] The second calibration module 300 is used to extract a small amount of samples for testing before the next step of processing of each batch of preserved eggs, and then calibrate the freshness grading model parameters for the second time according to the test results;
[0183] The scoring module 400 is used to collect the volatile component data of the corresponding batch of preserved eggs and input the volatile component data into the freshness grading model after the second calibration to obtain a freshness score;
[0184] The classification module 500 is used to classify the freshness level of the corresponding batch of preserved eggs according to the freshness score.
[0185] In some embodiments, the second calibration module 300 is used to extract a small amount of samples for testing before the next step of processing each batch of preserved eggs, and then calibrate the freshness grading model parameters for the second time according to the test results:
[0186] S31. When the same batch of Songhua eggs is tested multiple times, the time interval between the current test and the previous test is obtained;
[0187] S32. If the time interval is greater than the preset threshold, the number of samples required for this test is increased and tested;
[0188] S33. Calculate the difference between this test result and previous test results;
[0189] S34. Adjusting the calibration amplitude of the freshness grading model parameters according to the difference;
[0190] S35. Based on the adjusted calibration amplitude, perform a second calibration on the freshness grading model parameters.
[0191] In some embodiments, the second calibration module 300 performs the following when calculating the difference between the current test result and the previous test results:
[0192] S331. Determine the selection strategy for the previous test results, the selection strategy includes: setting a time window, selecting the most recent N test results before the current test within the time window as the historical test data set;
[0193] S332. According to the selection strategy, multiple previous test results for calculating the difference are selected from the historical test data set;
[0194] S333. Calculate the difference between the current test result and the selected previous test results.
[0195] In some embodiments, the second calibration module 300 performs the following when calculating the difference between the current detection result and the selected previous detection results:
[0196] S3331. Collect the volatile component data of the samples taken for this test and use it as the test result;
[0197] S3332. The volatile component data sets of the samples corresponding to the previous test results selected in step S332 are combined as the previous test results;
[0198] S3333. Calculate the mean vector and standard deviation vector of each volatile component in the volatile component data set;
[0199] S3334. According to the mean vector and the standard deviation vector, the current test result and the previous test results are standardized based on the Z-score to obtain the standardized current test result and the standardized previous test results;
[0200] S3335. Set a weight vector for each volatile component, and based on the weight vector, calculate the weighted Euclidean distance between the standardized current test result and the standardized previous test results;
[0201] S3336. Set the time decay coefficient and obtain the timestamps corresponding to the previous test results. The time decay coefficient is used to control the influence of the timeliness of the previous test results;
[0202] S3337. Calculate the timeliness weights of all the test results according to the time decay coefficient and the timestamps corresponding to all the test results, and normalize the timeliness weights to obtain normalized timeliness weights;
[0203] S3338. Calculate the difference based on the weighted Euclidean distance and the normalized timeliness weight.
[0204] In some embodiments, the second calibration module 300 is executed when adjusting the calibration amplitude of the freshness grading model parameters according to the difference:
[0205] S341. Obtaining the preset basic calibration amplitude, maximum adjustment coefficient, steepness coefficient and time threshold, as well as the time interval obtained in step S31 and the difference calculated in step S33;
[0206] S342. Calculate the dynamic adjustment coefficient according to the time interval, time threshold, maximum adjustment coefficient and steepness coefficient;
[0207] S343. Calculate the calibration amplitude according to the difference, the basic calibration amplitude and the dynamic adjustment coefficient.
[0208] In some embodiments, the first calibration module 200 performs the following when calibrating the freshness grading model parameters for the first time according to the ambient temperature and humidity data:
[0209] S21. Obtain the state of the ambient temperature and humidity sensor, and perform the following steps when the ambient temperature and humidity sensor fails:
[0210] S211. Use a spare ambient temperature and humidity sensor to collect ambient temperature and humidity data, or use a time series prediction model to predict ambient temperature and humidity data based on historical ambient temperature and humidity data;
[0211] S212. Perform temperature drift compensation on the ambient temperature and humidity data;
[0212] S213. Use the compensated ambient temperature and humidity data to perform the first calibration on the freshness grading model parameters.
[0213] In some embodiments, the classification module 500 is used to classify the freshness level of the corresponding batch of preserved eggs according to the freshness score when performing:
[0214] S51. Determine whether the freshness score exceeds a preset range;
[0215] S52. If it exceeds the preset range, the exception handling mechanism is activated, and the score conversion strategy is adjusted according to the distribution characteristics of the volatile component data;
[0216] S53. Divide the freshness levels according to the adjusted score conversion strategy.
[0217] In some embodiments, the partitioning module 500 is used to adjust the score conversion strategy according to the volatile component data distribution characteristics when performing:
[0218] S521. Determine whether the volatile component data distribution conforms to the preset expected distribution, and if not, perform the following steps:
[0219] S5211. Calculate the degree of deviation of volatile component data from the expected distribution;
[0220] S5212. Determine the abnormality type according to the degree of deviation;
[0221] S5213. According to the abnormal type, select the corresponding score conversion strategy adjustment plan;
[0222] S5214. Adjust the score conversion strategy according to the corresponding score conversion strategy adjustment plan.
[0223] Please refer to Figure 3 , Figure 3The present invention provides a structural schematic diagram of an electronic device provided by an embodiment of the present invention. The present invention provides an electronic device 13, including: a processor 1301 and a memory 1302. The processor 1301 and the memory 1302 are interconnected and communicate with each other through a communication bus 1303 and / or other forms of connection mechanisms (not shown). The memory 1302 stores computer-readable instructions executable by the processor 1301. When the electronic device is running, the processor 1301 executes the computer-readable instructions to execute the method for analyzing the freshness of preserved eggs in any optional implementation of the above-mentioned embodiment to achieve the following functions: collecting environmental temperature and humidity data of a storage center; calibrating the parameters of a freshness grading model for the first time according to the environmental temperature and humidity data; before each batch of preserved eggs is processed in the next step, a small amount of samples are taken for testing, and then the parameters of the freshness grading model are calibrated for the second time according to the test results; collecting volatile component data of the corresponding batch of preserved eggs and inputting the volatile component data into the freshness grading model after the second calibration to obtain a freshness score; and classifying the freshness grades of the corresponding batch of preserved eggs according to the freshness score.
[0224] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for analyzing the freshness of preserved eggs in any optional implementation of the above-mentioned embodiment is executed to achieve the following functions: collecting ambient temperature and humidity data of a storage center; performing a first calibration on the parameters of a freshness grading model based on the ambient temperature and humidity data; taking a small amount of samples for testing before further processing each batch of preserved eggs, and performing a second calibration on the parameters of the freshness grading model based on the test results; collecting volatile component data of corresponding batches of preserved eggs and inputting the volatile component data into the freshness grading model after the second calibration to obtain a freshness score; and dividing the freshness grade of corresponding batches of preserved eggs according to the freshness score.
[0225] Among them, the computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0226] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0227] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0228] Furthermore, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0229] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0230] The above description is only an embodiment of the present invention and is not intended to limit the protection scope of the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for analyzing the freshness of preserved eggs, characterized in that: The following steps are involved: S1. Collect the ambient temperature and humidity data of the storage center; S2. Calibrate the freshness grading model parameters for the first time according to the ambient temperature and humidity data; S3. Before the next step of processing each batch of preserved eggs, a small amount of samples are taken for testing and the freshness grading model parameters are calibrated for the second time according to the test results; S4. Collecting the volatile component data of the corresponding batch of Songhua eggs and inputting the volatile component data into the freshness grading model after the second calibration to obtain a freshness score; S5. Classify the freshness grades of the corresponding batches of preserved eggs according to the freshness scores.
2. The method for analyzing the freshness of preserved eggs according to claim 1, characterized in that: The specific steps in step S3 include: S31. When the same batch of Songhua eggs is tested multiple times, the time interval between the current test and the previous test is obtained; S32. If the time interval is greater than the preset threshold, the number of samples required for this test is increased and tested; S33. Calculate the difference between this test result and previous test results; S34. Adjusting the calibration amplitude of the freshness grading model parameters according to the difference; S35. Based on the adjusted calibration amplitude, perform a second calibration on the freshness grading model parameters.
3. The method for analyzing the freshness of preserved eggs according to claim 2, characterized in that: The specific steps in step S33 include: S331. Determine the selection strategy of the previous test results, the selection strategy includes: setting a time window, selecting the most recent N test results before the current test within the time window as the historical test data set; S332. According to the selection strategy, select a plurality of previous test results for calculating the difference from the historical test data set; S333. Calculate the degree of difference based on the current test result and the selected previous test results.
4. The method for analyzing the freshness of preserved eggs according to claim 3, characterized in that: The specific steps in step S333 include: S3331. Collect the volatile component data of the samples taken for this test and use it as the test result; S3332. Collect the volatile component data sets of the samples corresponding to the previous test results selected in step S332 and merge them as the previous test results; S3333. Calculate the mean vector and standard deviation vector of each volatile component in the volatile component data set; S3334. According to the mean vector and the standard deviation vector, the current test result and the previous test results are standardized based on Z-score to obtain the standardized current test result and the standardized previous test results; S3335. Setting a weight vector for each volatile component, and based on the weight vector, calculating a weighted Euclidean distance between the standardized current test result and the standardized previous test results; S3336. Set a time decay coefficient and obtain the timestamps corresponding to the previous test results, where the time decay coefficient is used to control the degree of influence of the timeliness of the previous test results; S3337. Calculate the timeliness weights of all the test results according to the time decay coefficient and the timestamps corresponding to all the test results, and normalize the timeliness weights to obtain normalized timeliness weights; S3338. Calculate the degree of difference based on the weighted Euclidean distance and the normalized timeliness weight.
5. The method for analyzing the freshness of preserved eggs according to claim 2, characterized in that: The specific steps in step S34 include: S341. Obtaining the preset basic calibration amplitude, maximum adjustment coefficient, steepness coefficient and time threshold, as well as the time interval obtained in step S31 and the difference calculated in step S33; S342. Calculate a dynamic adjustment coefficient according to the time interval, the time threshold, the maximum adjustment coefficient and the steepness coefficient; S343. Calculate the calibration amplitude according to the difference, the basic calibration amplitude and the dynamic adjustment coefficient.
6. The method for analyzing the freshness of preserved eggs according to claim 1, characterized in that: The specific steps in step S5 include: S51. Determine whether the freshness score exceeds a preset range; S52. If it exceeds the preset range, the exception handling mechanism is activated, and the score conversion strategy is adjusted according to the distribution characteristics of the volatile component data; S53. Divide the freshness levels according to the adjusted score conversion strategy.
7. The method for analyzing the freshness of preserved eggs according to claim 6, characterized in that: The specific steps in step S52 include: S521. Determine whether the volatile component data distribution conforms to the preset expected distribution, and if not, perform the following steps: S5211. Calculate the degree of deviation of the volatile component data from the expected distribution; S5212. Determine the abnormality type according to the degree of deviation; S5213. According to the abnormal type, select the corresponding score conversion strategy adjustment plan; S5214. Adjust the score conversion strategy according to the corresponding score conversion strategy adjustment plan.
8. A device for analyzing the freshness of preserved eggs, characterized in that: include: The acquisition module is used to collect the ambient temperature and humidity data of the storage center; A first calibration module, used for performing a first calibration on freshness grading model parameters according to the environmental temperature and humidity data; The second calibration module is used to extract a small amount of samples for testing before the next step of processing of each batch of preserved eggs, and then calibrate the freshness grading model parameters for the second time according to the test results; A scoring module, used for collecting volatile component data of a corresponding batch of preserved eggs and inputting the volatile component data into a freshness grading model after the second calibration to obtain a freshness score; The classification module is used to classify the freshness level of the corresponding batch of preserved eggs according to the freshness score.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method for analyzing the freshness of preserved eggs as described in any one of claims 1 to 7 are executed.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the steps in the method for analyzing the freshness of preserved eggs as described in any one of claims 1 to 7 are executed.
Citation Information
Patent Citations
Improved VGG-19 freshness assessment method for chilled pomfret
CN113537394A
Flower freshness evaluation system based on visual inspection
CN119338763A
Rapid wearable data-driven bioelectronics device and platform for food freshness monitoring
US20210366590A1