A method, device, electronic device and storage medium for analyzing the freshness of preserved eggs
In the freshness detection of pineapple eggs in the fresh food storage center, the freshness grading model was calibrated twice using ambient temperature and humidity and volatile component data, and the problem of unstable detection results in the existing technology was solved, and the accuracy and reliability of freshness analysis of pineapple eggs was achieved, and the warehouse environment and batch differences were adapted to the warehouse environment and batch differences.
Patent Information
- Application Number
- CN202510325059.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2045-03-19
AI Technical Summary
The existing gas sensor equipment lacks adaptive optimization for warehouse-specific environmental conditions and batch differences in the freshness detection of pineapple eggs in fresh food storage centers, resulting in unstable detection results and poor consistency between batches, making it difficult to meet the accuracy and reliability requirements for long-term operation.
The first calibration was performed by collecting the ambient temperature and humidity data of the storage center, and the second calibration was performed after the detection. Combining the volatile component data, the freshness grading model parameters were dynamically adjusted to achieve adaptive analysis of different batches of pineapple eggs.
It improves the accuracy and reliability of the freshness analysis of the pineapple eggs, and can stably and quickly evaluate the freshness level of the pineapple eggs in multiple detection scenarios, adapt to environmental and batch differences, and ensure the consistency of long-term operation.
Smart Images

