Calculation method and system of carbon emissions of dishes based on YOLOv8

The YOLOv8 algorithm is used to identify the ingredients of the dishes and calculate the carbon emissions of the dishes before and after the meal, which solves the problem of inaccurate carbon emission calculations of dishes in the existing technology and achieves more scientific carbon footprint tracking and carbon emission calculations.

CN118536722BActive Publication Date: 2024-10-18JIANGXI UNIVERSITY OF FINANCE AND ECONOMICS
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411010558.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-10-18
Estimated Expiration
2044-07-26

AI Technical Summary

Technical Problem

In the existing technology, the method for calculating the carbon emissions of dishes fails to accurately capture the raw materials used in each dish, resulting in inaccurate carbon emission calculations.

Method used

The YOLOv8 algorithm is used to build a target detection and recognition model. The model is trained through the dish image data set to identify the detection area and weight of the dish ingredients before and after the meal. Combined with the carbon emission calculation model, the carbon emission percentage of wasted dishes is calculated.

Benefits of technology

It achieves accurate calculation of carbon emissions of dishes, solves the problem of inaccurate calculation of carbon emissions caused by mixing ingredients in dishes, and establishes a full-chain carbon emission factor model to track the carbon footprint of catering, making calculations more comprehensive and scientific.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118536722B_ABST
    Figure CN118536722B_ABST
Patent Text Reader

Abstract

The present invention proposes a method and system for calculating the carbon emissions of dishes based on YOLOv8, the method comprising: collecting historical data of dish images and dish ingredient related information to construct a dish image data set; constructing a target detection and recognition model based on the YOLOv8 algorithm, and using the dish image data set to obtain a trained target detection and recognition model; using the trained target detection and recognition model, in combination with any dish image to obtain a final prediction result, and using the final prediction result in combination with the carbon emission calculation model to calculate the carbon emission percentage of wasted dishes. By comprehensively considering the different carbon emissions of various ingredients of dishes during transportation, refrigeration, and processing, the present invention can calculate the carbon emissions of dishes on students' plates before and after meals, as well as the carbon emission percentage of wasted dishes, and has application value and application prospects for promoting the carbon labeling of dishes and the characterization of carbon inclusive mechanisms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of multimedia digital image processing, and in particular to a method and system for calculating the carbon emissions of dishes based on YOLOv8. Background Art

[0002] At present, the green and low-carbon market has broad prospects. In response to the problem of food waste, in the existing technology, Chinese patent CN115660292B discloses: obtaining catering consumption data from a catering platform server, the data including the name of the dish and the order quantity; using the dish name to query the name of the ingredient corresponding to the dish; determining the carbon emission data of the corresponding dish according to the dish name and the ingredient name; determining the carbon emissions of the dish in the catering consumption data according to the dish carbon emission data and the dish order quantity; thereby completing the accounting of catering consumption carbon emissions and realizing the monitoring of catering consumption carbon emissions.

[0003] However, the above-mentioned existing patent technologies do not accurately identify the raw materials used for each dish. Therefore, accurately obtaining a method for calculating the carbon emissions of dishes based on the identification of raw materials has become an urgent problem to be solved in this field. Summary of the invention

[0004] In view of the above situation, the main purpose of the present invention is to propose a method and system for calculating the carbon emissions of dishes based on YOLOv8 to solve the above technical problems.

[0005] The present invention provides a method for calculating the carbon emissions of dishes based on YOLOv8, the method comprising the following steps:

[0006] Step 1: Collect historical data on dish images and dish ingredients to build a dish image dataset;

[0007] Step 2: Build a target detection and recognition model based on the YOLOv8 algorithm, use the food image dataset to train the target detection and recognition model, and use the total loss function to optimize the target detection and recognition model to obtain a trained target detection and recognition model;

[0008] Step 3. Use the trained target detection and recognition model in combination with any dish image to obtain the final prediction result. Use the final prediction result to obtain the detection area of ​​the dish ingredients before and after the meal. Use the detection area of ​​the dish ingredients before and after the meal and the final prediction result to calculate the weight of the dish ingredients on the plate before and after the meal. Based on the weight of the dish ingredients on the plate before and after the meal, use the carbon emission calculation model to calculate the carbon emission percentage of wasted dishes.

[0009] The present invention also proposes a system for calculating carbon emissions of dishes based on YOLOv8, the system comprising:

