Machine vision-based food waste analysis method and system
By combining machine vision and meteorological data, an environment-waste scenario model was established, which solved the problem of the disconnect between environmental factors and behavior in food waste analysis. This enabled accurate identification of waste patterns and optimization of meal preparation decisions, improving the precision and timeliness of management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INST OF GEOGRAPHICAL SCI & NATURAL RESOURCE RES CAS
- Filing Date
- 2026-04-10
- Publication Date
- 2026-07-10
AI Technical Summary
In existing food waste analysis technologies, environmental factors are disconnected from wasteful behavior, resulting in delayed analysis results, low prediction accuracy, and poor management guidance, making it difficult to achieve closed-loop management from perception to decision-making.
By acquiring environmental parameters and images of plates in the dining area through machine vision, an environment-waste scenario model is established, a baseline waste feature template is constructed, and meteorological data is combined for matching and real-time analysis to generate dynamic control instructions and optimize meal preparation behavior.
It enables accurate identification and prediction of environmentally sensitive waste patterns, provides forward-looking and quantitative decision-making basis, improves the accuracy and timeliness of food waste management, and reduces the impact of image noise and environmental interference.
Smart Images

Figure CN122365415A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data analysis technology, specifically to a method and system for analyzing food waste based on machine vision. Background Technology
[0002] Food waste is a major global problem that causes not only economic losses but also resource waste and environmental pressure. Currently, quantitative analysis of food waste relies heavily on manual statistics or sampling surveys, which suffers from inefficiency, strong subjectivity, and coarse data granularity.
[0003] While existing technologies include solutions for automatically identifying and classifying food waste using image recognition and other methods, their analytical perspectives are largely limited to the waste itself, failing to effectively establish a causal link between the dynamic changes in food waste and key external environmental factors influencing consumption decisions. Neuroscience research has shown that temperature changes can regulate eating behavior through specific brain regions; for example, *Nature* reported that heat exposure can inhibit feeding neural pathways, leading to decreased appetite. This indicates that environmental variables have a direct impact on eating behavior, a factor generally not incorporated into existing solutions.
[0004] This isolated analytical perspective makes it difficult to reveal the formation and evolution of wasteful behavior, resulting in a lack of forward-looking management insights and practical intervention guidance. Furthermore, existing solutions struggle to translate analytical results into actionable operational instructions in a timely manner, failing to achieve closed-loop management from perception to decision-making.
[0005] Therefore, there is an urgent need for a method and system that can automatically identify food waste, integrate external environmental factors, dynamically correlate waste patterns, and promote the optimization of food preparation behavior in advance. Summary of the Invention
[0006] (1) Technical problems to be solved The purpose of this invention is to provide a machine vision-based food waste analysis method and system to solve the problems of low prediction accuracy and poor management guidance caused by the disconnect between environmental factors and waste behavior and the lag in analysis results in existing food waste analysis technologies.
[0007] (2) Technical solution To achieve the above objectives, in one aspect, the present invention provides a food waste analysis method based on machine vision, the method comprising: Step S1: Obtain the first environmental parameter sequence and the first plate image sequence of the dining area within a historical time period; identify the first plate image sequence, extract the baseline feature data of the remaining food in each plate and form a historical waste feature set; perform cluster analysis on the historical waste feature set based on the first environmental parameter sequence to establish N environment-waste scenario patterns; perform statistical modeling on the baseline feature data of the N environment-waste scenario patterns to construct N baseline waste feature templates.
[0008] Step S2: At the preset forecast time, obtain the second environmental parameter data of the preset dining period through the meteorological data interface; match the second environmental parameter data with N environmental-waste scenario patterns to determine the target template; generate the first meal preparation instruction according to the target template and output it to the kitchen control terminal.
[0009] Step S3: During the preset dining period, collect image data of the second plate in real time; identify the image data of the second plate and extract the real-time feature data of the current leftovers; compare the real-time feature data with the benchmark feature data in the target template to obtain the feature deviation sequence; perform trend analysis on the feature deviation sequence to obtain the dynamic control instruction factor; generate a second meal preparation instruction based on the dynamic control instruction factor and output it to the kitchen control terminal.
[0010] Furthermore, the method for identifying the first plate image sequence, extracting baseline feature data of the remaining food in each plate, and forming a historical waste feature set includes: Semantic segmentation is performed on the plate images in the first plate image sequence to locate the remaining food area; visual state analysis is performed on the remaining food area to obtain visual state parameters, including color saturation and texture uniformity; the image data is cleaned according to the texture uniformity, and image data with texture uniformity greater than a preset mixing threshold is removed to obtain valid image data.
[0011] The remaining food areas in the valid image data are categorized to obtain sub-regions of remaining food and corresponding category labels. Based on the sub-regions of remaining food and corresponding category labels, the pixel area corresponding to each category label is calculated. Based on the pixel area and the corresponding color saturation, a preset quality estimation model is used for correction to obtain the estimated remaining mass corresponding to each category label. The estimated remaining mass corresponding to each category label is compared with a preset standard portion reference value to obtain the standardized remaining quantity ratio of each category label.
[0012] The category label, standardized surplus ratio, and visual state parameters are combined to obtain baseline feature data; the baseline feature data corresponding to each plate image in the first plate image sequence are combined to obtain a historical waste feature set.
[0013] Furthermore, the method for clustering the historical waste feature set based on the first environmental parameter sequence to establish N environmental-waste scenario patterns includes: The first environmental parameter sequence is time-aligned to obtain a standard timestamp sequence; at each timestamp, the corresponding temperature data is obtained. relative humidity Weather condition codes ; Calculate the rate of temperature change between adjacent time stamps and humidity change rate According to the temperature data relative humidity Temperature change rate Humidity change rate Constructing environmental dynamic feature vectors .
[0014] Extract the standardized remaining quantity ratio of each category under the corresponding timestamp from the historical waste feature set, and construct a waste ratio feature vector. The environmental dynamic feature vector Waste ratio feature vector By concatenating the features, we obtain the joint feature vector of environment and waste. Clustering algorithms are used to analyze the joint environmental-waste feature vector. Clustering operations are performed to obtain N data clusters, where N is an integer greater than 1; in the clustering operation, two joint feature vectors of environment and waste are calculated using a feature distance metric function. and Distance between ,in and This represents two different joint feature vector samples; the feature distance metric function is: .
[0015] in, and These are the dimensions of the environmental dynamic feature vector and the waste ratio feature vector, respectively. For the first One environmental dynamic feature vector In the The component values of each dimension, No. One environmental dynamic feature vector In the The component values of each dimension, For the first Waste ratio feature vector In the The component values of each dimension, For the first Waste ratio feature vector In the The component values of each dimension, For the first Preset environmental dynamic weights for each environmental dynamic feature dimension For the first Preset waste ratio weights for each waste ratio characteristic dimension. The penalty weighting coefficient for differences in weather conditions; For indicator functions, when the first Weather condition codes for each sample With the Weather condition codes for each sample The value is 1 when they are not equal and 0 when they are equal.
[0016] Calculate the distribution center of environmental parameters and the mean vector of waste features within each of the N data clusters; associate the distribution center of environmental parameters and the mean vector of waste features of each data cluster to define an environment-waste scenario pattern.
[0017] Furthermore, the method for statistically modeling the baseline feature data of the N environmental-waste scenario patterns to construct N baseline waste feature templates includes: Historical data samples corresponding to the N environmental-waste scenario patterns are extracted to obtain N sample datasets. For each category label in each sample dataset, the baseline mean and standard deviation of its standardized residual quantity ratio are calculated. Statistical analysis is performed on the visual state parameters in each sample dataset to obtain the baseline range of color saturation and texture uniformity. Based on the environmental parameters and waste ratio data in the sample datasets, an environmental response coefficient vector is obtained through multivariate regression analysis. The numerical boundaries of the distribution centers of the environmental parameters of the environmental-waste scenario patterns are extracted to obtain the baseline range of temperature and humidity. A baseline waste feature template is constructed based on the baseline mean, standard deviation, color saturation range, texture uniformity range, temperature range, humidity range, and environmental response coefficient vector.
[0018] Furthermore, the method for matching the second environmental parameter data with N environmental-waste scenario patterns to determine the target template includes: The second environmental parameter data is time-aligned to obtain an environmental parameter sample at the current time point; the air temperature is extracted from the environmental parameter sample. relative humidity and weather condition codes ; Calculate the rate of change of the current temperature compared to the previous time. and current humidity change rate Construct the dynamic feature vector of the current environment. ; Calculate the dynamic feature vector of the current environment Weighted distance between the distribution center of environmental parameters for each environment-waste scenario pattern : .
[0019] in, The dynamic feature vector of the current environment In the The component values of each dimension, For the first The environmental parameter distribution center of the environmental-waste scenario pattern is at the [missing information]. The component values of each dimension; based on the current rate of temperature change. and current humidity change rate Generate dynamic environment weights According to the dynamic environment weights For the weighted distance Make corrections to obtain the overall matching degree for each scene mode. : .
[0020] in, For all The maximum value in; the comprehensive matching degree The baseline waste feature template corresponding to the highest environmental-waste scenario pattern is determined as the target template.
[0021] Furthermore, the statement based on the current rate of temperature change and current humidity change rate Generate dynamic environment weights The methods include: Obtain second environmental parameter data within a preset time window, and extract the temperature sequence and relative humidity sequence; calculate the average temperature change within the preset time window based on the temperature sequence. The average humidity change within a preset time window is calculated based on the relative humidity sequence. .
[0022] Based on the average temperature change range and the magnitude of average humidity change Calculate the impact value of environmental change The environmental change impact value The calculation formula is: .
[0023] in, To preset the temperature change sensitivity coefficient, The preset humidity change sensitivity coefficient; the impact value of the environmental change. Normalization is performed to obtain dynamic environment weights. ;in, This is the preset maximum value of the impact of environmental changes.
[0024] Furthermore, the method for comparing the real-time feature data with the baseline feature data in the target template to obtain the feature deviation sequence includes: Extract the standardized residual proportion of each category label from the real-time feature data. ,in For category indexing, , The total number of product categories; extract the average baseline remaining quantity of the corresponding product categories from the target template. ; Calculate the residual quantity deviation for each category Extract color saturation from the real-time feature data. and texture blending Extract the color saturation reference value range from the target template. and the range of values for texture uniformity benchmark ; Calculate color saturation deviation value ; Calculate texture uniformity deviation value .
[0025] Based on the current temperature and current relative humidity and the temperature reference value range extracted from the target template. Humidity reference value range Calculate temperature differences Humidity differences Extract the environmental response coefficient vector from the target template. Based on the aforementioned temperature differences Humidity differences and environmental response coefficient vector Calculate the dynamic sensitivity attenuation coefficient .
[0026] Based on the dynamic sensitivity attenuation coefficient, the remaining amount deviation Color saturation deviation value and texture uniformity deviation value Make corrections to obtain the corrected residual deviation. Correcting color saturation deviation And correct texture blending deviation value .
[0027] The corrected residual deviation Correcting color saturation deviation And correct texture blending deviation value Arrange by category to construct a feature deviation sequence .
[0028] Furthermore, the method for performing trend analysis on the feature deviation sequence to obtain the dynamic regulation instruction factor includes: Obtain the characteristic deviation sequence of a continuous time series within a preset dining time window. Calculate the magnitude of the feature deviation vector at each time point and construct the deviation index sequence. ; for the deviation index sequence Perform time smoothing to obtain a smooth deviation curve. .
[0029] For the smooth deviation curve Perform sliding window regression analysis and calculate the rate of change of the deviation index within each window. and trend direction Regarding the trend direction Dynamic feature vector of the current environment within the corresponding time period The correlation between the current rate of change of temperature and the current rate of change of humidity is calculated to obtain the meteorological driving coefficient. The meteorological driving coefficient The calculation formula is: .
[0030] in, This represents the total number of sampling points within the time window. For the first Trend direction value of each sampling point For the first The rate of change of current temperature at each sampling point For the first The current humidity change rate at each sampling point The average value across all trend directions. The mean of the sum of all current temperature change rates and current humidity change rates; when the meteorological driving coefficient The absolute value is greater than the preset meteorological threshold. When the attribution type is determined to be "environment-related", it is otherwise "non-environment-driven"; according to the smoothing deviation curve. Trend direction rate of change and attribution type labels The dynamic control command factor is output.
[0031] Based on the same inventive concept, this invention also provides a machine vision-based food waste analysis system, characterized in that the system comprises: The benchmark construction module is used to acquire the first environmental parameter sequence and the first plate image sequence of the dining area within a historical time period; identify the first plate image sequence, extract the benchmark feature data of the remaining food in each plate and form a historical waste feature set; perform cluster analysis on the historical waste feature set based on the first environmental parameter sequence to establish N environment-waste scenario patterns; and perform statistical modeling on the benchmark feature data of the N environment-waste scenario patterns to construct N benchmark waste feature templates.
[0032] The pre-meal control module is used to obtain second environmental parameter data for a preset meal period through a meteorological data interface at a preset forecast time; match the second environmental parameter data with N environmental-waste scenario patterns to determine a target template; generate a first meal preparation instruction based on the target template and output it to the kitchen control terminal.
[0033] The meal control module is used to collect image data of the second plate in real time during a preset meal period; identify the image data of the second plate and extract the real-time feature data of the current leftovers; compare the real-time feature data with the benchmark feature data in the target template to obtain a feature deviation sequence; perform trend analysis on the feature deviation sequence to obtain a dynamic control instruction factor; generate a second meal preparation instruction based on the dynamic control instruction factor and output it to the kitchen control terminal.
[0034] (3) Beneficial effects Compared with the prior art, the beneficial effects of the present invention are: 1. By establishing a dynamic correlation model between environmental parameters and waste characteristics, the accurate identification and prediction of environmentally sensitive waste patterns are realized. This provides a forward-looking and quantitative basis for decision-making in pre-meal preparation and in-meal preparation, effectively improving the accuracy and timeliness of food waste management.
[0035] 2. By integrating visual state analysis and multi-dimensional deviation assessment, a robust waste feature comparison mechanism was constructed, which significantly reduced the impact of image noise and environmental interference on the analysis results, providing reliable technical support for dynamic monitoring and trend judgment of waste. Attached Figure Description
[0036] Figure 1 This is a flowchart of the machine vision-based food waste analysis method of Embodiment 1 of the present invention. Detailed Implementation
[0037] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0038] Before providing examples, it's necessary to describe the application scenario of this invention. Centralized catering facilities typically require food preparation and distribution within fixed timeframes, resulting in a highly concentrated production and consumption rhythm. Once the meal preparation plan is determined, it's difficult to make fine-grained adjustments based on dining conditions. Actual operation shows that, even with the same menu, number of diners, and meal preparation process, the amount of leftover food still fluctuates significantly due to changes in the dining environment, such as daily temperature, humidity, and weather conditions. Existing management methods largely rely on experience or fixed-ratio adjustments, making it difficult to proactively predict and dynamically respond to such environment-driven consumption changes. Therefore, constructing an automatic analysis and control mechanism that combines environmental information and plate waste characteristics in centralized catering scenarios becomes a practical need to improve catering efficiency and reduce waste.
[0039] Example 1: As Figure 1 As shown, this embodiment provides a machine vision-based food waste analysis method, the method including: Step S1: Obtain the first environmental parameter sequence and the first plate image sequence of the dining area within a historical time period; identify the first plate image sequence, extract the baseline feature data of the remaining food in each plate and form a historical waste feature set; perform cluster analysis on the historical waste feature set based on the first environmental parameter sequence to establish N environment-waste scenario patterns; perform statistical modeling on the baseline feature data of the N environment-waste scenario patterns to construct N baseline waste feature templates.
[0040] Step S2: At the preset forecast time, obtain the second environmental parameter data of the preset dining period through the meteorological data interface; match the second environmental parameter data with N environmental-waste scenario patterns to determine the target template; generate the first meal preparation instruction according to the target template and output it to the kitchen control terminal.
[0041] Step S3: During the preset dining period, collect image data of the second plate in real time; identify the image data of the second plate and extract the real-time feature data of the current leftovers; compare the real-time feature data with the benchmark feature data in the target template to obtain the feature deviation sequence; perform trend analysis on the feature deviation sequence to obtain the dynamic control instruction factor; generate a second meal preparation instruction based on the dynamic control instruction factor and output it to the kitchen control terminal.
[0042] For example, historical data from the two most recent summer (June-August) business days were obtained. The first environmental parameter sequence included the average temperature and average relative humidity monitored in the dining area during the daily lunch period (11:30–13:00), as well as weather conditions (sunny, cloudy, overcast, and rainy) obtained from the meteorological API. The first plate image sequence consisted of approximately 200,000 plate images collected at the plate collection point during the corresponding time period. Three typical environmental-waste scenario patterns were established, and three baseline waste feature templates were constructed: "High Temperature and High Humidity - High Meat Waste Pattern," "Suitable Temperature and Humidity - Balanced Waste Pattern," and "Low Temperature and Dryness - Low Waste Pattern."
[0043] In the forecasting phase, the process starts daily at 9:00 AM, with the preset lunchtime period as "today's lunch." Secondary environmental parameter forecast data for this period is obtained through a meteorological data interface, matched, and the "high temperature and high humidity – high meat waste pattern" is determined as the target template. Based on this target template, and combined with dynamic environmental weights... The significant environmental fluctuations reflected will generate the first meal preparation instruction and output it to the kitchen control terminal, marked as "high confidence level", and it is recommended that the kitchen significantly reduce (e.g., reduce by 40%) the initial meal preparation amount of meat dishes such as braised pork.
[0044] During the lunch break (11:30–13:00), real-time image data of the second plate is collected. Trend analysis reveals dynamic control command factors indicating a continuously increasing level of waste, which is "environmentally relevant." Based on this, a second meal preparation command is generated, suggesting dynamically slowing the replenishment frequency of braised pork during the meal and activating a high-frequency monitoring mechanism. Specifically, the first and second meal preparation commands may include, but are not limited to, adjusting the weight ratio of side dishes, adding or subtracting cooking batches, or starting the meal preheating process earlier, among other specific action parameters. These commands are executed directly by the kitchen control terminal or prompted by the operators.
[0045] The method for identifying the first plate image sequence, extracting baseline feature data of the remaining food in each plate, and forming a historical waste feature set includes: Semantic segmentation is performed on the plate images in the first plate image sequence to locate the remaining food area; visual state analysis is performed on the remaining food area to obtain visual state parameters, including color saturation and texture uniformity; the image data is cleaned according to the texture uniformity, and image data with texture uniformity greater than a preset mixing threshold is removed to obtain valid image data.
[0046] The remaining food areas in the valid image data are categorized to obtain sub-regions of remaining food and corresponding category labels. Based on the sub-regions of remaining food and corresponding category labels, the pixel area corresponding to each category label is calculated. Based on the pixel area and the corresponding color saturation, a preset quality estimation model is used for correction to obtain the estimated remaining mass corresponding to each category label. The estimated remaining mass corresponding to each category label is compared with a preset standard portion reference value to obtain the standardized remaining quantity ratio of each category label.
[0047] The category label, standardized surplus ratio, and visual state parameters are combined to obtain baseline feature data; the baseline feature data corresponding to each plate image in the first plate image sequence are combined to obtain a historical waste feature set.
[0048] For example, the image of the plate contains some braised pork, rice, and a small amount of stir-fried vegetables, with some of the vegetable sauce mixed with the rice. A semantic segmentation model is used to process the image, locating the remaining food area, while non-food areas such as the plate background and tableware are excluded. Within the segmented food area, the color saturation of the braised pork area is calculated to be 0.3, and the texture uniformity of the rice-vegetable sauce mixture area is calculated to be 0.85. A preset texture uniformity threshold of 0.7 is determined through historical data fitting. Since the current image's uniformity of 0.85 exceeds the threshold, it is discarded and not included in subsequent quantitative analysis. Texture uniformity characterizes the degree of texture homogenization caused by the mixing of different food components within the remaining food area. It can be obtained by extracting texture descriptors and calculating a uniformity index; a higher texture uniformity value indicates more significant mixing interference.
[0049] For another plate containing well-separated images of rice, braised pork, and stir-fried vegetables, an object detection algorithm was used to identify three remaining food sub-regions and their corresponding category labels: "Braised Pork," "Rice," and "Stir-fried Vegetables." The calculated pixel areas of each sub-region were: "Braised Pork" 1825 pixels, "Rice" 3176 pixels, and "Stir-fried Vegetables" 892 pixels. The color saturation of the "Stir-fried Vegetables" sub-region was detected to be 0.4. Applying a preset quality estimation model, based on the correspondence between color saturation and food category, its area-equivalent weight was reduced by 15%. The estimated remaining weights for each category were: Braised Pork 48 grams, Rice 79 grams, and Stir-fried Vegetables 17 grams. The preset quality estimation model was a calibrated pixel-to-weight conversion model, calibrated using sample plates from the cafeteria.
[0050] These estimated values were compared with preset standard portion reference values from the canteen's meal preparation standards to calculate the standardized waste proportions: braised pork 24.0%, rice 52.7%, and stir-fried vegetables 14.2%. Finally, the category labels, standardized waste proportions, and visual state parameters were combined to obtain a baseline feature data set. The baseline feature data corresponding to all valid images in the first plate image sequence were combined to form a historical waste feature set, which was stored in the database for subsequent analysis. In implementation, temperature, humidity, and their rate of change were processed through a uniform scale transformation before participating in index and distance calculations; the following calculation examples use the original physical values for ease of understanding.
[0051] The method for clustering the historical waste feature set based on the first environmental parameter sequence to establish N environmental-waste scenario patterns includes: The first environmental parameter sequence is time-aligned to obtain a standard timestamp sequence; at each timestamp, the corresponding temperature data is obtained. relative humidity Weather condition codes ; Calculate the rate of temperature change between adjacent time stamps and humidity change rate According to the temperature data relative humidity Temperature change rate Humidity change rate Constructing environmental dynamic feature vectors .
[0052] Extract the standardized remaining quantity ratio of each category under the corresponding timestamp from the historical waste feature set, and construct a waste ratio feature vector. The environmental dynamic feature vector Waste ratio feature vector By concatenating the features, we obtain the joint feature vector of environment and waste. Clustering algorithms are used to analyze the joint environmental-waste feature vector. Clustering operations are performed to obtain N data clusters, where N is an integer greater than 1; in the clustering operation, two joint feature vectors of environment and waste are calculated using a feature distance metric function. and Distance between ,in and This represents two different joint feature vector samples; the feature distance metric function is: .
[0053] in, and These are the dimensions of the environmental dynamic feature vector and the waste ratio feature vector, respectively. For the first One environmental dynamic feature vector In the The component values of each dimension, No. Environmental dynamic feature vectors In the The component values of each dimension, For the first Waste ratio feature vector In the The component values of each dimension, For the first Waste ratio feature vector In the The component values of each dimension, For the first Preset environmental dynamic weights for each environmental dynamic feature dimension For the first Preset waste ratio weights for each waste ratio characteristic dimension. The penalty weighting coefficient for differences in weather conditions; For indicator functions, when the first Weather condition codes for each sample With the Weather condition codes for each sample The value is 1 when they are not equal, and 0 when they are equal. Calculate the distribution center of environmental parameters and the mean vector of waste features within each of the N data clusters; associate the distribution center of environmental parameters and the mean vector of waste features of each data cluster to define an environment-waste scenario pattern.
[0054] For example, consider processing 92 days of cafeteria lunchtime data during the summer of 2024 (June-August). All recorded environmental parameters are time-aligned to obtain a standard timestamp sequence. Data for a particular day includes: temperature 30℃, humidity 78%, cloudy weather (W=1), and temperature change rate... Humidity change rate Then the environmental dynamic feature vector If we select three main food categories—braised pork, rice, and stir-fried vegetables—and their average standardized surplus percentages on a certain day are 38%, 21%, and 19%, respectively, then... .Will and By concatenating the features, we obtain the joint feature vector of environment and waste for that day. Clustering algorithms were used to analyze all 92 clusters. Clustering operations are performed. During clustering, the joint feature vector between any two environmental-waste pairs is calculated using a feature distance metric function. and Distance between For example, calculating samples (On a hot, sunny day) and the sample Distance (on a cold, rainy day): Preset environmental dynamic weights Waste of proportion and weight Weather difference penalty .sample : , (clear), ;sample : , (rain), . .
[0055] The optimal number of clusters, N=3, was determined through silhouette coefficient evaluation. After re-performing clustering, three data clusters were obtained. The distribution centers of environmental parameters for each cluster (e.g., the center of cluster 1) were calculated. ) and waste feature mean vector (such as cluster 1) By associating the distribution center of each cluster with the mean vector, three environmental-waste scenario modes were defined: "high temperature and high humidity - high meat waste mode", "suitable temperature and humidity - balanced waste mode", and "low temperature and dryness - low waste mode". In particular, the preset environmental dynamic weights were obtained through parameter tuning using training data, the waste ratio weights were determined by historical waste sensitivity statistics, and the weather difference penalty was set based on experience regarding the impact of weather changes on dining behavior.
[0056] The method for statistically modeling the baseline feature data of the N environmental-waste scenario patterns to construct N baseline waste feature templates includes: Historical data samples corresponding to the N environmental-waste scenario patterns are extracted to obtain N sample datasets. For each category label in each sample dataset, the baseline mean and standard deviation of its standardized residual quantity ratio are calculated. Statistical analysis is performed on the visual state parameters in each sample dataset to obtain the baseline range of color saturation and texture uniformity. Based on the environmental parameters and waste ratio data in the sample datasets, an environmental response coefficient vector is obtained through multivariate regression analysis. The numerical boundaries of the distribution centers of the environmental parameters of the environmental-waste scenario patterns are extracted to obtain the baseline range of temperature and humidity. A baseline waste feature template is constructed based on the baseline mean, standard deviation, color saturation range, texture uniformity range, temperature range, humidity range, and environmental response coefficient vector.
[0057] For example, 35 days of historical data samples corresponding to the "high temperature and high humidity - high meat waste pattern" are extracted to form a sample dataset. The standardized surplus proportions of each category are statistically analyzed to obtain baseline means and standard deviations: braised pork mean 51% (standard deviation ±7%), rice mean 25% (±5%), and stir-fried vegetables mean 18% (±4%). Visual state parameters are statistically analyzed, obtaining baseline values for color saturation ranging from 0.3 to 0.7 and for texture uniformity ranging from 0.1 to 0.5. Based on the environmental parameters and waste proportion data in the sample dataset, multiple regression analysis is performed to fit the environmental response coefficient vector. Taking braised pork as an example, its standardized surplus proportion is used as the dependent variable, and temperature and relative humidity are used as independent variables for regression analysis to obtain the regression equation. The coefficients of the independent variables constitute the environmental response coefficients for braised pork. For example, the environmental response coefficient vector obtained after analysis is... This indicates that for every 1°C increase in temperature, the proportion of leftover braised pork is expected to increase by 0.15%; and for every 1% increase in humidity, the proportion of leftover pork is expected to increase by 0.08%. The numerical boundaries of the environmental parameter distribution centers for the "high temperature, high humidity - high meat waste pattern" are extracted, resulting in a baseline temperature range of [33, 38]°C and a baseline humidity range of [80, 90]%.
[0058] By integrating the baseline mean, standard deviation, color saturation range, texture uniformity range, temperature baseline range, humidity baseline range, and environmental response coefficient vector, a baseline waste feature template for this mode is constructed. Similarly, corresponding baseline waste feature templates are established for the "suitable temperature and humidity - balanced waste mode" and the "low temperature and dry - low waste mode".
[0059] The method for matching the second environmental parameter data with N environmental-waste scenario patterns to determine the target template includes: The second environmental parameter data is time-aligned to obtain an environmental parameter sample at the current time point; the air temperature is extracted from the environmental parameter sample. relative humidity and weather condition codes ; Calculate the rate of change of the current temperature compared to the previous time. and current humidity change rate Construct the dynamic feature vector of the current environment. ; Calculate the dynamic feature vector of the current environment Weighted distance between the distribution center of environmental parameters for each environment-waste scenario pattern : .
[0060] in, The dynamic feature vector of the current environment In the The component values of each dimension, For the first The distribution center of environmental parameters in the environmental-waste scenario pattern is at the [missing information]. The component values of each dimension; based on the current rate of temperature change. and current humidity change rate Generate dynamic environment weights According to the dynamic environment weights For the weighted distance Make corrections to obtain the overall matching degree for each scene mode. : .
[0061] in, For all The maximum value in; the comprehensive matching degree The baseline waste feature template corresponding to the highest environmental-waste scenario pattern is determined as the target template.
[0062] For example, predictive analysis is performed daily at 10:00 AM, with the preset lunchtime period (11:30 AM - 1:00 PM). The forecast data for this period released by the meteorological department is time-aligned to obtain environmental parameter samples for the current time point. Temperature is then extracted from these samples. relative humidity and weather condition codes (Cloudy), and calculate the rate of change of the current temperature between the current time and the previous time (e.g., forecast data from 09:00 to 10:00). and current humidity change rate Construct dynamic feature vectors of the current environment .
[0063] calculate Weighted distance between the distribution centers of environmental parameters for each environment-waste scenario pattern Taking the "high temperature and high humidity - high meat waste pattern" as an example, its environmental parameter distribution center Preset environmental dynamic weights . Similarly, the weighted distance to the "suitable temperature and humidity mode" was calculated. Weighted distance from "low temperature drying mode" The maximum value max(d) is 8.942.
[0064] Based on the current rate of temperature change and current humidity change rate Generate dynamic environment weights Based on dynamic environment weights The distance metric is corrected to obtain the overall matching degree for each scene pattern. : ; ; .
[0065] The "high temperature and high humidity - high meat waste pattern" has the highest overall matching degree, and its corresponding benchmark waste characteristic template is determined as the target template.
[0066] According to the current temperature change rate and current humidity change rate Generate dynamic environment weights The methods include: Obtain second environmental parameter data within a preset time window, and extract the temperature sequence and relative humidity sequence; calculate the average temperature change within the preset time window based on the temperature sequence. The average humidity change within a preset time window is calculated based on the relative humidity sequence. .
[0067] Based on the average temperature change range and the magnitude of average humidity change Calculate the impact value of environmental change The environmental change impact value The calculation formula is: .
[0068] in, To preset the temperature change sensitivity coefficient, The preset humidity change sensitivity coefficient; the impact value of the environmental change. Normalization is performed to obtain dynamic environment weights. ;in, This is the preset maximum value of the impact of environmental changes.
[0069] For example, second environmental parameter data within a preset time window (e.g., lunchtime 11:30-13:00 on the same day) were obtained, and the temperature sequence was extracted. (Unit: °C) and relative humidity series (Unit: %). Calculate the average temperature variation based on the temperature series. Calculate the average humidity variation based on the relative humidity series. .
[0070] Calculate the environmental change impact value based on the average change magnitude. Preset temperature change sensitivity coefficient Preset humidity change sensitivity coefficient Obtained through statistical fitting, the units are opposite to the corresponding rates of change. This represents the impact value on the environmental changes. Normalization is performed to obtain dynamic environment weights. Maximum impact of preset environmental changes .
[0071] The method for comparing the real-time feature data with the baseline feature data in the target template to obtain the feature deviation sequence includes: Extract the standardized residual proportion of each category label from the real-time feature data. ,in For category indexing, , The total number of product categories; extract the average baseline remaining quantity of the corresponding product categories from the target template. ; Calculate the residual quantity deviation for each category Extract color saturation from the real-time feature data. and texture blending Extract the color saturation reference value range from the target template. and the range of values for texture uniformity benchmark ; Calculate color saturation deviation value ; Calculate texture uniformity deviation value .
[0072] Based on the current temperature and current relative humidity and the temperature reference value range extracted from the target template. Humidity reference value range Calculate temperature differences Humidity differences Extract the environmental response coefficient vector from the target template. Based on the aforementioned temperature differences Humidity differences and environmental response coefficient vector Calculate the dynamic sensitivity attenuation coefficient .
[0073] Based on the dynamic sensitivity attenuation coefficient, the remaining amount deviation Color saturation deviation value and texture uniformity deviation value Make corrections to obtain the corrected residual deviation. Correcting color saturation deviation And correct texture blending deviation value .
[0074] The corrected residual deviation Correcting color saturation deviation And correct texture blending deviation value Arrange by category to construct a feature deviation sequence .
[0075] For example, the standardized residual quantity ratio of each category label is extracted from real-time feature data. Taking the data collected at 12:00 as an example, braised pork... ,rice Stir-fried greens Extract the baseline residual average of the corresponding product category from the target template: Braised Pork ,rice Stir-fried greens Calculate the remaining quantity deviation for each category: ; ; .
[0076] Extracting color saturation from real-time feature data and texture blending Extract the color saturation baseline value range from the target template. and the range of values for texture uniformity benchmark Calculate the color saturation deviation. Texture blending deviation value .
[0077] Based on the current temperature and current relative humidity and the range of temperature benchmark values extracted from the target template. Humidity reference value range Calculate temperature differences Humidity differences Extracting the environmental response coefficient vector After dimensionless processing, the dynamic sensitivity attenuation coefficients are calculated for the temperature and humidity differences. . , , , , Constructing feature deviation sequences .
[0078] The method for performing trend analysis on the feature deviation sequence to obtain the dynamic regulation instruction factor includes: Obtain the characteristic deviation sequence of a continuous time series within a preset dining time window. Calculate the magnitude of the feature deviation vector at each time point and construct the deviation index sequence. ; for the deviation index sequence Perform time smoothing to obtain a smooth deviation curve. .
[0079] For the smooth deviation curve Perform sliding window regression analysis and calculate the rate of change of the deviation index within each window. and trend direction Regarding the trend direction Dynamic feature vector of the current environment within the corresponding time period The correlation between the current rate of change of temperature and the current rate of change of humidity is calculated to obtain the meteorological driving coefficient. The meteorological driving coefficient The calculation formula is: .
[0080] in, The total number of sampling points within the time window. For the first Trend direction value of each sampling point For the first The current temperature change rate at each sampling point For the first The current humidity change rate at each sampling point The average value across all trend directions. The mean of the sum of all current temperature change rates and current humidity change rates; when the meteorological driving coefficient The absolute value is greater than the preset meteorological threshold. When the attribution type is determined to be "environment-related", it is otherwise "non-environment-driven"; according to the smoothing deviation curve. Trend direction rate of change and attribution type labels The dynamic control command factor is output.
[0081] For example, within a preset dining time window (lunchtime 11:30-13:00), the magnitude of the feature deviation vector at each time point is calculated; for instance, the magnitude at 12:00 is 0.0588. A deviation index sequence is obtained at 15-minute intervals. The total number of sampling points is 7. Time smoothing (using a 3-point moving average) is performed on the deviation index series to obtain the smoothed deviation curve. .right Perform sliding window regression analysis (window size of 3 time points) to calculate the trend direction. The sequence is These correspond to the time periods 11:30-12:00, 12:00-12:30, and 12:30-13:00, respectively. The environmental change rate sequence for the same period. for Calculate the meteorological driving coefficient. The absolute value is greater than the preset meteorological threshold. The current dynamic evolution is assigned the attribution type label "environment-related". The optimal preset meteorological threshold is determined through historical experiments.
[0082] Based on the smoothed deviation curve (initially decreasing then increasing), trend direction (initially negative then positive), rate of change (from negative to positive), and attribution type label, a dynamic adjustment instruction factor is output. The dynamic adjustment instruction factor is a comprehensive representation of the trend and attribution type of the characteristic deviation sequence within a preset dining time window, including the smoothed deviation curve, trend direction, rate of change of deviation, and attribution type label. The final conclusion is: the degree of waste initially decreases then increases, and is strongly correlated with environmental changes; therefore, it is recommended to initiate high-frequency monitoring and prepare for the implementation of targeted meal preparation strategies.
[0083] Example 2: Based on the same inventive concept, this example also provides a food waste analysis system based on machine vision, characterized in that the system includes: The benchmark construction module is used to acquire the first environmental parameter sequence and the first plate image sequence of the dining area within a historical time period; identify the first plate image sequence, extract the benchmark feature data of the remaining food in each plate and form a historical waste feature set; perform cluster analysis on the historical waste feature set based on the first environmental parameter sequence to establish N environment-waste scenario patterns; and perform statistical modeling on the benchmark feature data of the N environment-waste scenario patterns to construct N benchmark waste feature templates.
[0084] The pre-meal control module is used to obtain second environmental parameter data for a preset meal period through a meteorological data interface at a preset forecast time; match the second environmental parameter data with N environmental-waste scenario patterns to determine a target template; generate a first meal preparation instruction based on the target template and output it to the kitchen control terminal.
[0085] The meal control module is used to collect image data of the second plate in real time during a preset meal period; identify the image data of the second plate and extract the real-time feature data of the current leftovers; compare the real-time feature data with the benchmark feature data in the target template to obtain a feature deviation sequence; perform trend analysis on the feature deviation sequence to obtain a dynamic control instruction factor; generate a second meal preparation instruction based on the dynamic control instruction factor and output it to the kitchen control terminal.
[0086] It should be noted that the specific methods by which each module performs operations in the system described in the above embodiments have been described in detail in the embodiments related to the method, and will not be elaborated here.
[0087] Finally, it should be noted that although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A machine vision-based method for analyzing food waste, characterized in that, The method includes: Acquire the first environmental parameter sequence and the first plate image sequence of the dining area within a historical time period; identify the first plate image sequence, extract the baseline feature data of the remaining food in each plate and form a historical waste feature set; perform cluster analysis on the historical waste feature set based on the first environmental parameter sequence to establish N environment-waste scenario patterns; perform statistical modeling on the baseline feature data of the N environment-waste scenario patterns to construct N baseline waste feature templates; At a preset forecast time, second environmental parameter data for the preset dining period is obtained through a meteorological data interface; the second environmental parameter data is matched with N environmental-waste scenario patterns to determine a target template; a first meal preparation instruction is generated based on the target template and output to the kitchen control terminal; During the preset dining period, image data of the second plate is collected in real time; the image data of the second plate is identified to extract the real-time feature data of the current leftovers; the real-time feature data is compared with the baseline feature data in the target template to obtain the feature deviation sequence; the feature deviation sequence is analyzed for trends to obtain the dynamic control instruction factor; a second meal preparation instruction is generated according to the dynamic control instruction factor and output to the kitchen control terminal.
2. The food waste analysis method based on machine vision according to claim 1, characterized in that, The method for identifying the first plate image sequence, extracting baseline feature data of the remaining food in each plate, and forming a historical waste feature set includes: Semantic segmentation is performed on the plate images in the first plate image sequence to locate the remaining food area; visual state analysis is performed on the remaining food area to obtain visual state parameters, including color saturation and texture uniformity; the image data is cleaned according to the texture uniformity, and image data with texture uniformity greater than a preset mixing threshold is removed to obtain effective image data. The remaining food areas in the valid image data are categorized to obtain sub-regions of remaining food and corresponding category labels; the pixel area corresponding to each category label is calculated based on the sub-regions of remaining food and the corresponding category labels; the estimated remaining mass corresponding to each category label is obtained by correcting the pixel area and the corresponding color saturation through a preset quality estimation model; the estimated remaining mass corresponding to each category label is compared with a preset standard portion reference value to obtain the standardized remaining mass ratio of each category label. The category label, standardized surplus ratio, and visual state parameters are combined to obtain baseline feature data; the baseline feature data corresponding to each plate image in the first plate image sequence are combined to obtain a historical waste feature set.
3. The food waste analysis method based on machine vision according to claim 2, characterized in that, The method for clustering the historical waste feature set based on the first environmental parameter sequence to establish N environmental-waste scenario patterns includes: The first environmental parameter sequence is time-aligned to obtain a standard timestamp sequence; at each timestamp, the corresponding temperature data is obtained. relative humidity Weather condition codes ; Calculate the rate of temperature change between adjacent time stamps and humidity change rate According to the temperature data relative humidity Temperature change rate Humidity change rate Constructing environmental dynamic feature vectors ; Extract the standardized remaining quantity ratio of each category under the corresponding timestamp from the historical waste feature set, and construct a waste ratio feature vector. The environmental dynamic feature vector Waste ratio feature vector By concatenating the features, we obtain the joint feature vector of environment and waste. Clustering algorithms are used to analyze the joint environmental-waste feature vector. Clustering operations are performed to obtain N data clusters, where N is an integer greater than 1; in the clustering operation, two joint feature vectors of environment and waste are calculated using a feature distance metric function. and Distance between ,in and This represents two different joint feature vector samples; the feature distance metric function is: ; in, and These are the dimensions of the environmental dynamic feature vector and the waste ratio feature vector, respectively. For the first One environmental dynamic feature vector In the The component values of each dimension, No. One environmental dynamic feature vector In the The component values of each dimension, For the first Waste ratio feature vector In the The component values of each dimension, For the first Waste ratio feature vector In the The component values of each dimension, For the first Preset environmental dynamic weights for each environmental dynamic feature dimension For the first Preset waste ratio weights for each waste ratio characteristic dimension. The penalty weighting coefficient for differences in weather conditions; For indicator functions, when the first Weather condition codes for each sample With the Weather condition codes for each sample The value is 1 when they are not equal, and 0 when they are equal. Calculate the distribution center of environmental parameters and the mean vector of waste features within each of the N data clusters; associate the distribution center of environmental parameters and the mean vector of waste features of each data cluster to define an environment-waste scenario pattern.
4. The food waste analysis method based on machine vision according to claim 3, characterized in that, The method for statistically modeling the baseline feature data of the N environmental-waste scenario patterns to construct N baseline waste feature templates includes: Historical data samples corresponding to the N environmental-waste scenario patterns are extracted to obtain N sample datasets. For each category label in each sample dataset, the baseline mean and standard deviation of its standardized residual quantity ratio are calculated. Statistical analysis is performed on the visual state parameters in each sample dataset to obtain the baseline range of color saturation and texture uniformity. Based on the environmental parameters and waste ratio data in the sample datasets, an environmental response coefficient vector is obtained through multivariate regression analysis. The numerical boundaries of the distribution centers of the environmental parameters of the environmental-waste scenario patterns are extracted to obtain the baseline range of temperature and humidity. A baseline waste feature template is constructed based on the baseline mean, standard deviation, color saturation range, texture uniformity range, temperature range, humidity range, and environmental response coefficient vector.
5. The food waste analysis method based on machine vision according to claim 4, characterized in that, The method for matching the second environmental parameter data with N environmental-waste scenario patterns to determine the target template includes: The second environmental parameter data is time-aligned to obtain an environmental parameter sample at the current time point; the air temperature is extracted from the environmental parameter sample. relative humidity and weather condition codes ; Calculate the rate of change of the current temperature compared to the previous time. and current humidity change rate Construct the dynamic feature vector of the current environment. ; Calculate the dynamic feature vector of the current environment Weighted distance between the distribution center of environmental parameters for each environment-waste scenario pattern : ; in, The dynamic feature vector of the current environment In the The component values of each dimension, For the first The distribution center of environmental parameters in the environmental-waste scenario pattern is at the [missing information]. The component values of each dimension; based on the current rate of temperature change. and current humidity change rate Generate dynamic environment weights According to the dynamic environment weights For the weighted distance Make corrections to obtain the overall matching degree for each scene mode. : ; in, For all The maximum value in; the comprehensive matching degree The baseline waste feature template corresponding to the highest environmental-waste scenario pattern is determined as the target template.
6. The food waste analysis method based on machine vision according to claim 5, characterized in that, According to the current temperature change rate and current humidity change rate Generate dynamic environment weights The methods include: Obtain second environmental parameter data within a preset time window, and extract the temperature sequence and relative humidity sequence; calculate the average temperature change within the preset time window based on the temperature sequence. The average humidity change within a preset time window is calculated based on the relative humidity sequence. ; Based on the average temperature change range and the magnitude of average humidity change Calculate the impact value of environmental change The environmental change impact value The calculation formula is: ; in, To preset the temperature change sensitivity coefficient, The preset humidity change sensitivity coefficient; the impact value of the environmental change. Normalization is performed to obtain dynamic environment weights. ;in, This is the preset maximum value of the impact of environmental changes.
7. The food waste analysis method based on machine vision according to claim 6, characterized in that, The method for comparing the real-time feature data with the baseline feature data in the target template to obtain the feature deviation sequence includes: Extract the standardized residual proportion of each category label from the real-time feature data. ,in For category indexing, , The total number of product categories; extract the average baseline remaining quantity of the corresponding product categories from the target template. ; Calculate the remaining quantity deviation for each category Extract color saturation from the real-time feature data. and texture blending Extract the color saturation reference value range from the target template. and the range of values for texture uniformity benchmark ; Calculate color saturation deviation value ; Calculate texture uniformity deviation value ; Based on the current temperature and current relative humidity and the temperature reference value range extracted from the target template. Humidity reference value range Calculate temperature differences Humidity differences Extract the environmental response coefficient vector from the target template. Based on the aforementioned temperature differences Humidity differences and environmental response coefficient vector Calculate the dynamic sensitivity attenuation coefficient ; Based on the dynamic sensitivity attenuation coefficient, the remaining amount deviation Color saturation deviation and texture uniformity deviation value Make corrections to obtain the corrected residual deviation. Correcting color saturation deviation And correct texture blending deviation value ; The corrected residual deviation Correcting color saturation deviation And correct texture blending deviation value Arrange by category to construct a feature deviation sequence .
8. The food waste analysis method based on machine vision according to claim 7, characterized in that, The method for performing trend analysis on the feature deviation sequence to obtain the dynamic regulation instruction factor includes: Obtain the characteristic deviation sequence of a continuous time series within a preset dining time window. Calculate the magnitude of the feature deviation vector at each time point and construct the deviation index sequence. ; for the deviation index sequence Perform time smoothing to obtain a smooth deviation curve. ; For the smooth deviation curve Perform sliding window regression analysis and calculate the rate of change of the deviation index within each window. and trend direction Regarding the trend direction Dynamic feature vector of the current environment within the corresponding time period The correlation between the current rate of change of temperature and the current rate of change of humidity is calculated to obtain the meteorological driving coefficient. The meteorological driving coefficient The calculation formula is: ; in, The total number of sampling points within the time window. For the first Trend direction value of each sampling point For the first The current temperature change rate at each sampling point For the first The current humidity change rate at each sampling point The average value across all trend directions. The mean of the sum of all current temperature change rates and current humidity change rates; when the meteorological driving coefficient The absolute value is greater than the preset meteorological threshold. When the attribution type is determined to be "environment-related", it is otherwise "non-environment-driven"; according to the smoothing deviation curve. Trend direction rate of change and attribution type labels The dynamic control command factor is output.
9. A food waste analysis system based on machine vision, characterized in that, The system includes: The benchmark construction module is used to acquire the first environmental parameter sequence and the first plate image sequence of the dining area within a historical time period; to identify the first plate image sequence, extract the benchmark feature data of the remaining food in each plate and form a historical waste feature set; to perform cluster analysis on the historical waste feature set based on the first environmental parameter sequence to establish N environment-waste scenario patterns; and to perform statistical modeling on the benchmark feature data of the N environment-waste scenario patterns to construct N benchmark waste feature templates. The pre-meal control module is used to obtain second environmental parameter data for a preset meal time period through a meteorological data interface at a preset forecast time; match the second environmental parameter data with N environmental-waste scenario patterns to determine a target template; generate a first meal preparation instruction based on the target template and output it to the kitchen control terminal; The meal control module is used to collect image data of the second plate in real time during a preset meal period; identify the image data of the second plate and extract the real-time feature data of the current leftovers; compare the real-time feature data with the benchmark feature data in the target template to obtain a feature deviation sequence; perform trend analysis on the feature deviation sequence to obtain a dynamic control instruction factor; generate a second meal preparation instruction based on the dynamic control instruction factor and output it to the kitchen control terminal.