Figure CN120102815B_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 device and storage medium for analyzing the freshness of preserved eggs. Background Art
[0002] Large chain supermarket fresh food storage centers need to process a large number of preserved eggs every day. To ensure the quality of the products on the shelves, it is a crucial step to detect the freshness of each batch of preserved eggs. The traditional manual sampling detection method is not only time-consuming and laborious, but also the sampling results are difficult to accurately represent the overall freshness level of the entire batch of preserved eggs. Therefore, there is an urgent need for a portable, non-destructive and fast freshness analysis device in the fresh food storage center to improve the detection efficiency and reduce the labor cost.
[0003] At present, there are some devices based on gas sensors on the market that are applied to food freshness detection. Such devices usually use gas sensors to capture the volatile components released by food and analyze the sensor data through machine learning algorithms to achieve freshness grading. However, the environment in the fresh food storage center is complex and changeable, with frequent temperature and humidity fluctuations, and the initial quality of different batches of preserved eggs varies due to factors such as production processes and storage conditions. These environmental factors and product differences will significantly affect the detection results of gas sensors, resulting in unstable detection results and poor consistency between batches.
[0004] When the existing gas sensors and machine learning algorithms are directly applied to the freshness detection of preserved eggs in the fresh food storage center, they lack adaptive optimization for the specific environmental conditions of the warehouse and the differences between batches of preserved eggs, and it is difficult to meet the actual application requirements, especially in terms of long-term stable operation and ensuring the consistency of detection results, there are obvious deficiencies.
[0005] In response to the above problems, there is currently no effective technical solution. 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, to solve the problem that the existing technology lacks adaptive optimization for the specific environmental conditions of the warehouse and the differences between batches of preserved eggs, and to ensure the accuracy and reliability of the 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, including the following steps:
[0008] S1. Collect the environmental temperature and humidity data of the storage center;
[0009] S2. Perform the first calibration on the freshness grading model parameters according to the environmental temperature and humidity data;
[0010] S3. Before further processing each batch of preserved eggs, a small amount of samples are taken for testing, and based on the test results, the parameters of the freshness grading model are calibrated for the second time;
[0011] S4. Collect the volatile component data of the corresponding batch of preserved eggs and input the volatile component data into the freshness grading model calibrated for the second time to obtain a freshness score;
[0012] S5. Divide the freshness grade of the corresponding batch of preserved eggs according to the freshness score.
[0013] The method for analyzing the freshness of preserved eggs provided by the present invention, on the basis of ambient temperature and humidity calibration, further superimposes batch calibration parameters, enabling the model to better adapt to the overall characteristics of the current batch of preserved eggs. After completing batch calibration, the device can quickly and accurately analyze the freshness of the remaining large number of preserved eggs in this batch.
[0014] Further, the specific steps in step S3 include:
[0015] S31. When conducting multiple tests on the same batch of preserved eggs, obtain the time interval between the current test and the previous test;
[0016] S32. If the time interval is greater than a preset threshold, increase the number of samples to be taken for the current test and conduct the test;
[0017] S33. Calculate the difference degree between the current test result and the previous test results;
[0018] S34. Adjust the calibration amplitude of the parameters of the freshness grading model according to the difference degree;
[0019] S35. Based on the adjusted calibration amplitude, calibrate the parameters of the freshness grading model for the second time.
[0020] Effectively solve the accuracy and reliability problems that may exist in the simple second calibration method in multiple test scenarios, and improve the stability and precision of the method for analyzing the freshness of preserved eggs.
[0021] Further, the specific steps in step S33 include:
[0022] S331. Determine the selection strategy for the previous test results, and the selection strategy includes: setting a time window and selecting the nearest N previous test results within the time window before the current test as the historical test data set;
[0023] S332. According to the selection strategy, select multiple previous test results from the historical test data set for calculating the difference degree;
[0024] S333. Calculate the difference degree based on the current test result and the selected previous test results.
[0025] The historical data included in the calculation of the difference degree are all the most recent test data within the time window, ensuring the relevance between the historical data and the freshness status of the current batch of preserved eggs.
[0026] Further, the specific steps in step S333 include:
[0027] S3331. Collect the volatile component data of the samples extracted in the current test and use it as the current test result;
[0028] S3332. Collect the datasets of the volatile components of the samples corresponding to the selected previous test results in step S332 and use them as the previous test results;
[0029] S3333. Calculate the mean vector and standard deviation vector of each volatile component in the volatile component dataset;
[0030] S3334. Based on the mean vector and the standard deviation vector, perform Z-score based standardization on the current test result and the previous test results to obtain the standardized current test result and the standardized previous test results;
[0031] S3335. Set the 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 the time decay coefficient and obtain the timestamps corresponding to the previous test results, where the time decay coefficient is used to control the influence degree of the timeliness of the previous test results;
[0033] S3337. According to the time decay coefficient and the timestamps corresponding to the previous test results, calculate the timeliness weights of the previous test results and perform normalization on the timeliness weights to obtain the normalized timeliness weights;
[0034] S3338. Calculate the difference degree based on the weighted Euclidean distance and the normalized timeliness weights.
[0035] It can calculate the difference degree between the current test result and the previous test results more accurately and effectively, providing a reliable basis for calibrating the parameters of the subsequent freshness grading model.
[0036] Further, the specific steps in step S34 include:
[0037] S341. Obtain 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 degree calculated in step S33;
[0038] S342. Calculate a dynamic adjustment coefficient based on the time interval, the time threshold, the maximum adjustment coefficient, and the steepness coefficient;
[0039] S343. Calculate the calibration amplitude based on the difference degree, 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, activate an exception handling mechanism and adjust the score conversion strategy 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 distribution of the volatile component data conforms to a preset expected distribution, and if not, execute the following steps:
[0046] S5211. Calculate the degree of deviation of the volatile component data from the expected distribution;
[0047] S5212. Determine the type of abnormality according to the degree of deviation;
[0048] S5213. Select a corresponding scoring conversion strategy adjustment plan according to the type of abnormality;
[0049] S5214. Adjust the scoring conversion strategy according to the corresponding scoring conversion strategy adjustment plan.
[0050] In a second aspect, the present invention provides a fresh - degree analysis device for preserved eggs, including:
[0051] A collection module, configured to collect environmental temperature and humidity data of a storage center;
[0052] A first calibration module, configured to perform a first calibration on the parameters of the freshness classification model according to the environmental temperature and humidity data;
[0053] A second calibration module, which is used to extract a small amount of samples for detection before further processing each batch of preserved eggs, and perform a second calibration on the parameters of the freshness grading model according to the detection results;
[0054] A scoring module, which 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;
[0055] A partitioning module, which is used to partition the freshness grades of the corresponding batch of preserved eggs according to the freshness score.
[0056] The preserved egg freshness analysis device provided by the present invention 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.
[0057] In a third aspect, the present invention provides an electronic device, including a processor and a memory, where the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the preserved egg freshness analysis method provided in the first aspect above are run.
[0058] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the preserved egg freshness analysis method provided in the first aspect above are run.
[0059] As can be seen from the above, the preserved egg freshness analysis method provided by the present invention, aiming at the application scenario of the fresh food storage center of large chain supermarkets, in order to realize long-term, stable and consistent non-destructive grading of the freshness of multiple batches of preserved eggs with different initial qualities, uses gas sensors to quickly capture the volatile components of preserved eggs, and can continuously optimize the grading model through machine learning algorithms, overcome the detection deviation caused by the difference in initial quality between batches, and ensure 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 subsequent description, and part of them will become obvious from the description, or be understood by implementing the embodiments of the present invention. The objectives and other advantages of the present invention can be achieved and obtained through the structures specifically pointed out in the written description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 It is a flowchart of a preserved egg freshness analysis method provided by an embodiment of the present invention.
[0062] Figure 2 It is a schematic structural diagram of a preserved egg freshness analysis device provided by an embodiment of the present invention.
[0063] Figure 3 It is a schematic structural diagram of the electronic device provided by the embodiment of the present invention.
[0064] Label description:
[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. Specific embodiments
[0066] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying 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. Usually, the components of the embodiments of the present invention described and shown in the accompanying 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 accompanying drawings is not intended to limit the scope of the present invention to be protected, but only 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 creative efforts 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. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of the present invention, terms such as "first" and "second" are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0068] Refer to the attached Figure 1 , the present invention provides a method for analyzing the freshness of preserved eggs, including the following steps:
[0069] S1. Collect the environmental temperature and humidity data of the storage center;
[0070] S2. According to the environmental temperature and humidity data, perform the first calibration on the parameters of the freshness grading model;
[0071] S3. Before performing the next processing on each batch of preserved eggs, extract a small amount of samples for detection and then perform the second calibration on the parameters of the freshness grading model according to the detection results;
[0072] S4. 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;
[0073] S5. Divide the freshness grades of the corresponding batch of preserved eggs according to the freshness score.
[0074] In step S1, the ambient temperature and humidity data are collected through a temperature and humidity sensor network deployed in the storage center. The sensor network covers 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 terms of the model. The calibration process can adjust these parameters according to the ambient temperature and humidity data and the preset calibration rules to make the model preliminarily adapt to the environmental conditions of the storage center.
[0076] In step S3, the second calibration is carried out before processing each batch of preserved eggs. The purpose is to eliminate the differences between batches. A small number of samples can be randomly selected from each batch of preserved eggs, and the test results can be the data of the volatile components of the samples or other freshness indicators. The calibration process is to further adjust the model parameters according to these test results. For example, an online learning algorithm can be used to update the model parameters in real time according to the newly detected sample data.
[0077] In step S4, the volatile component data are collected through gas sensors. The gas sensors can non-destructively detect the volatile gases released by the preserved eggs. The volatile component data are input into the freshness grading model calibrated twice, and the model outputs a freshness score, and the score value reflects the freshness of the preserved eggs.
[0078] In step S5, the freshness grade is divided according to the freshness score. For example, a score threshold can be preset to divide the freshness score into multiple grades such as excellent, qualified, and unqualified. The result of the grade division is used to guide subsequent storage and sales decisions.
[0079] Specifically, the method for analyzing the freshness of preserved eggs proposed in this application aims to solve the technical problem of accurately analyzing the freshness of preserved eggs in the warehouse environment. The method is implemented through a freshness grading model calibrated twice. First, in step S1, the temperature and humidity data of the warehouse environment are collected, which are environmental factors affecting the freshness of preserved eggs. In step S2, the parameters of the freshness grading model are calibrated for the first time using the environmental temperature and humidity data, with the aim of adapting the model to the current warehouse environmental conditions and eliminating the interference of environmental factors on freshness detection. Then, in step S3, before each batch of preserved eggs is processed, a small number of samples are taken for testing, and the model parameters are calibrated for the second time according to the test results, with the aim of eliminating the influence caused by the differences between different batches of preserved eggs and improving the applicability of the model to different batches of preserved eggs. In step S4, the volatile component data of the batch of preserved eggs to be tested are collected and input into the model calibrated twice to obtain a freshness score. Volatile components are the key indicators for measuring freshness, and the freshness can be evaluated by analyzing the volatile component data through the model. Finally, in step S5, the preserved eggs are classified into different freshness grades according to the freshness score. Through the dual calibration of environmental 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 be a support vector machine model. In step S1, temperature and humidity sensors are arranged at different positions in the warehousing center, and data are collected every ten minutes to ensure the real-time and accuracy of environmental data. In step S2, the first calibration is carried out according to the preset mapping relationship between environmental temperature and humidity and model parameters. For example, in a high-temperature and high-humidity environment, the parameter representing the freshness decay rate in the model is adjusted to be larger. In step S3, 5 preserved egg samples are taken from each batch, and portable gas sensors are used to detect the volatile component data, with the detection time being 3 minutes / sample. The second calibration uses the gradient descent algorithm with an adaptive learning rate to fine-tune the model parameters according to the sample test results. In step S4, all the preserved eggs in the batch to be tested pass through the gas sensor detection area one by one, and the volatile component data are quickly collected, with the data processing time being less than 1 second / egg. In step S5, the freshness score is divided into three grades: above 90 points is excellent, 80 - 90 points is qualified, and below 80 points is unqualified.
[0081] In certain embodiments, the specific steps in step S3 include:
[0082] S31. When conducting multiple tests on the same batch of preserved eggs, obtain the time interval between the current test and the previous test;
[0083] S32. If the time interval is greater than the preset threshold, increase the number of samples to be taken for the current test and conduct the test;
[0084] S33. Calculate the difference degree between the current detection result and previous detection results;
[0085] S34. Adjust the calibration amplitude of the freshness grading model parameters according to the difference degree;
[0086] S35. Based on the adjusted calibration amplitude, perform the second calibration on the freshness grading model parameters.
[0087] Specifically, in the context of performing multiple freshness detections on the same batch of preserved eggs, simply performing the second calibration may not fully adapt to the fluctuations in detection results over time and the influence of different detection time intervals. Therefore, this embodiment introduces a time interval consideration mechanism. The time interval between the current detection and the previous detection is obtained through step S31. The acquisition of the time interval can be achieved by the system recording the timestamp of each detection. The difference between the timestamp of the current detection and the timestamp of the previous detection is the time interval, providing a reference in the time dimension for subsequent steps. When step S32 determines that the time interval exceeds the preset threshold, the number of sampled samples is increased to cope with the freshness changes that may be caused by a long time interval and ensure the representativeness of the detection samples. Step S33 quantifies the degree of fluctuation of the detection results by calculating the difference degree between the current detection result and previous detection results. Step S34 then dynamically adjusts the calibration amplitude of the model parameters according to this difference degree to achieve the self - adaptability of the calibration process. If the difference degree is high, the calibration amplitude is increased; otherwise, it is decreased, enabling the calibration of the model parameters to better adapt to data changes. Finally, step S35 performs the second calibration based on the adjusted calibration amplitude, realizing a more refined and reliable update of the model parameters. 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, improving the stability and precision 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 previous detection results. The selection strategy includes: setting a time window and selecting the most recent N detection results before the current detection within the time window as the historical detection data set;
[0090] S332. According to the selection strategy, select multiple previous detection results from the historical detection data set for calculating the difference degree;
[0091] S333. Calculate the difference degree according to the current detection result and the selected previous detection results.
[0092] In this embodiment, a selection strategy is set to ensure the timeliness and relevance of the historical detection results used for calculating the difference degree. The selection strategy is specifically to set a time window and select the most recent N detection results before this detection within the time window as the historical detection data set. The setting of the time window limits the selection range of the historical detection results and avoids the introduction of historical data that is too old in time. By selecting the most recent N detection results within the time window, the quantity of historical data is taken into account while ensuring the timeliness of the data, thereby enabling a more accurate calculation of the difference degree between the current detection result and the previous detection results.
[0093] Specifically, in the analysis method for the freshness of preserved eggs, in order to calculate the difference degree between the current detection result and the previous detection results more reasonably and effectively, the selection strategy for the previous detection results is determined. The formulation of the selection strategy aims to solve the technical problem of how to select representative historical detection results when calculating the difference degree. A time window is set. For example, it can be set to the most recent week or the most recent month to limit the scope of investigation of historical data. Within the determined time window, the system will further screen and select the most recent N detection results before the current detection time point. The value of N can be adjusted according to the actual detection frequency and data volume. For example, the most recent 3 or 5 detection results can be selected. In this way, the historical data included in the difference degree calculation are all the most recent detection data within the time window, ensuring the relevance between the historical data and the freshness status of the current batch of preserved eggs. Thereby, the historical data that may be irrelevant to the freshness of the current batch of preserved eggs introduced by using all historical data is excluded, improving the accuracy of the difference degree calculation. At the same time, by selecting the most recent N detection results within the time window, the quantity of historical data is also taken into account while ensuring the timeliness of the data, making the difference degree calculation result more stable and reliable.
[0094] In some specific embodiments, for the freshness detection of preserved eggs, the selection strategy is adopted to determine the previous detection results used for the difference degree calculation. The time window is set to 7 days and the value of N is set to 3. When daily freshness detection of batch preserved eggs is carried out, when performing the detection on the current day, the system will review the detection records within the past 7 days. If there are 3 or more detection records within the past 7 days, the 3 detection records closest to the current detection time are selected as the historical detection data set. If the number of detection records within the past 7 days is less than 3, for example, only 2, then these 2 detection records are all included in the historical detection data set. Subsequently, the difference degree between the current detection result and the previous detection results selected from the historical detection data set is calculated, and the difference degree calculation result will be used for the calibration and adjustment of the subsequent freshness grading model parameters. Through this implementation method, it is ensured that the historical data used for the difference degree calculation is the most recent and representative data, realizing the rationality and effectiveness of the difference degree calculation.
[0095] In some embodiments, the specific steps in step S333 include:
[0096] S33; Collect the volatile component data of the sample extracted in this test and use it as the result of this test;
[0097] S3332. Collect the data sets of the volatile components of the samples corresponding to the previous test results selected in step S332 and use them 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. Based on the mean vector and standard deviation vector, perform Z-score based standardization on the result of this test and the previous test results to obtain the standardized result of this test and the standardized previous test results;
[0100] Specifically, calculate the standardized result of this test according to the following formula:
[0101] ; ;
[0102] ;
[0103] Where Is the standardized data of the Th volatile component in the result of this test, Is the data of the Th volatile component in the result of this test, Is the mean vector of the data of the Th volatile component, Is the standard deviation vector of the data of the Th volatile component; Is the number of types of volatile components; Is the standardized result of this test;
[0104] Calculate the standardized previous test results according to the following formula:
[0105] ; ;
[0106] ;
[0107] Where Is the standardized data of the Th volatile component in the Th previous test result, Is the Th previous test result, the Volatile component data is the number of selected previous test results is the th previous test result after standardization
[0108] S3335. Set the weight vector for each volatile component, and based on the weight vector, calculate the weighted Euclidean distance between the current test result after standardization and the previous test results after standardization
[0109] Specifically, calculate the weighted Euclidean distance according to the following formula
[0110] ;
[0111] ;
[0112] where is the weighted Euclidean distance with respect to , and , is the set of weight vectors for all volatile components is the weight vector for the th volatile component
[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 degree of the timeliness of the previous test results
[0114] S3337. According to the time decay coefficient and the timestamps corresponding to the previous test results, calculate the timeliness weights of the previous test results, and perform normalization on the timeliness weights to obtain the normalized timeliness weights
[0115] Specifically, calculate the timeliness weights according to the following formula
[0116] ;
[0117] where is the timeliness weight of the th previous test result is the time decay coefficient is the current time is the th timestamp of the previous test result
[0118] Calculate the normalized timeliness weights according to the following formula
[0119] ; ; ; ;
[0120] Among them, the normalized timeliness weight of the th historical test result; the timeliness weight of the
[0121] S3338. Calculate the difference degree according to the weighted Euclidean distance and the normalized timeliness weight;
[0122] Specifically, calculate the difference degree according to the following formula:
[0123] ;
[0124] Among them, is the difference degree.
[0125] Step S333 aims to accurately and effectively calculate the difference degree between the current test result and the historical test results. To achieve this goal, a series of refined steps are proposed.
[0126] First of all, step S3333 calculates the mean vector and standard deviation vector of the historical test volatile component data, providing a benchmark for subsequent standardization processing.
[0127] Step S3334 performs standardization based on Z-score. By subtracting the mean and dividing by the standard deviation, the current and historical test data are converted to the same scale, eliminating the differences in dimension and numerical range, 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 consider the timeliness of historical data. By calculating the timeliness weight through the time decay coefficient and the timestamp and normalizing it, the data closer in time has a higher weight.
[0130] Thus, step S3338 combines the weighted Euclidean distance and the normalized timeliness weight to finally obtain the difference degree that comprehensively considers the component difference and time decay.
[0131] Specifically, after obtaining the volatile component data of this detection and previous detections, the system first calculates the average value and standard deviation of each volatile component for the previous detection data. For example, assuming that three volatile components are detected and the previous detection data forms a component matrix, the mean and standard deviation of each component in previous detections are calculated respectively to form a mean vector and a standard deviation vector. Then, the Z-score normalization formula is used to normalize the data of this detection and previous detections. For each volatile component, its mean value in previous detections is subtracted and then divided by its standard deviation. The normalized data enables the values of different components to be within a comparable range. To reflect the different degrees of influence of different volatile components on freshness, a component weight vector is preset in advance, and the weight values can be determined according to the contribution degree of the components to freshness. Higher weights are assigned to important components. When calculating the difference degree, the weighted Euclidean distance formula is used to calculate the distance between the normalized data of this detection and the normalized data of previous detections, and the distance value is weighted and adjusted by the component weights. To reflect the timeliness of previous detection results, a time decay coefficient is set, such as 0.9. The farther the previous detection results are from the current time, the lower their weights. According to the time decay coefficient and the timestamps of previous detection results, the timeliness weights of each previous detection result are calculated and normalized to ensure that the sum of the weights is 1. The final difference degree is calculated through the weighted Euclidean distance and the normalized timeliness weights. For example, the weighted Euclidean distance can be multiplied by the normalized timeliness weights, and then the product values of all previous detection results are added to obtain the final difference degree.
[0132] In some specific embodiments, the volatile component data is collected by a gas sensor array, and each gas sensor responds to one or more volatile components. The selection strategy for previous detection results is to set a time window and select the 5 most recent detection results within the time window as the historical detection data set. The standard deviation used in the Z-score normalization process is the sample standard deviation. The volatile component weight vector is preset in advance according to expert experience or component importance analysis methods. The time decay coefficient is set to 0.85, indicating that for each time unit passed, the weight of historical data decays to 0.85 times the original. The normalization process of the timeliness weights uses the softmax normalization method. The difference degree calculation formula is the weighted average of the weighted Euclidean distance and the normalized timeliness weights. Through the above specific steps, the difference degree between the results of this detection and previous detections can be calculated more accurately and effectively, providing a reliable basis for calibrating the parameters of the subsequent freshness grading model.
[0133] In certain embodiments, the specific steps in step S34 include:
[0134] S341. Obtain 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 degree 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] where, is the dynamic adjustment coefficient, is the maximum adjustment coefficient, is the steepness coefficient, is the time interval, is the time threshold;
[0138] S343. Calculate the calibration amplitude according to the difference degree, basic calibration amplitude, and dynamic adjustment coefficient; specifically, calculate the calibration amplitude according to the following formula:
[0139] ;
[0140] where, is the calibration amplitude, is the basic calibration amplitude, is the difference degree, is the dynamic adjustment coefficient.
[0141] Step S34 is designed to dynamically adjust the calibration amplitude. To achieve this goal, step S341 is designed as a parameter acquisition step, which is used to collect all the parameters required for subsequent calculations. These parameters include the preset basic calibration amplitude, which represents the basic adjustment amount for model parameter calibration; the maximum adjustment coefficient, which limits the maximum range of dynamic adjustment; the steepness coefficient, which controls the rate of change of the dynamic adjustment coefficient with the time interval; the time threshold, which is used as a benchmark for judging the length of the time interval; and the detection time interval and difference degree obtained from steps S31 and S33.
[0142] Step S342 is the dynamic adjustment coefficient calculation step. The calculation of the dynamic adjustment coefficient is designed to consider 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. This time-related function can be, for example, an exponential decay function or an S-shaped function, and its 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 the speed at which the dynamic adjustment coefficient changes with the time interval.
[0143] Step S343 is the calibration amplitude calculation step. The calibration amplitude is calculated by comprehensively considering the difference degree, the basic calibration amplitude, and the dynamic adjustment coefficient. A possible calculation method is to add the basic calibration amplitude to the product of the dynamic adjustment coefficient and the difference degree. Thus, the magnitude of the calibration amplitude depends not only on the degree of difference in the detection results but also on the detection time interval, realizing the dynamic adjustment of the calibration amplitude.
[0144] Specifically, this solution aims to provide a more refined model parameter calibration method. By introducing the dynamic adjustment coefficient, the calibration amplitude can be dynamically adjusted according to the detection time interval. When the time interval between two detections is long, the dynamic adjustment coefficient increases, causing the calibration amplitude to also increase, 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 the model parameters and maintaining the stability of the model. This dynamic adjustment mechanism makes the model calibration process more intelligent and self-adaptive, and can better cope with the fluctuations in the environment of the fresh food storage center and the quality of the preserved eggs themselves.
[0145] In some embodiments, the specific steps in step S2 include:
[0146] S21. Obtain the status of the environmental temperature and humidity sensor, and when the environmental temperature and humidity sensor fails, perform the following steps:
[0147] S211. Use a backup environmental temperature and humidity sensor to collect environmental temperature and humidity data, or predict environmental temperature and humidity data using a time series prediction model based on historical environmental temperature and humidity data;
[0148] S212. Perform temperature drift compensation on the environmental temperature and humidity data;
[0149] S213. Use the compensated environmental temperature and humidity data to perform the first calibration on the freshness grading model parameters.
[0150] In step S21, the acquisition of the status of the environmental temperature and humidity sensor can be implemented as regularly checking whether the sensor readings are within a reasonable range. The sensor status can be defined as two states: normal or failed.
[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, and 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, the temperature drift compensation is to improve the accuracy of data, and the compensation method may include periodically calibrating the sensor or using a statistical model to correct the data.
[0153] In step S213, the calibration process is to adjust the model parameters according to the ambient 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 status of the ambient temperature and humidity sensor. The system detects the status of the main sensor to determine whether the sensor is working properly. If the main sensor is working properly, the data collected by the sensor is directly used. If it is detected that the main sensor fails, step S211 is executed. In S211, the system provides two alternative solutions to continuously obtain the ambient temperature and humidity data. The first solution is to enable the backup ambient temperature and humidity sensor. The second solution is to analyze the historical ambient temperature and humidity data using a time series prediction model, 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 perform temperature drift compensation on the data. The temperature drift compensation technology can correct data errors and improve the accuracy of the data. In step S213, the first calibration of the parameters of the freshness grading model is performed using the ambient temperature and humidity data after temperature drift compensation. Thus, even in the case where the ambient temperature and humidity sensor fails, the system can still obtain reliable ambient temperature and humidity data and complete the first calibration of the parameters of the freshness grading model based on this, ensuring the stability and reliability of the method for analyzing the freshness of preserved eggs.
[0155] In some specific embodiments, the acquisition of the status of the ambient temperature and humidity sensor may be to periodically send a heartbeat signal and monitor the response. If the main ambient temperature and humidity sensor does not respond to the heartbeat signal within the 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. The temperature drift compensation can adopt the Kalman filter algorithm. The calibrated ambient temperature and humidity data are then used to update the parameters of the freshness grading model. For example, the weight coefficients in the model can be adjusted by the gradient descent method to minimize the error between the predicted freshness of the model and the actual freshness.
[0156] In certain embodiments, the specific steps in step S5 include:
[0157] S51. Determine whether the freshness score exceeds the preset range;
[0158] S52. If it exceeds the preset range, start the exception handling mechanism and adjust the scoring conversion strategy according to the distribution characteristics of volatile component data;
[0159] S53. Divide the freshness levels according to the adjusted scoring conversion strategy.
[0160] In step S51, the preset range is set to define the fluctuation range of the normal freshness score. As an implementation, the preset range can be set as the interval [0, 100]. The freshness score is compared with this preset range to determine whether the freshness score is abnormal.
[0161] In step S52, the starting condition of the exception handling mechanism is that the freshness score exceeds the preset range. The analysis of the distribution characteristics of volatile component data is to explore the reasons for the abnormality of the freshness score. For example, the distribution of volatile component data may show a skewness or multimodality different from the normal distribution, and these distribution characteristics can reflect the specific types of freshness abnormalities of the preserved eggs, such as whether the abnormality is caused by spoilage or interference from environmental factors. The adjustment of the scoring conversion strategy is based on the analysis results, aiming to correct the scoring deviation caused by abnormal situations and ensure the accuracy of the freshness level division. The scoring conversion strategy can be a pre-set mapping relationship between the scoring interval and the freshness level. Adjusting the scoring conversion strategy can be to adjust the boundaries of the scoring interval in the mapping relationship.
[0162] In step S53, the adjusted scoring conversion strategy will be used to re-divide the freshness levels to ensure that the finally obtained freshness levels can accurately reflect the true freshness status of the preserved eggs.
[0163] Specifically, after obtaining the freshness score, first perform step S51 to determine whether the score is within a 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. Conversely, if the score exceeds the normal range, for example, the score value is too high or too low, it is determined that the score is abnormal, and at this time, the abnormal handling mechanism in step S52 is activated. In step S52, the abnormal handling mechanism further analyzes the collected volatile component data and evaluates the characteristics of the data distribution. For example, calculate statistical quantities such as the mean, variance, skewness, and kurtosis of the volatile component data, or use a clustering algorithm to perform clustering analysis on the volatile component data. Through the analysis results, it can be judged whether the volatile component data deviates from the normal distribution range and the specific form of the deviation. According to the data distribution characteristics, determine the type of abnormality. For example, the type of abnormality can be divided into various types such as the overall high concentration of volatile components, the overall low concentration of volatile components, and the abnormal high concentration of specific volatile components. For different types of abnormalities, select the corresponding score conversion strategy adjustment plan. For example, if the overall concentration of volatile components is high, it may be that the preserved eggs have undergone slight spoilage. At this time, the score interval of the "fresh" level in the score conversion strategy can be appropriately tightened, and the score 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 environmental temperature and humidity are too low to inhibit the release of volatile components. At this time, the score interval of the "fresh" level in the score conversion strategy can be appropriately relaxed. After completing the adjustment of the score conversion strategy, perform step S53, use the adjusted score conversion strategy to re-convert the freshness score into a freshness level, and obtain the final freshness level division result. Thus, it can be ensured that when the freshness score is abnormal, the accuracy and reliability of the freshness level division are 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 range of [80, 90] corresponds to the "excellent" level of freshness, a score in the range of [60, 80) corresponds to the "good" level of freshness, a score in the range of [40, 60) corresponds to the "medium" level of freshness, and a score in the range of [10, 40) corresponds to the "poor" level of freshness. When the freshness score exceeds the range of [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 concentrations of volatile components indicating spoilage, such as hydrogen sulfide, ammonia, etc., increase significantly, it is determined as a spoilage-type exception, and the score conversion strategy is adjusted as follows: a score in the range of [70, 80] corresponds to the "excellent" level of freshness, a score in the range of [50, 70) corresponds to the "good" level of freshness, a score in the range of [30, 50) corresponds to the "medium" level of freshness, and a score in the range of [10, 30) corresponds to the "poor" level of freshness. Compared with the score conversion strategy before adjustment, the upper limit of the score range corresponding to each freshness level is reduced after adjustment, reflecting a higher sensitivity to the risk of spoilage. Conversely, if the overall concentration of volatile component data is low, the score range can be appropriately widened. In this way, the score conversion strategy can be adaptively adjusted according to the distribution characteristics of volatile component data, making the result of freshness level division more in line with the actual freshness condition of the preserved eggs.
[0165] In certain embodiments, the specific steps in step S52 include:
[0166] S521. Determine whether the distribution of volatile component data conforms to the preset expected distribution, and if it does not conform, execute the following steps: [[ID=VIII]]
[0167] S5211. Calculate the degree of deviation between the volatile component data and the expected distribution;
[0168] S5212. Determine the type of exception according to the degree of deviation;
[0169] S5213. Select the corresponding score conversion strategy adjustment plan according to the type of exception;
[0170] S5214. Adjust the score conversion strategy according to the corresponding score conversion strategy adjustment plan.
[0171] In step S521, determining whether the distribution of volatile component data conforms to the preset expected distribution can be specifically implemented as follows: using a statistical method, such as the chi-square test, to perform a goodness-of-fit test on the distribution of volatile component data and the expected distribution, thereby realizing the judgment of whether the data distribution conforms to the expected distribution.
[0172] In step S5211, calculating the degree of deviation between the volatile component data and the expected distribution can be specifically implemented as follows: Using a distance metric method, such as KL divergence or JS divergence, calculate the distance value between the distribution of the volatile component data and the expected distribution, and the distance value is used as a quantitative representation of the degree of deviation.
[0173] In step S5212, determining the type of anomaly according to the degree of deviation can be specifically implemented as follows: Preset a range of deviation degree thresholds in advance, and different threshold ranges correspond to different types of anomalies. By comparing the distance value calculated in step S5211 with the preset threshold range, determine the type of anomaly to which the current volatile component data distribution belongs. For example, when the degree of deviation is relatively high, the type of anomaly is determined to be a severe anomaly.
[0174] In step S5213, selecting a corresponding scoring transformation strategy adjustment plan according to the type of anomaly can be specifically implemented as follows: Establish a mapping relationship between the type of anomaly and the scoring transformation strategy adjustment plan. Each type of anomaly corresponds to at least one preset scoring transformation strategy adjustment plan. According to the type of anomaly determined in step S5212, look up the mapping relationship table and select the corresponding scoring transformation strategy adjustment plan. The scoring transformation strategy adjustment plan includes, but is not limited to, adjusting the parameters of the scoring function, switching to a backup scoring function, or introducing a non-linear scoring mechanism.
[0175] In step S5214, adjusting the scoring transformation strategy according to the corresponding scoring transformation strategy adjustment plan can be specifically implemented as follows: If the selected scoring transformation strategy adjustment plan is to adjust the parameters of the scoring function, then adjust the parameters of the current scoring function according to the preset parameter adjustment rules; if the selected scoring transformation strategy adjustment plan is to switch to a backup scoring function, then switch the currently used scoring function to the preset backup scoring function; if the selected scoring transformation strategy adjustment plan is to introduce a non-linear scoring mechanism, then introduce a non-linear scoring mechanism, such as piecewise scoring or exponential scoring, into the scoring model. Thus, the adjustment of the scoring transformation strategy is completed.
[0176] Through the above steps, when the freshness score exceeds the preset range, it is possible to adjust the scoring transformation strategy specifically according to the distribution of the volatile component data, ensuring the effectiveness and accuracy of the anomaly handling mechanism.
[0177] Specifically, for the scenario of classifying the freshness level of preserved eggs, the expected distribution can be set as a Gaussian distribution. In practical applications, first, collect the volatile component data of a batch of preserved eggs. Then, perform step S521, and use the Kolmogorov-Smirnov test to determine whether the distribution of the volatile component data of this batch of preserved eggs conforms to the Gaussian distribution. If the test result shows non-conformance to the Gaussian distribution, then execute the subsequent exception handling steps. In step S5211, calculate the JS divergence between the actual data distribution and the Gaussian distribution to obtain the deviation degree value. In step S5212, preset the deviation degree threshold. For example, when the JS divergence value is greater than 0.1, the exception type is determined to be "significant distribution deviation". In step S5213, for the exception type of "significant distribution deviation", select the corresponding scoring transformation strategy adjustment plan as "switch to a piecewise linear scoring function". In step S5214, switch the original linear scoring function to the preset piecewise linear scoring function, and the piecewise linear scoring function is configured to use different linear functions in different freshness scoring intervals. Thus, adjust the scoring transformation strategy to adapt to the abnormal situation of the volatile component data distribution. In this way, when the volatile component data distribution is abnormal, the scoring transformation strategy can be dynamically adjusted to ensure the accuracy of the freshness level classification.
[0178] In some specific embodiments, for step S5212, the exception type can be refined into multiple types, such as "distribution peak shift", "distribution broadening", and "multi-peak distribution". For the exception type of "distribution peak shift", the scoring transformation strategy adjustment plan can be selected as "adjust the translation parameter of the scoring function"; for the exception type of "distribution broadening", the scoring transformation strategy adjustment plan can be selected as "adjust the scaling parameter of the scoring function"; for the exception type of "multi-peak distribution", the scoring transformation strategy adjustment plan can be selected as "introduce a scoring strategy based on cluster analysis". Thus, the exception handling mechanism can select a more targeted scoring transformation strategy adjustment plan according to the more refined exception type, further improving the accuracy and reliability of the freshness level classification.
[0179] Please refer to Figure 2 , Figure 2 which is a preserved egg freshness analysis device in some embodiments of the present invention. The preserved egg freshness analysis device is integrated in the backend control device in the form of a computer program, and includes:
[0180] A collection module 100, configured to collect the environmental temperature and humidity data of the storage center;
[0181] A first calibration module 200, configured to perform the first calibration on the freshness grading model parameters according to the environmental temperature and humidity data;
[0182] The second calibration module 300 is used to, before performing the next processing on each batch of preserved eggs, extract a small amount of samples for testing and then perform a second calibration on the freshness grading model parameters 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 partitioning module 500 is used to partition the freshness grade of the corresponding batch of preserved eggs according to the freshness score.
[0185] In some embodiments, when the second calibration module 300 is used to, before performing the next processing on each batch of preserved eggs, extract a small amount of samples for testing and then perform a second calibration on the freshness grading model parameters according to the test results, it executes:
[0186] S31. When performing multiple tests on the preserved eggs of the same batch, obtain the time interval between the current test and the previous test;
[0187] S32. If the time interval is greater than a preset threshold, increase the number of samples to be extracted for the current test and perform the test;
[0188] S33. Calculate the difference degree between the current test result and the previous test results;
[0189] S34. Adjust the calibration amplitude of the freshness grading model parameters according to the difference degree;
[0190] S35. Based on the adjusted calibration amplitude, perform a second calibration on the freshness grading model parameters.
[0191] In some embodiments, when the second calibration module 300 is used to calculate the difference degree between the current test result and the previous test results, it executes:
[0192] S331. Determine the selection strategy for the previous test results. The selection strategy includes: setting a time window and selecting the most recent N test results within the time window before the current test as the historical test data set;
[0193] S332. According to the selection strategy, select multiple previous test results from the historical test data set for calculating the difference degree;
[0194] S333. Calculate the difference degree according to the current test result and the selected previous test results.
[0195] In some embodiments, when the second calibration module 300 is used to calculate the difference degree according to the current test result and the selected previous test results, it executes:
[0196] S3331. Collect the volatile component data of the samples extracted in this test as the result of this test;
[0197] S3332. Collect the data sets of the volatile components of the samples corresponding to the previous test results selected in step S332 and combine them 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. Based on the mean vector and standard deviation vector, perform Z-score based standardization on the result of this test and the previous test results to obtain the standardized result of this test and the standardized previous test results;
[0200] S3335. Set the weight vector for each volatile component, and based on the weight vector, calculate the weighted Euclidean distance between the standardized result of this test 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 degree of the timeliness of the previous test results;
[0202] S3337. According to the time decay coefficient and the timestamps corresponding to the previous test results, calculate the timeliness weights of the previous test results and perform normalization processing on the timeliness weights to obtain the normalized timeliness weights;
[0203] S3338. Calculate the difference degree based on the weighted Euclidean distance and the normalized timeliness weights.
[0204] In some embodiments, when the second calibration module 300 is used to adjust the calibration amplitude of the freshness grading model parameters according to the difference degree, it performs:
[0205] S341. Obtain 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 degree 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 degree, basic calibration amplitude and dynamic adjustment coefficient.
[0208] In some embodiments, when the first calibration module 200 is used to perform the first calibration of the freshness grading model parameters according to the ambient temperature and humidity data, it performs:
[0209] S21. Obtain the status of the environmental temperature and humidity sensor, and perform the following steps when the environmental temperature and humidity sensor fails:
[0210] S211. Collect environmental temperature and humidity data using a backup environmental temperature and humidity sensor, or predict environmental temperature and humidity data using a time series prediction model based on historical environmental temperature and humidity data;
[0211] S212. Perform temperature drift compensation on the environmental temperature and humidity data;
[0212] S213. Use the compensated environmental temperature and humidity data to perform the first calibration on the parameters of the freshness grading model.
[0213] In some embodiments, when the partitioning module 500 is used to partition the freshness grades of the corresponding batches of preserved eggs according to the freshness score, it performs:
[0214] S51. Determine whether the freshness score exceeds the preset range;
[0215] S52. If it exceeds the preset range, start the exception handling mechanism and adjust the score conversion strategy according to the distribution characteristics of the volatile component data;
[0216] S53. Partition the freshness grades according to the adjusted score conversion strategy.
[0217] In some embodiments, when the partitioning module 500 is used to adjust the score conversion strategy according to the distribution characteristics of the volatile component data, it performs:
[0218] S521. Determine whether the distribution of the volatile component data conforms to the preset expected distribution, and perform the following steps when it does not conform:
[0219] S5211. Calculate the degree of deviation between the volatile component data and the expected distribution;
[0220] S5212. Determine the type of exception according to the degree of deviation;
[0221] S5213. Select the corresponding score conversion strategy adjustment plan according to the type of exception;
[0222] S5214. Adjust the score conversion strategy according to the corresponding score conversion strategy adjustment plan.
[0223] Please refer to Figure 3 , Figure 3A schematic structural 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 marked). The memory 1302 stores computer-readable instructions executable by the processor 1301. When the electronic device runs, the processor 1301 executes the computer-readable instructions to execute the preserved egg freshness analysis method in any optional implementation manner of the above embodiment to achieve the following functions: collecting environmental temperature and humidity data of the storage center; performing a first calibration on the parameters of the freshness grading model according to the environmental temperature and humidity data; before performing the next treatment on each batch of preserved eggs, extracting a small amount of samples for detection and then performing a second calibration on the parameters of the freshness grading model according to the detection 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 dividing the freshness level 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, on which a computer program is stored. When the computer program is executed by a processor, it executes the preserved egg freshness analysis method in any optional implementation manner of the above embodiment to achieve the following functions: collecting environmental temperature and humidity data of the storage center; performing a first calibration on the parameters of the freshness grading model according to the environmental temperature and humidity data; before performing the next treatment on each batch of preserved eggs, extracting a small amount of samples for detection and then performing a second calibration on the parameters of the freshness grading model according to the detection 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 dividing the freshness level of the corresponding batch 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 for short), electrically erasable programmable read-only memory (EEPROM for short), erasable programmable read-only memory (EPROM for short), programmable read-only memory (PROM for short), read-only memory (ROM for short), magnetic memory, 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 illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For another 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 displayed or discussed couplings or direct couplings or communication connections to each other can be through some communication interfaces. The indirect couplings or communication connections of the 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. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0228] Furthermore, in each embodiment of the present invention, the functional modules can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.
[0229] In this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0230] The above are only embodiments of the present invention and are not intended to limit the protection scope of the present invention. For those skilled in the art, the present invention can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for analyzing the freshness of preserved eggs, characterized in that, It includes the following steps: S1. Collect the environmental temperature and humidity data of the storage center; S2. According to the environmental temperature and humidity data, perform the first calibration on the parameters of the freshness grading model; S3. Before further processing each batch of preserved eggs, extract a small amount of samples for testing and then perform the second calibration on the parameters of the freshness grading model according to the test results; S4. 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 the freshness score; S5. Divide the freshness grades of the corresponding batch of preserved eggs according to the freshness score; The specific steps in step S3 include: S31. When performing multiple tests on the same batch of preserved eggs, obtain the time interval between the current test and the previous test; S32. If the time interval is greater than the preset threshold, increase the number of samples to be extracted for the current test and perform the test; S33. Calculate the difference degree between the current test result and the previous test results; S34. Adjust the calibration amplitude of the parameters of the freshness grading model according to the difference degree; S35. Based on the adjusted calibration amplitude, perform the second calibration on the parameters of the freshness grading model; The specific steps in step S34 include: S341. Obtain 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 degree calculated in step S33; S342. Calculate the dynamic adjustment coefficient according to the time interval, the time threshold, the maximum adjustment coefficient and the steepness coefficient; Calculate the dynamic adjustment coefficient according to the following formula: ; Among them, is the dynamic adjustment coefficient, is the maximum adjustment coefficient, is the steepness coefficient, is the time interval, is the time threshold; S343. Calculate the calibration amplitude according to the difference degree, the basic calibration amplitude and the dynamic adjustment coefficient; Calculate the calibration amplitude according to the following formula: ; Among them, is the calibration amplitude, is the basic calibration amplitude, is the difference degree, is the dynamic adjustment coefficient.
2. The method for analyzing the freshness of preserved eggs according to claim 1, wherein The specific steps in step S33 include: S331. Determine the selection strategy for the previous test results. The selection strategy includes: setting a time window and selecting the nearest N previous test results within the time window before the current test as the historical test data set; S332. According to the selection strategy, select multiple previous test results from the historical test data set for calculating the difference degree; S333. Calculate the difference degree according to the current test result and the selected previous test results.
3. The method for analyzing the freshness of preserved eggs according to claim 2, characterized in that, The specific steps in step S333 include: S3331. Collect the volatile component data of the samples extracted for the current test and use it as the current test result; S3332. Collect the volatile component data sets of the samples corresponding to the selected previous test results in step S332 and combine 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, perform Z-score based standardization processing on the current test result and the previous test results to obtain the standardized current test result and the standardized previous test results; Calculate the standardized current test result according to the following formula: ; ; ; Among them, is the standardized data of the th volatile component in the current test result, is the data of the th volatile component in the current test result, is the mean vector of the data of the th volatile component, is the standard deviation vector of the data of the th volatile component; is the number of types of volatile components; is the current test result after standardization; Calculate the normalized previous test results according to the following formula: ; ; ; Among them, is the standardized data of the th volatile component in the th previous test results, is the data of the th volatile component in the th previous test results; is the number of selected previous test results; is the th previous test result after standardization; S3335. Set the weight vector for each volatile component, and based on the weight vector, calculate the weighted Euclidean distance between the normalized current test result and the normalized previous test results; Calculate the weighted Euclidean distance according to the following formula: ; ; Among them, is the weighted Euclidean distance with respect to , and ; is the set of weight vectors of all volatile components, is the weight vector of the -th volatile component; S3336. Set the time decay coefficient and obtain the timestamps corresponding to the previous test results, where the time decay coefficient is used to control the influence degree of the timeliness of the previous test results; S3337. According to the time decay coefficient and the timestamps corresponding to the previous test results, calculate the timeliness weights of the previous test results, and perform normalization processing on the timeliness weights to obtain the normalized timeliness weights; Calculate the timeliness weights according to the following formula: ; Among them, is the timeliness weight of the th previous detection result, is the time decay coefficient, is the current time, is the th timestamp of the previous detection result; Calculate the normalized timeliness weights according to the following formula: ; ; ; ; Among them, the normalized timeliness weight of the the timeliness weight of the the timestamp of the S3338. Calculate the difference degree according to the weighted Euclidean distance and the normalized timeliness weights; Calculate the difference degree according to the following formula: ; Among them, is the degree of difference.
4. 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 the preset range; S52. If it exceeds the preset range, start the exception handling mechanism and adjust the score conversion strategy according to the distribution characteristics of the volatile component data; S53. Divide the freshness levels according to the adjusted score conversion strategy.
5. The method for analyzing the freshness of preserved eggs according to claim 4, wherein The specific steps in step S52 include: S521. Determine whether the distribution of the volatile component data conforms to the preset expected distribution, and if it does not conform, execute the following steps: S5211. Calculate the deviation degree of the volatile component data from the expected distribution; S5212. Determine the type of anomaly according to the deviation degree; S5213. Select the corresponding score conversion strategy adjustment plan according to the type of anomaly; S5214. Adjust the score conversion strategy according to the corresponding score conversion strategy adjustment plan.
6. A fresh - degree analysis device for preserved eggs, characterized in that, Include: A collection module for collecting the environmental temperature and humidity data of the storage center; A first calibration module for performing the first calibration on the freshness grading model parameters according to the environmental temperature and humidity data; A second calibration module for, before performing the next step of processing on each batch of preserved eggs, extracting a small amount of samples for testing and then performing the second calibration on the freshness grading model parameters according to the test results; A scoring module for collecting the 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 the freshness score; A division module for dividing the freshness levels of the corresponding batch of preserved eggs according to the freshness score; When the second calibration module is performing the second calibration on the freshness grading model parameters according to the test results after extracting a small amount of samples for testing before performing the next step of processing on each batch of preserved eggs, it executes: S31. When performing multiple tests on the same batch of preserved eggs, obtain the time interval between the current test and the previous test; S32. If the time interval is greater than the preset threshold, increase the number of samples to be extracted for the current test and perform the test; S33. Calculate the difference degree between the current test result and the previous test results; S34. Adjust the calibration amplitude of the freshness grading model parameters according to the degree of difference; S35. Perform a second calibration on the freshness grading model parameters based on the adjusted calibration amplitude; When the second calibration module is used to adjust the calibration amplitude of the freshness grading model parameters according to the degree of difference, it performs: S341. Obtain 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 degree of difference calculated in step S33; S342. Calculate the dynamic adjustment coefficient according to the time interval, time threshold, maximum adjustment coefficient, and steepness coefficient; Calculate the dynamic adjustment coefficient according to the following formula: ; Among them, is the dynamic adjustment coefficient, is the maximum adjustment coefficient, is the steepness coefficient, is the time interval, is the time threshold; S343. Calculate the calibration amplitude according to the degree of difference, basic calibration amplitude, and dynamic adjustment coefficient; Calculate the calibration amplitude according to the following formula: ; Among them, is the calibration amplitude, is the basic calibration amplitude, is the difference degree, is the dynamic adjustment coefficient.
7. An electronic device, characterized in that, It includes a processor and a memory, and the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the preserved egg freshness analysis method according to any one of claims 1-5 are run.
8. 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 preserved egg freshness analysis method according to any one of claims 1-5 are run.
Citation Information
Patent Citations
Improved VGG-19 freshness assessment method for chilled pomfret
CN113537394A
Flower freshness evaluation system based on visual inspection
CN119338763A