[0010] The data set construction module is used to collect historical data of dish images and dish ingredient related information to construct a dish image data set;

[0011] The model training module is used to build a target detection and recognition model based on the YOLOv8 algorithm, train the target detection and recognition model using the food image dataset, and optimize the target detection and recognition model using the total loss function to obtain a trained target detection and recognition model;

[0012] The calculation module is used to use the trained target detection and recognition model in combination with any dish image to obtain the final prediction result, obtain the detection area of ​​the dish ingredients before and after the meal through the final prediction result, and calculate the weight of the dish ingredients on the plate before and after the meal by using the detection area of ​​the dish ingredients before and after the meal and the final prediction result. Based on the weight of the dish ingredients on the plate before and after the meal, the carbon emission percentage of the wasted dish is calculated through the carbon emission calculation model.

[0013] Compared with the prior art, the present invention has the following beneficial effects:

[0014] 1. The university canteen dish category detection and recognition method based on YOLOv8 in the present invention can accurately and efficiently identify the dish names and ingredient information on the student plates, ensuring the effectiveness of subsequent carbon emissions calculations.

[0015] 2. The present invention can accurately obtain the weight of each ingredient in the student's plate before and after the meal, and identify the area change of each ingredient before and after the meal according to the target detection model, and accurately calculate the weight of various ingredients. This effectively solves the problem of inaccurate calculation of the carbon emissions of the entire dish due to the mixing of various ingredients in the dish, which is difficult to determine in the previous weighing of the whole dish.

[0016] 3. The present invention establishes a carbon emission factor calculation model for ingredients, tracks the carbon footprint of university canteen catering, and establishes a carbon emission factor calculation model for the entire chain of ingredients from planting / breeding to transportation to refrigeration to cooking and processing. The carbon emission ratio of dishes before and after students' meals is calculated more comprehensively and scientifically.

[0017] 4. The present invention has good performance, good lightness and portability. Since the types of dishes and ingredients in colleges and universities are relatively fixed, and college students have a strong awareness of environmental protection, it is conducive to the effective application of this technology in a college environment.

[0018] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description or learned through embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1This is a flow chart of the method for calculating the carbon emissions of dishes based on YOLOv8 proposed by the present invention;

[0020] Figure 2 A schematic diagram of the framework of the target detection and recognition method of the method for calculating the carbon emissions of dishes based on YOLOv8 proposed by the present invention;

[0021] Figure 3 This is the overall framework diagram of the system for calculating the carbon emissions of dishes based on YOLOv8 proposed in the present invention. DETAILED DESCRIPTION

[0022] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0023] These and other aspects of the embodiments of the present invention will be apparent with reference to the following description and accompanying drawings. In these descriptions and accompanying drawings, some specific implementations of the embodiments of the present invention are specifically disclosed to represent some ways of implementing the principles of the embodiments of the present invention, but it should be understood that the scope of the embodiments of the present invention is not limited thereto.

[0024] See also Figure 1 , an embodiment of the present invention provides a method for calculating the carbon emissions of dishes based on YOLOv8, the method comprising the following steps:

[0025] Step 1: Collect historical data on dish images and dish ingredients to build a dish image dataset;

[0026] In step 1, historical data of dish images and dish ingredient related information are collected to construct a dish image dataset. The expression of the dish image dataset is:

[0027] ;

[0028] in, represents a dish image dataset, Represents a dish image, Indicates dish image label information, Indicates the total number of dish image data;

[0029] The types of dishes in university canteens include but are not limited to: vegetables, meat, mixed meat and vegetables, beverages, soups, rice staples, wheat staples, etc. In addition, based on the historical records of canteen operations, several types of dishes in the canteen can be determined on a daily basis, and the composition and weight ratio of each dish can be obtained and determined, while the standard carbon emissions corresponding to the components of each dish are fixed.

[0030] Step 2: Build a target detection and recognition model based on the YOLOv8 algorithm, use the food image dataset to train the target detection and recognition model, and use the total loss function to optimize the target detection and recognition model to obtain a trained target detection and recognition model;

[0031] Please refer to Figure 2 In step 2, a target detection and recognition model is constructed based on the YOLOv8 algorithm, the target detection and recognition model is trained using the dish image dataset, and the target detection and recognition model is optimized using the total loss function to obtain a trained target detection and recognition model. The specific steps are as follows:

[0032] The dish image dataset is divided into training dataset, test dataset and validation dataset;

[0033] Based on the YOLOv8 algorithm model, the target detection and recognition model is obtained by combining the training data set training;

[0034] The training data set is input into the target detection and recognition model to obtain the prediction result. The process includes the following relationship:

[0035] ;

[0036] in, Represents the weight parameter of the target detection and recognition model, represents any dish image, Represents the prediction result, Indicates the detection head module. represents the neck module, represents the benchmark module, Represents the target detection and recognition model;

[0037] The total loss function is constructed using the prediction results and the true labels, and the target detection and recognition model is optimized by minimizing the loss to obtain the optimized target detection and recognition model.

[0038] The validation data set is input into the optimized target detection and recognition model for verification, and the performance of the optimized target detection and recognition model is evaluated using the test data set. If the evaluation passes, a trained target detection and recognition model is obtained;

[0039] In step 2, the total loss function is constructed by category classification loss, bounding box regression loss and Wise-IoU loss;

[0040] Bounding box regression loss:

[0041] ;

[0042] ;

[0043] in, represents the bounding box regression loss, Indicates Prediction values, Indicates Prediction values, Indicates that the prediction target is The global optimal solution corresponding to the predicted value is Indicates that the prediction target is The global optimal solution corresponding to the predicted value;

[0044] Category classification loss:

[0045] ;

[0046] in, represents the category classification loss, Represents the intersection-over-union ratio of the predicted box and the true box, represents the class prediction probability, and All represent hyperparameters;

[0047] Wise-IoU Loss:

[0048] ;

[0049] ;

[0050] ;

[0051] in, represents the Wise-IoU loss, Indicates the degree of overlap between the real box and the predicted box. and All represent parameters. represents the degree of outlier, Represents the true value label of the y-axis coordinate, represents the distance metric, Represents 1 and The difference, Represents the x-axis coordinate of the prediction result, Represents the true value label on the left side of the x-axis, Indicates the prediction box width, Indicates the prediction box height;

[0052] Total loss function:

[0053] ;

[0054] in, Represents the total loss.

[0055] Step 3. Use the trained target detection and recognition model in combination with any dish image to obtain the final prediction result. Use the final prediction result to obtain the detection area of ​​the dish ingredients before and after the meal. Use the detection area of ​​the dish ingredients before and after the meal and the final prediction result to calculate the weight of the dish ingredients on the plate before and after the meal. Based on the weight of the dish ingredients on the plate before and after the meal, use the carbon emission calculation model to calculate the carbon emission percentage of wasted dishes.

[0056] In step 3, the trained target detection and recognition model is used in combination with any dish image to obtain the final prediction result. The detection area of ​​the dish ingredients before and after the meal is obtained through the final prediction result. The specific steps are as follows:

[0057] Input any dish image into the trained object detection and recognition model to obtain the final prediction result. The process has the following relationship:

[0058] ;

[0059] in, represents the final prediction result, represents the trained target detection and recognition model, Represents the weight parameters of the trained target detection and recognition model;

[0060] The final prediction result includes the prediction frame coordinates and the classification results of each dish and ingredient. The detection area of ​​the dish ingredients before and after the meal is calculated based on the prediction frame coordinates;

[0061] Optionally, the dinner plate is marked with scales, and the depth of the dinner plate is , detect the scale difference in the images of the students' plates before and after eating , if the scale difference If it is less than the preset value, it is considered that the height of the dish has not changed. ,like Not less than the preset value, the height of the dish ;

[0062] In step 3, the weight of the ingredients in the plate before and after the meal is calculated by using the detection area of ​​the ingredients before and after the meal and the final prediction result. The relationship in the process is:

[0063] ;

[0064] in, Indicates the detection area of ​​the ingredients of the dishes before the meal. Indicates the detection area of ​​the ingredients of the dishes after the meal. Indicates the height of the dish. Indicates the weight of the ingredients on the plate before eating. Indicates the weight of the ingredients on the plate after the meal. Indicates the density of the ingredient;

[0065] In step 3, based on the weight of the ingredients on the plate before and after the meal, the carbon emission percentage of the wasted food is calculated by a carbon emission calculation model, and the specific steps are as follows:

[0066] The carbon emission factor of the ingredients is calculated through the carbon emission calculation model. The calculation formula is as follows:

[0067] ;

[0068] in, represents the carbon emission factor of the ingredient, Indicates the total carbon emissions generated during the transportation of ingredients. Indicates the weight of ingredients as a percentage of the total weight of the dish being transported. Indicates the carbon emissions of the equipment during the refrigeration process of the ingredients. Indicates the proportion of ingredient refrigeration time to the monthly equipment operation time. represents the carbon footprint of cooking ingredients, It indicates the proportion of each student's consumption of the ingredient to the weight of the ingredient;

[0069] The carbon emission factor of the ingredients is combined with the weight of the ingredients on the plate before and after the meal to calculate the total carbon emissions of the dishes before and after the meal, and finally the percentage of carbon emissions from wasted dishes is obtained. The calculation relationship in the process is as follows:

[0070] ;

[0071] in, Indicates the total carbon emissions of dishes before eating. Indicates the total carbon emissions of the dishes after dining. Indicates the percentage of carbon emissions from wasted dishes;

[0072] The higher the carbon emission percentage of wasted dishes, the more waste there is.

[0073] See also Figure 3The embodiment of the present invention also provides a system for calculating the carbon emissions of dishes based on YOLOv8, the system comprising:

[0074] The data set construction module is used to collect historical data of dish images and dish ingredient related information to construct a dish image data set;

[0075] The model training module is used to build a target detection and recognition model based on the YOLOv8 algorithm, train the target detection and recognition model using the food image dataset, and optimize the target detection and recognition model using the total loss function to obtain a trained target detection and recognition model;

[0076] The calculation module is used to use the trained target detection and recognition model in combination with any dish image to obtain the final prediction result, obtain the detection area of ​​the dish ingredients before and after the meal through the final prediction result, and calculate the weight of the dish ingredients on the plate before and after the meal by using the detection area of ​​the dish ingredients before and after the meal and the final prediction result. Based on the weight of the dish ingredients on the plate before and after the meal, the carbon emission percentage of the wasted dish is calculated through the carbon emission calculation model.

[0077] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0078] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0079] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A method for calculating the carbon emissions of dishes based on YOLOv8, characterized in that: The method comprises the following steps: Step 1: Collect historical data on dish images and dish ingredients to build a dish image dataset; Step 2: Build a target detection and recognition model based on the YOLOv8 algorithm, use the food image dataset to train the target detection and recognition model, and use the total loss function to optimize the target detection and recognition model to obtain a trained target detection and recognition model; Step 3: using the trained target detection and recognition model, combined with any dish image to obtain the final prediction result, obtaining the detection area of ​​the dish ingredients before and after the meal through the final prediction result, calculating the weight of the dish ingredients in the plate before and after the meal by using the detection area of ​​the dish ingredients before and after the meal and the final prediction result, and based on the weight of the dish ingredients in the plate before and after the meal, calculating the carbon emission percentage of the wasted dish through the carbon emission calculation model; In step 2, a target detection and recognition model is constructed based on the YOLOv8 algorithm, the target detection and recognition model is trained using a dish image dataset, and the target detection and recognition model is optimized using a total loss function to obtain a trained target detection and recognition model. The specific steps are as follows: The dish image dataset is divided into training dataset, test dataset and validation dataset; Based on the YOLOv8 algorithm model, the target detection and recognition model is obtained by combining the training data set training; The training data set is input into the target detection and recognition model to obtain the prediction result. The process includes the following relationship: ; in, Represents the weight parameter of the target detection and recognition model, represents any dish image, Represents the prediction result, Indicates the detection head module. represents the neck module, represents the benchmark module, Represents the target detection and recognition model; The total loss function is constructed using the prediction results and the true labels, and the target detection and recognition model is optimized by minimizing the loss to obtain the optimized target detection and recognition model. The validation data set is input into the optimized target detection and recognition model for verification, and the performance of the optimized target detection and recognition model is evaluated using the test data set. If the evaluation passes, a trained target detection and recognition model is obtained; The total loss function is constructed by category classification loss, bounding box regression loss and Wise-IoU loss; Bounding box regression loss: ; ; in, represents the bounding box regression loss, Indicates Prediction values, Indicates Prediction values, Indicates that the prediction target is The global optimal solution corresponding to the predicted value is Indicates that the prediction target is The global optimal solution corresponding to the predicted value; Category classification loss: ; in, represents the category classification loss, Represents the intersection-over-union ratio of the predicted box and the true box, represents the class prediction probability, and All represent hyperparameters; Wise-IoU Loss: ; ; ; in, represents the Wise-IoU loss, Indicates the degree of overlap between the real box and the predicted box. and All represent parameters. represents the degree of outlier, Represents the true value label of the y-axis coordinate, represents the distance metric, Represents 1 and The difference, Represents the x-axis coordinate of the prediction result, Represents the true value label on the left side of the x-axis, Indicates the prediction box width, Indicates the height of the prediction box; Total loss function: ; in, represents the total loss; In step 3, the trained target detection and recognition model is used in combination with any dish image to obtain the final prediction result, and the detection area of ​​the dish ingredients before and after the meal is obtained through the final prediction result. The specific steps are as follows: Input any dish image into the trained object detection and recognition model to obtain the final prediction result. The process has the following relationship: ; in, represents the final prediction result, represents the trained target detection and recognition model, Represents the weight parameters of the trained target detection and recognition model; The final prediction result includes the prediction frame coordinates and the classification results of each dish and ingredient. The detection area of ​​the dish ingredients before and after the meal is calculated based on the prediction frame coordinates; The weight of the ingredients on the plate before and after the meal is calculated by using the detection area of ​​the ingredients before and after the meal and the final prediction results. The relationship in the process is: ; in, Indicates the detection area of ​​the ingredients of the dishes before the meal. Indicates the detection area of ​​the ingredients of the dishes after the meal. Indicates the height of the dish. Indicates the weight of the ingredients on the plate before eating. Indicates the weight of the ingredients on the plate after the meal. Indicates the density of the ingredient; Based on the weight of the ingredients on the plate before and after the meal, the carbon emission percentage of the wasted food is calculated using a carbon emission calculation model. The specific steps are as follows: The carbon emission factor of the ingredients is calculated through the carbon emission calculation model. The calculation formula is as follows: ; in, represents the carbon emission factor of the ingredient, Indicates the total carbon emissions generated during the transportation of ingredients. Indicates the weight of ingredients as a percentage of the total weight of the dish being transported. Indicates the carbon emissions of the equipment during the refrigeration process of the ingredients. Indicates the proportion of ingredient refrigeration time to the monthly equipment operation time. represents the carbon footprint of cooking ingredients, It indicates the proportion of each student's consumption of the ingredient to the weight of the ingredient; The carbon emission factor of the ingredients is combined with the weight of the ingredients on the plate before and after the meal to calculate the total carbon emissions of the dishes before and after the meal, and finally the percentage of carbon emissions from wasted dishes is obtained. The calculation relationship in the process is as follows: ; in, Indicates the total carbon emissions of dishes before eating. Indicates the total carbon emissions of the dishes after dining. Indicates the percentage of carbon emissions from wasted dishes.

2. The method for calculating the carbon emissions of dishes based on YOLOv8 according to claim 1 is characterized in that: In step 1, historical data of dish images and dish ingredient related information are collected to construct a dish image dataset, and the expression of the dish image dataset is: ; in, represents a dish image dataset, Represents a dish image, Indicates dish image label information, Indicates the total number of dish image data.

3. The calculation system of carbon emissions of dishes based on YOLOv8 is characterized by: The system applies the method for calculating the carbon emissions of dishes based on YOLOv8 as described in any one of claims 1 to 2 above, and the system includes: The data set construction module is used to collect historical data of dish images and dish ingredient related information to construct a dish image data set; The model training module is used to build a target detection and recognition model based on the YOLOv8 algorithm, train the target detection and recognition model using the food image dataset, and optimize the target detection and recognition model using the total loss function to obtain a trained target detection and recognition model; The calculation module is used to use the trained target detection and recognition model in combination with any dish image to obtain the final prediction result, obtain the detection area of ​​the dish ingredients before and after the meal through the final prediction result, and calculate the weight of the dish ingredients on the plate before and after the meal by using the detection area of ​​the dish ingredients before and after the meal and the final prediction result. Based on the weight of the dish ingredients on the plate before and after the meal, the carbon emission percentage of the wasted dish is calculated through the carbon emission calculation model.

Citation Information

Patent Citations

  • Carbon emission monitoring methods and equipment based on catering consumption data processing

    CN115660292B

  • Seedling missing identification method, device, equipment and medium

    CN117636314A