Model training method and finished dish nutritional ingredient analysis method and device
By constructing a nutritional component analysis method for finished dishes based on regression model, the problem of low accuracy of nutrient analysis of finished dishes in the prior art is solved, and more efficient and accurate nutritional component analysis is achieved.
Patent Information
- Application Number
- CN202411632596.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-02-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing nutrient analysis methods for finished dishes have low accuracy and cannot effectively consider the loss and conversion of nutrients during cooking.
By obtaining the dish data and nutrient element content observations of the dish sample, the raw nutrient element data and category nutrient element data are determined, the correlation coefficient is calculated, and the regression is constructed with the raw nutrient element data as independent variables and the dish nutrient element content value as dependent variables. Model, used to analyze the nutritional content of dishes.
It improves the accuracy and efficiency of nutrient analysis of finished dishes, and can more accurately reflect the nutritional changes of raw material ingredients and categories during the cooking process.
Smart Images

Figure CN119446424A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a model training method, a method and a device for analyzing the nutritional components of finished dishes. Background Art
[0002] As people's living standards improve, their attention to healthy diet and nutritional intake is also increasing. How to ensure the health and nutritional balance of daily diet has become a common concern of the people. Therefore, in-depth research on how to scientifically and rationally absorb food nutrients has become a research hotspot in the current field of food science and nutrition.
[0003] At present, the methods for calculating food nutrients mainly include weighing calculation method and chemical analysis method. Among them, the chemical analysis method uses various chemical or biochemical reactions to separate the nutrients of food and identify their concentrations, but the operation requirements are high, and it takes a relatively long time and costs a lot. In situations where rapid and batch detection of food nutrients is required, the application of chemical analysis method is subject to certain limitations, and it is difficult to meet the needs of rapid response and large-scale sample processing, and it is difficult to become a universal method for the research and promotion of nutrients in finished dishes. The weighing calculation method relies on the name and weight of known ingredients, combined with a professional food ingredient database, to estimate the various nutrients ingested by individuals through diet through calculation. However, the estimation results of the weighing calculation method are mainly based on the nutritional data of the ingredients before cooking, and the changes such as loss and conversion of nutrients that may occur during the cooking process are ignored, which affects the accuracy of the calculation results to a certain extent. Therefore, the accuracy of the existing nutrient analysis methods for finished dishes is low. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a model training method, a method and device for analyzing the nutritional components of finished dishes, aiming to improve the accuracy of nutrient analysis of finished dishes.
[0005] To achieve the above objectives, in a first aspect, an embodiment of the present application proposes a model training method, the method comprising:
[0006] Acquire dish data of a dish sample and an observed value of a nutrient content of any nutrient element, wherein the dish data includes raw material data of raw material ingredients;
[0007] Determine raw material nutrient element data for the nutrient element based on the dish data, the raw material nutrient element data including one of a raw material nutrient element content value and a category nutrient element content value, the raw material nutrient element content value is used to describe the content data of the raw material component with respect to the nutrient element, and the category nutrient element content value is used to describe the content data of the raw material category to which the raw material component belongs with respect to the nutrient element;
[0008] Based on the raw material nutrient element data and the observed value of the nutrient element content, a correlation coefficient is determined, wherein the correlation coefficient is used to indicate the contribution of each of the raw material nutrient element data to the nutrient element content value of the dish;
[0009] Based on the correlation coefficient, a regression model is constructed with the raw material nutrient element data as the independent variable and the dish nutrient element content as the dependent variable.
[0010] In a possible implementation, the dish data further includes the dish weight of the dish sample; the raw material data includes the edible part ratio of the raw material, the raw material weight and the nutrient element content ratio;
[0011] The step of determining the raw material nutrient element data for the nutrient element based on the dish data includes:
[0012] For any raw material component, based on the raw material edible part ratio, raw material weight, nutrient element content ratio and the dish weight of the raw material component, the raw material nutrient element content value of the raw material component with respect to the nutrient element is determined.
[0013] In a possible implementation, the dish data further includes a cooking method of the dish sample;
[0014] The step of determining the raw material nutrient element data for the nutrient element based on the dish data further includes:
[0015] For any cooking method, classify the raw material ingredients of the corresponding dish sample and determine the raw material category to which it belongs;
[0016] Based on the raw material nutrient element content value of at least one raw material component belonging to the same raw material category, the category nutrient element content value of the raw material category with respect to the nutrient element is determined.
[0017] In a possible implementation, determining the correlation coefficient based on the raw material nutrient element data and the observed value of the nutrient element content includes:
[0018] Establishing a multiple linear regression model with the raw material nutrient element data as an independent variable and the nutrient element content observation value as a dependent variable, and forming a solution model that satisfies the function conditions of a preset quadratic programming function, wherein the solution model is used to solve the regression coefficient in the multiple linear regression model;
[0019] Based on the raw material nutrient element data and the observed values of the nutrient element content, the model parameters specified in the solution model are determined, and the optimization function used to solve the quadratic programming function is called to calculate the solution model, and the regression coefficient is determined as the correlation coefficient.
[0020] In a possible implementation, the determining of the model parameters specified in the solution model based on the raw material nutrient element data and the observed values of the nutrient element content, calling the optimization function for solving the quadratic programming function to calculate the solution model, and determining the regression coefficient as the correlation coefficient includes:
[0021] Based on the correlation coefficient, determining the predicted value of the nutrient element content of the dish sample;
[0022] The sum of square errors between the predicted value of the nutrient element content and the observed value of the nutrient element content is calculated, and the correlation coefficient is optimized using the sum of square errors.
[0023] In a possible implementation, the correlation coefficient includes a first correlation coefficient and a second correlation coefficient, the first correlation coefficient is used to describe the importance of the raw material component to the nutrient element content value of the dish, and the second correlation coefficient is used to describe the importance of the raw material category to the nutrient element content value of the dish under the cooking method; the regression model includes a first regression model and a second regression model;
[0024] The step of constructing a regression model based on the correlation coefficient, taking the raw material nutrient element data as the independent variable and the dish nutrient element content value as the dependent variable, comprises:
[0025] Constructing a first regression model with the raw material nutrient element content value of the raw material ingredients as the independent variable and the dish nutrient element content value as the dependent variable, and using the first correlation coefficient as the regression coefficient of the first regression model;
[0026] Or, for any cooking method, a second regression model is constructed with the category nutrient element content value as the independent variable and the dish nutrient element content value as the dependent variable, and the second correlation coefficient corresponding to the cooking method is used as the regression coefficient of the second regression model.
[0027] In a possible implementation, the step of obtaining dish data of a dish sample and an observed value of a nutrient content of any nutrient element includes:
[0028] Access to food composition databases;
[0029] Filling missing values in the dish data based on the food ingredient database;
[0030] Anomaly processing is performed on data anomalies in the dish data.
[0031] In a second aspect, the present application embodiment proposes a method for analyzing the nutritional components of a finished dish, the method comprising:
[0032] Obtaining dish data of a target dish;
[0033] The dish data is input into a regression model generated by the model training method as described in the first aspect or any possible implementation of the first aspect to perform nutrient component analysis and output the dish nutrient element content value of the target dish.
[0034] In a third aspect, an embodiment of the present application provides a model training device, the device comprising:
[0035] A sample data acquisition module, used to acquire dish data of a dish sample and an observed value of a nutrient content of any nutrient element, wherein the dish data includes raw material data of raw material ingredients;
[0036] a raw material nutrient element calculation module, used to determine raw material nutrient element data for the nutrient element based on the dish data, the raw material nutrient element data including one of a raw material nutrient element content value and a category nutrient element content value, the raw material nutrient element content value is used to describe the content data of the raw material component with respect to the nutrient element, and the category nutrient element content value is used to describe the content data of the raw material category to which the raw material component belongs with respect to the nutrient element;
[0037] A correlation coefficient calculation module, used to determine a correlation coefficient based on the raw material nutrient element data and the observed value of the nutrient element content, wherein the correlation coefficient is used to indicate the contribution of each of the raw material nutrient element data to the nutrient element content value of the dish;
[0038] The regression model building module is used to build a regression model with the raw material nutrient element data as the independent variable and the dish nutrient element content value as the dependent variable based on the correlation coefficient.
[0039] In a fourth aspect, the present application provides a device for analyzing the nutritional components of finished dishes, the device comprising:
[0040] A data acquisition module, used to acquire dish data of a target dish;
[0041] An analysis module is used to input the dish data into a regression model generated by the model training method as described in the first aspect or any possible implementation of the first aspect to perform nutritional component analysis and output the dish nutritional element content value of the target dish.
[0042] The model training method, finished dish nutrient component analysis method and device proposed in the present application calculate the raw material nutrient element content value of the raw material component and the category nutrient element content value of the raw material category to which the raw material component belongs, and then determine the correlation coefficient between the raw material nutrient element content value and the category nutrient element content value for the dish nutrient element content analysis, which can reflect the nutritional changes of different raw material components or different raw material categories during the cooking process, and consider the correlation between the raw material component, raw material category and the dish nutrient element content, thereby improving the accuracy of model training. Thus, based on the correlation coefficient, a regression model with raw material nutrient element data as the independent variable and dish nutrient element content value as the dependent variable is constructed, and the nutrient element content of the dish is analyzed by using the regression model, which can effectively improve the accuracy and efficiency of the nutrient analysis of the finished dish, and has a large application range. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A flowchart of a model training method provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of a process for calculating a correlation coefficient provided in an embodiment of the present application;
[0045] Figure 3 A schematic diagram of a method for analyzing the nutritional components of a finished dish provided in an embodiment of the present application;
[0046] Figure 4 A schematic diagram of the structure of a model training device provided in an embodiment of the present application;
[0047] Figure 5 A schematic diagram of the structure of a finished dish nutritional component analysis device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0051] First, some nouns involved in this application are analyzed:
[0052] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0053] Regression model: A mathematical model that quantitatively describes statistical relationships and is used to analyze the linear relationship between two or more independent variables (explanatory variables) and dependent variables (response variables). It provides an intuitive mathematical expression that can clearly show the relationship between each independent variable and the dependent variable.
[0054] Quadratic Programming (QP): Quadratic programming is a special case of nonlinear programming, characterized by the objective function being a quadratic real function and the constraints being linear. In the field of mathematical optimization, bounded constrained quadratic programming is a classic and widely used type of problem, which requires finding a vector within certain limits so that an objective function consisting of quadratic terms and linear terms reaches its minimum value.
[0055] At present, the methods for calculating food nutrients mainly include weighing calculation method and chemical analysis method. First, chemical analysis method uses various chemical or biochemical reactions to separate the nutrients of food and identify their concentrations, but the operation requirements are high, and it takes a relatively long time and costs a lot. In situations where rapid and batch testing of food nutrients is required, the application of chemical analysis method is subject to certain limitations, and it is difficult to meet the needs of rapid response and large-scale sample processing, and it is difficult to become a universal method for the research and promotion of nutrients in finished dishes.
[0056] Secondly, the weighing calculation method relies on the name and weight of known ingredients, combined with a professional food composition database, to estimate the various nutrients an individual consumes through diet. However, the estimated results of the weighing calculation method are mainly based on the nutritional data of the ingredients before cooking, and the loss and conversion of nutrients that may occur during the cooking process are ignored, which to some extent affects the accuracy of the calculation results.
[0057] Therefore, the existing weighing calculation method and chemical analysis method used for nutrient analysis of finished dishes have limitations and low accuracy.
[0058] Based on the above problems, the embodiments of the present application provide a model training method, a method and device for analyzing the nutritional components of finished dishes, which calculate the raw material nutrient element content value of the raw material component and the category nutrient element content value of the raw material category to which the raw material component belongs, and then determine the correlation coefficient between the two for the analysis of the nutrient element content of the dish, and use this to establish a regression model for predicting the nutrient element content of the dish. It can reflect the nutritional changes of different raw material components or different raw material categories during the cooking process, improve the accuracy of model training, and can effectively improve the accuracy and efficiency of nutrient analysis of finished dishes, and has a large range of applications.
[0059] The model training method, finished dish nutritional component analysis method and device provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the model training method and finished dish nutritional component analysis method in the embodiments of the present application are described.
[0060] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0061] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0062] The training method of the model provided in the embodiment of the present application and the method for analyzing the nutritional components of finished dishes relate to the field of artificial intelligence technology. The training method of the model provided in the embodiment of the present application and the method for analyzing the nutritional components of finished dishes can be applied to the terminal, can also be applied to the server side, and can also be software running in the terminal or the server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, and can also be configured to provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms; the software can be the application of the training method of the model and the method for analyzing the nutritional components of finished dishes, etc., but is not limited to the above forms.
[0063] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0064] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0065] Figure 1 A flow chart of a model training method provided in an embodiment of the present application, Figure 1 The method may include but is not limited to steps S101 to S104.
[0066] S101. Acquire dish data of a dish sample and an observed value of a nutrient content of any nutrient element, wherein the dish data includes raw material data of raw material ingredients.
[0067] In the present application, the dish data includes raw material data of raw material ingredients, dish weight and cooking method, but is not limited thereto. The raw material data includes raw material weight, raw material edible part ratio, raw material edible part weight and nutrient content ratio, etc.
[0068] It should be noted that the nutrient elements may include water (g), energy (kcal), protein (g), fat (g), carbohydrate (g), cholesterol (mg), vitamin A (μg), vitamin B1 (mg), vitamin B2 (mg), vitamin E (mg), calcium (mg), phosphorus (mg), potassium (mg), sodium (mg), magnesium (mg), iron (mg), zinc (mg), selenium (μg), copper (mg), and manganese (mg), totaling 20. For example, the nutrient element content observation value may be the energy content observation value, protein content observation value, fat content observation value, etc. of the dish sample.
[0069] For example, the dish sample is a salad. For calculating the protein content in the salad, the dish weight of the salad is 500g, and the salad contains the following raw material ingredients and raw material data: first, lettuce, the raw material weight is 100g, the raw material edible part ratio is 100%, and the nutrient content ratio is 100g containing 1.4g protein; second, cucumber, the raw material weight is 100g, the raw material edible part ratio is 100%, and the nutrient content ratio is 100g containing 0.7g protein; third, tomato, the raw material The weight is 100g, the edible part ratio of the raw material is 90%, and the nutrient element content ratio is 0.9g of protein per 100g; fourth, chicken, the raw material weight is 100g, the edible part ratio of the raw material is 100%, and the nutrient element content ratio is 31g of protein per 100g; fifth, corn kernels, the raw material is corn, the edible part ratio of corn is 75%, and the edible part weight of corn kernels is 100g, the edible part ratio of corn kernels is 100%, and the nutrient element content ratio of corn kernels is 3.5g of protein per 100g.
[0070] In some embodiments, the step of obtaining dish data of a dish sample and an observed value of a nutrient content of any nutrient element includes:
[0071] Access to food composition databases;
[0072] Filling missing values in the dish data based on the food ingredient database;
[0073] Anomaly processing is performed on data anomalies in the dish data.
[0074] In this embodiment, for the missing values of dish data (such as raw material data of raw material ingredients), in the first optional implementation method, the raw material ingredient data of the corresponding dish is extracted from the food ingredient database (such as the regional food database) for filling. Specifically, priority is given to ingredients with the same raw materials, followed by ingredients with similar raw materials, and priority is given to ingredients with fewer missing components. In the second optional implementation method, the remaining missing values are filled, specifically, the priority is Food Safety Pass, the U.S. Department of Agriculture Food Data Center, and other platforms, and the nutrient element data of the same raw materials (priority) or similar ingredients are filled. In the third optional implementation method, the raw materials of dishes in a certain region are processed foods, such as cakes and platter materials, and the weighted average is taken according to the food recipe and ratio.
[0075] For abnormal values in dish data (such as the ratio of nutrient content in raw material data), they can be replaced with water: 0.1; protein 0.05; fat: 0.1. Or they can all be replaced with 0.
[0076] Therefore, this embodiment improves the integrity of the data by processing the missing values and abnormal values in the dish data, so as to improve the accuracy and efficiency of data processing.
[0077] S102. Based on the dish data, determine the raw material nutrient element data for the nutrient element, the raw material nutrient element data including one of a raw material nutrient element content value and a category nutrient element content value, the raw material nutrient element content value is used to describe the content data of the raw material component with respect to the nutrient element, and the category nutrient element content value is used to describe the content data of the raw material category to which the raw material component belongs with respect to the nutrient element.
[0078] In the present application, the nutrient content value of a raw material indicates the content value of the nutrient element in the raw material component. For example, the protein content value of lettuce is (1.4g / 100g)*100g*100%=1.4g.
[0079] It should be noted that the category nutrient content value represents the content value of the nutrient element in the raw material category, wherein the raw material category can be classified into poultry, other vegetables, condiments, oils and fats, aquatic products, livestock meat, edible fungi, rice and flour products, leafy vegetables, soybeans, fresh fruits, eggs, grains and beans and their products, nuts, potatoes, milk and dairy products, a total of 16 categories. Then, the raw material components are classified to determine the raw material category to which they belong, and for each raw material category, the raw material nutrient content values of one or more raw material components contained in the raw material category are superimposed to obtain the category nutrient content value of the raw material category. For example, in the above example, lettuce is classified as leafy vegetables, cucumbers, tomatoes and corn kernels are classified as other vegetables, then the category nutrient content value of leafy vegetables is the protein content value of lettuce, and the category nutrient content value of other vegetables is the sum of the protein content value of cucumbers, the protein content value of tomatoes and the protein content value of corn kernels.
[0080] S103. Determine a correlation coefficient based on the raw material nutrient element data and the observed value of the nutrient element content, wherein the correlation coefficient is used to indicate the contribution of each raw material nutrient element data to the nutrient element content value of the dish.
[0081] In the prior art, the nutritional content of a dish is calculated as the sum of the nutritional content of the raw materials contained in the dish, that is, the traditional weighing calculation method is theoretically that the nutritional contribution of each raw material component to the finished dish is equivalent, and its weight is 1. However, in real life, due to biochemical changes in the cooking process, the retention or loss of nutrients in different raw materials is different. For example, after vegetables are fried, the water-soluble vitamins such as vitamin C and certain B vitamins they contain may suffer serious losses. Therefore, the prior art simply regards the nutritional contributions of all raw materials as equivalent, which may ignore nutritional changes, thereby affecting the accuracy of the nutritional evaluation of the finished dish.
[0082] Based on the above problems, the present application is directed to the raw material ingredients, based on the raw material nutrient element content value and the observed value of the nutrient element content of each raw material ingredient, to determine the correlation coefficient of the raw material ingredients, that is, the correlation coefficient is used to describe the importance (i.e., contribution) of the raw material ingredient to the nutrient element content of the dish. For the raw material category, based on the category nutrient element content value and the observed value of the nutrient element content of each raw material category, the correlation coefficient of the raw material category is determined, that is, the correlation coefficient is used to describe the importance (i.e., contribution) of the raw material category to the nutrient element content of the dish, and the raw material category is distinguished. It should be noted that the correlation coefficient of each raw material ingredient / raw material category may be different, and it is limited to change within the range of 0-1 to achieve the detailed changes in the contribution of different raw material ingredients / raw material categories to the nutrient element content of the dish. For example, after vegetables are fried, the water-soluble vitamins contained therein, such as certain B vitamins (such as vitamin B1, vitamin B2), may suffer serious losses, that is, when calculating the vitamin B1 (or vitamin B2) of the dish, the correlation coefficient of the vegetable category is set to be less than 1.
[0083] Therefore, this application takes into account the impact of cooking methods on the retention or loss of nutrients, and the correlation between raw material ingredients, raw material categories and the nutrient content of dishes, and can effectively improve the accuracy of model training, so that by optimizing the correlation coefficient, the accuracy of the prediction of the nutritional components of finished dishes can be significantly improved.
[0084] S104. Based on the correlation coefficient, a regression model is constructed with the raw material nutrient element data as the independent variable and the dish nutrient element content value as the dependent variable.
[0085] In the present application, the correlation coefficient is used as the regression coefficient of the regression model. Specifically, for the raw material ingredients, a regression model with the raw material nutrient element content value as the independent variable and the dish nutrient element content value as the dependent variable is constructed, and the correlation coefficient of the raw material ingredients is used as the regression coefficient of the regression model. For the raw material category, a regression model with the category nutrient element content value as the independent variable and the dish nutrient element content value as the dependent variable is constructed, and the correlation coefficient of the raw material category is used as the regression coefficient of the regression model. Therefore, by inputting the dish data of the dish into the corresponding regression model, the dish nutrient element content value of the dish can be quickly obtained, which improves the prediction efficiency and applicability, greatly reduces the difficulty and limitations of nutrient element analysis, and then helps users customize personalized diet plans.
[0086] The training method of the model proposed in this embodiment calculates the raw material nutrient element content value of the raw material component and the category nutrient element content value of the raw material category to which the raw material component belongs, and then determines the correlation coefficient between the raw material nutrient element content value and the category nutrient element content value for the analysis of the nutrient element content of the dish, which can reflect the nutritional changes of different raw material components or different raw material categories during the cooking process, and considers the correlation between the raw material component, the raw material category and the nutrient element content of the dish, thereby improving the accuracy of model training. Thus, based on the correlation coefficient, a regression model with the raw material nutrient element data as the independent variable and the dish nutrient element content value as the dependent variable is constructed, and the nutrient element content of the dish is analyzed by using the regression model, which can effectively improve the accuracy and efficiency of the nutrient analysis of the finished dish, and has a large application range.
[0087] In some embodiments, the dish data further includes the dish weight of the dish sample; the raw material data includes the ratio of the edible parts of the raw materials, the weight of the raw materials, and the ratio of the nutrient content; and determining the raw material nutrient element data for the nutrient element based on the dish data includes:
[0088] For any raw material component, based on the raw material edible part ratio, raw material weight, nutrient element content ratio and the dish weight of the raw material component, the raw material nutrient element content value of the raw material component with respect to the nutrient element is determined.
[0089] Exemplarily, the above example is used to illustrate that for calculating the protein content in the salad, the raw material nutrient element data includes the protein content value of lettuce, the protein content value of cucumber, the protein content value of tomato, the protein content value of chicken and the protein content value of corn kernels. Among them, the protein content value of lettuce is (1.4g / 100g)*100g*100%=1.4g, the protein content value of cucumber is (0.7g / 100g)*100g*100%=0.7g, the protein content value of tomato is (0.9g / 100g)*100g*90%=0.81g, the protein content value of chicken is (31g / 100g)*100g*100%=31g, and the protein content value of corn kernels is (3.5g / 100g)*100g*100%=3.5g.
[0090] Therefore, this embodiment determines the raw material nutrient content value of each raw material component in the dish through the raw material edible part ratio, raw material weight, nutrient content ratio and dish weight of the raw material components, thereby ensuring the accuracy of data processing and improving the accuracy of model training.
[0091] In some embodiments, the dish data further includes a cooking method of the dish sample; and determining the raw material nutrient element data for the nutrient element based on the dish data further includes:
[0092] For any cooking method, classify the raw material ingredients of the corresponding dish sample and determine the raw material category to which it belongs;
[0093] Based on the raw material nutrient element content value of at least one raw material component belonging to the same raw material category, the category nutrient element content value of the raw material category with respect to the nutrient element is determined.
[0094] In this embodiment, the cooking methods may include frying, steaming, frying, and braising, for a total of 4 categories. Then, each cooking method is traversed to determine the category nutrient content value of each raw material category. Specifically, for each cooking method, the raw material components of the dishes using the cooking method are classified to determine the raw material category to which they belong. Then, the raw material nutrient content values of one or more raw material components contained in the same raw material category are superimposed to obtain the category nutrient content value of the raw material category.
[0095] For example, in the above example, lettuce is classified as leafy vegetables, cucumbers, tomatoes and corn kernels are classified as other vegetables, and chicken is classified as poultry. Then the category nutrient content value of leafy vegetables is the protein content value of lettuce, that is, the category nutrient content value of leafy vegetables is 1.4g. The category nutrient content value of other vegetables is the sum of the protein content value of cucumbers, the protein content value of tomatoes and the protein content value of corn kernels, that is, the category nutrient content value of other vegetables is 0.7g+0.81g+3.5g=5.01g. The category nutrient content value of poultry is the protein content value of chicken, that is, the category nutrient content value of poultry is 31g.
[0096] Therefore, this application classifies the raw material ingredients, and then calculates the category nutrient content value of each raw material category, distinguishes the raw material categories, takes into account the correlation of the raw material category to the nutrient content of the dish, and then fits the nutritional changes of the raw material category during the cooking process, thereby improving the accuracy of model training.
[0097] In some embodiments, Figure 2 This is a flow chart of calculating the correlation coefficient provided in an embodiment of the present application. This embodiment provides a method for calculating the correlation coefficient, that is, step S103 may include but is not limited to steps S201 to S202.
[0098] S201, establishing a multiple linear regression model with the raw material nutrient element data as independent variables and the nutrient element content observation values as dependent variables, and forming a solution model that satisfies the function conditions of a preset quadratic programming function, wherein the solution model is used to solve the regression coefficients in the multiple linear regression model;
[0099] S202. Based on the raw material nutrient element data and the observed values of the nutrient element content, determine the model parameters specified in the solution model, call the optimization function for solving the quadratic programming function to calculate the solution model, and determine the regression coefficient as the correlation coefficient.
[0100] It should be noted that the multiple linear regression model shows the relationship between each independent variable and the dependent variable, that is, the relationship between the raw material nutrient element content value / category nutrient element content value and the observed nutrient element content value. For example, the dependent variable Y of the multiple linear regression model and the independent variables X1, X2, ..., X p The following relationship is satisfied: Y = β0 + β1X1 + ... β p X p +ε. Among them, β1,β2,…,β p is an unknown constant parameter and ε is an unobservable random error term.
[0101] Then, based on the least squares estimation of the multivariate linear regression model, this application introduces bounded constraints and constructs a constrained multivariate linear regression model. Under the framework of bounded constraints, this model not only minimizes the sum of squared errors to ensure the accuracy of the prediction results, but also enhances the interpretability of the model by limiting the range of coefficients. Specifically, the constrained multivariate linear regression model is the following formula (1):
[0102] min f(β)=(Y-Xβ) T (Y-Xβ)=Y T Y-2β T X T Y+β T X T Xβ
[0103] st i ∈[0,1]. (1);
[0104] Wherein, X represents the independent variable, i.e., the matrix of raw material nutrient element data, Y represents the dependent variable, i.e., the observed value of the nutrient element content, and β represents the coefficient term to be solved (i.e., the correlation coefficient in this application).
[0105] In matlab, MINQ is a program for solving quadratic programming, and its min q8 function is particularly suitable for solving bounded constrained indefinite quadratic programming problems. In order to make the multivariate linear regression model meet the requirements of this quadratic programming function (i.e., the formal requirements of the quadratic programming problem solved by the min q8 function, such as the function conditions of the quadratic programming function of this application), the model parameters r, c, A, b and D are set in this application, and r=Y T Y,c=-2X T Y, A = X, b = 0, D = 2, substitute the model parameters into formula (1) to obtain the solution model, as shown in the following formula (2):
[0106]
[0107] Therefore, the present application transforms the constrained linear regression model into a form suitable for solving using the quadratic programming method to obtain a solution model. Then, by calling the min q8 function (i.e., optimization function) to solve the solution model (i.e., formula (2)), the correlation coefficient β is obtained, and a regression model for predicting the nutrient content of dishes is established, thereby achieving accurate prediction of the nutrient content of finished dishes.
[0108] In some embodiments, step S202 includes:
[0109] Based on the correlation coefficient, determining the predicted value of the nutrient element content of the dish sample;
[0110] The sum of square errors between the predicted value of the nutrient element content and the observed value of the nutrient element content is calculated, and the correlation coefficient is optimized using the sum of square errors.
[0111] In the present application, a regression model is established using a correlation coefficient (i.e., the regression coefficient of the regression model), and the established regression model is used for prediction to obtain a predicted value of the nutrient content. Then, the sum of squares of the errors between the predicted value of the nutrient content and the observed value of the nutrient content is calculated to optimize the correlation coefficient and the regression model. Therefore, the present application optimizes the regression model by calculating the sum of squares of the errors between the predicted value of the nutrient content and the observed value of the nutrient content, thereby improving the accuracy of model training.
[0112] In some embodiments, the correlation coefficient includes a first correlation coefficient and a second correlation coefficient, the first correlation coefficient is used to describe the importance of the raw material component to the nutrient content value of the dish, and the second correlation coefficient is used to describe the importance of the raw material category to the nutrient content value of the dish under the cooking method; the regression model includes a first regression model and a second regression model. Specifically, step S104 includes:
[0113] Constructing a first regression model with the raw material nutrient element content value of the raw material ingredients as the independent variable and the dish nutrient element content value as the dependent variable, and using the first correlation coefficient as the regression coefficient of the first regression model;
[0114] Or, for any cooking method, a second regression model is constructed with the category nutrient element content value as the independent variable and the dish nutrient element content value as the dependent variable, and the second correlation coefficient corresponding to the cooking method is used as the regression coefficient of the second regression model.
[0115] In this embodiment, the contribution of all the nutrients in the dishes to the nutrient content of the dishes is considered to be equivalent in the prior art, and the nutritional changes in the cooking process are ignored, which affects the accuracy of the nutrient evaluation of the finished dishes. In this regard, on the one hand, for the raw material ingredients, based on the first correlation coefficient of each raw material ingredient, a first regression model is established with the raw material nutrient content value of the raw material ingredient as the independent variable and the dish nutrient content value as the dependent variable. It should be noted that the first correlation coefficient is used to describe the importance (i.e., contribution) of the raw material ingredient to the nutrient content of the dish, taking into account the nutritional changes of each raw material ingredient during the cooking process, that is, taking into account the influence of the cooking method on the retention or loss of the nutrients that may be produced, and taking into account the correlation between the raw material ingredients and the nutrient content of the dishes. Therefore, the present application constructs a first regression model through the first correlation coefficient, improves the accuracy of the regression model, and is conducive to improving the accuracy of the prediction of the nutrient elements of the dishes.
[0116] On the other hand, for the raw material category, based on the second correlation coefficient of each raw material category, a second regression model is established with the category nutrient content value of the raw material category as the independent variable and the nutrient content value of the dish as the dependent variable. It should be noted that different second regression models are set up for different cooking methods, and the second correlation coefficient is used to describe the importance of the raw material category to the nutrient content value of the dish under the cooking method, taking into account the nutritional changes of each raw material category during the cooking process, that is, taking into account the impact of the cooking method and raw material category on the possible retention or loss of nutrients, and taking into account the correlation between the cooking method, raw material category and the nutrient content of the dish. Therefore, the present application constructs a second regression model through the second correlation coefficient, which improves the accuracy of the regression model and is conducive to improving the accuracy of the prediction of nutrient elements in dishes.
[0117] Therefore, this application takes into account the impact of cooking methods on the retention or loss of nutrients, and the correlation between raw material ingredients, raw material categories and the nutrient content of dishes, and can effectively improve the accuracy of model training, so that by optimizing the correlation coefficient, the accuracy of the prediction of the nutritional components of finished dishes can be significantly improved.
[0118] Figure 3 A schematic diagram of a method for analyzing the nutritional components of a finished dish provided in an embodiment of the present application. Figure 3 The method may include but is not limited to steps S301 to S302.
[0119] S301, obtaining dish data of a target dish;
[0120] S302: Input the dish data into a regression model generated by a model training method to perform nutrient component analysis and output the dish nutrient element content value of the target dish.
[0121] The method for analyzing the nutritional components of finished dishes proposed in this embodiment can quickly obtain the nutritional element content value of the dish by inputting the dish data of the dish into the corresponding regression model. The regression model can reflect the nutritional changes of different raw material components or different raw material categories during the cooking process. Taking into account the correlation between raw material components, raw material categories and the nutritional element content of the dish, it can effectively improve the accuracy and efficiency of the nutrient analysis of finished dishes, and has a large range of applications, thereby helping users to customize personalized diet plans.
[0122] For example, the energy content prediction of 106 dish samples is used for explanation, including raw material ingredients (216 kinds) and nutrient elements (20 kinds). First, the dish data and energy content observation values of the dish samples are obtained. For the raw material ingredients, the raw material nutrient element content values of 216 raw material ingredients are obtained. Then, based on the raw material nutrient element content values and energy content observation values of the raw material ingredients, the model parameters are determined, and the following formula is given as an example:
[0123]
[0124] In addition, the sum of squared errors between the observed value and the predicted value of the energy content is calculated, that is, the sum of squared errors err = 20807422.1771553.
[0125] Then, call the min q8 function, input the above model parameters into the solution model, set the lower and upper bounds to 0 and 1 respectively, to obtain the correlation coefficient. And form a regression model, as shown in the following formula (3):
[0126] Y=X1+…+X4+0.6317X6+X7+0.7588X8+…+X 216 (3).
[0127] Optionally, for raw material ingredients, Table 1 shows the results of the prediction of all ingredients of 106 Chaozhou dishes by the first regression model. It can be seen that the sum of squares of the prediction errors of the 20 nutrients are lower than the traditional calculation method (the traditional calculation method is the traditional weighing calculation method, and the contribution of each raw material ingredient to the nutrient element of the finished dish is equivalent, and its weight is 1).
[0128]
[0129]
[0130] Table 1
[0131] Optionally, for the raw material category, Table 2 shows the error sum of squares predicted by the second regression model for all ingredients of 106 Teochew dishes in the blanching category and the percentage reduction compared to the traditional calculation method, wherein vitamin A in Table 2 (marked with * in the table) indicates that the error sum of squares predicted by the regression model has increased. Table 3 shows the error sum of squares predicted by the second regression model for all ingredients of 106 Teochew dishes in the fried category and the percentage reduction compared to the traditional calculation method, wherein vitamin A in Table 3 (marked with * in the table) indicates that the error sum of squares predicted by the regression model has increased. Table 4 shows the error sum of squares predicted by the second regression model for all ingredients of 106 Teochew dishes in the steamed, stir-fried and stewed category and the percentage reduction compared to the traditional calculation method, wherein moisture in Table 4 (marked with * in the table) indicates that the error sum of squares predicted by the regression model has increased. Table 5 shows the error sum of squares predicted by the second regression model for all ingredients of 106 Teochew dishes in the fried category and the percentage reduction compared to the traditional calculation method. It can be seen that the prediction error sum of squares of 20 nutrients is mostly lower than the traditional calculation method.
[0132] Serial number Nutritional elements Calculated Value Predicted value Reduction percentage (%) 1 Water content (g) 230235.24 97113.16 57.82 2 Energy (kcal) 12132125.33 741663.11 93.89 3 Protein (g) 27276.13 3760.36 86.21 4 Fat (g) 43497.39 3447.64 92.07 5 Carbohydrate (g) 112862.50 5541.63 95.09 6 Cholesterol (mg) 379647.08 53666.79 85.86 7 Vitamin A (mg) 35185133.97 36474743.51 3.678* 8 Vitamin B1 (mg) 0.89 0.00 99.90 9 Vitamin B2 (mg) 1.38 0.11 92.08 10 Vitamin E (mg) 13858.69 13.52 99.90 11 Calcium (mg) 6687082.58 4461862.47 33.28 12 Phosphorus (mg) 1981078.87 1267300.62 36.03 13 Potassium (mg) 21383756.45 959684.97 95.51 14 Sodium (mg) 1877853556.15 1089629.34 99.94 15 Magnesium (mg) 311710.97 28645.40 90.81 16 Iron (mg) 1450.98 50.79 96.50 17 Zinc (mg) 220.49 104.10 52.79 18 Selenium (ug) 16722.07 11960.91 28.47 19 Copper (mg) 23.30 14.60 37.34 20 Manganese (mg) 56.19 1.08 98.08
[0133] Table 2
[0134]
[0135]
[0136] Table 3
[0137] Serial number Nutritional elements Calculated Value Predicted value Reduction percentage (%) 1 Water content (g) 12273.36 13931.63 13.51* 2 Energy (kcal) 7004054.70 107973.19 98.46 3 Protein (g) 20914.62 636.77 96.96 4 Fat (g) 17282.50 1039.57 93.98 5 Carbohydrate (g) 61098.79 34.62 99.94 6 Cholesterol (mg) 422174.13 6420.92 98.48 7 Vitamin A (mg) 14123167.33 13328240.82 5.63 8 Vitamin B1 (mg) 0.57 0.00 100.00 9 Vitamin B2 (mg) 1.30 0.00 99.79 10 Vitamin E (mg) 2750.37 4.23 99.85 11 Calcium (mg) 433236.04 5379.35 98.76 12 Phosphorus (mg) 1280332.61 50906.61 96.02 13 Potassium (mg) 4057620.77 260661.43 93.58 14 Sodium (mg) 908853886.62 240279.69 99.97 15 Magnesium (mg) 218444.78 24532.14 88.77 16 Iron (mg) 4234.59 5.99 99.86 17 Zinc (mg) 629.01 18.43 97.07 18 Selenium (ug) 26106.61 19367.15 25.82 19 Copper (mg) 41.19 19.52 52.62 20 Manganese (mg) 69.96 0.44 99.38
[0138] Table 4
[0139] Serial number Nutritional elements Calculated Value Predicted value Reduction percentage (%) 1 Water content (g) 9498.84 5035.60 46.99 2 Energy (kcal) 200764.12 91073.90 54.64 3 Protein (g) 1046.93 541.04 48.32 4 Fat (g) 1124.60 538.31 52.13 5 Carbohydrate (g) 4796.58 2571.37 46.39 6 Cholesterol (mg) 31931.39 19645.23 38.48 7 Vitamin A (mg) 27714.75 9546.25 65.56 8 Vitamin B1 (mg) 0.04 0.00 100.00 9 Vitamin B2 (mg) 0.21 0.05 74.53 10 Vitamin E (mg) 193.37 14.43 92.54 11 Calcium (mg) 91093.13 7779.90 91.46 12 Phosphorus (mg) 138804.65 98150.56 29.29 13 Potassium (mg) 257883.06 189305.94 26.59 14 Sodium (mg) 668867685.19 158731.98 99.98 15 Magnesium (mg) 19005.05 3313.97 82.56 16 Iron (mg) 83.44 1.60 98.09 17 Zinc (mg) 10.26 2.80 72.68 18 Selenium (ug) 26451.30 8718.74 67.04 19 Copper (mg) 5.67 4.40 22.31 20 Manganese (mg) 9.98 0.05 99.45
[0140] Table 5
[0141] Figure 4 A schematic diagram of a structure of a model training device provided in an embodiment of the present application, wherein the model training device 400 includes:
[0142] The sample data acquisition module 401 is used to acquire the dish data of the dish sample and the observed value of the nutrient content of any nutrient element, wherein the dish data includes the raw material data of the raw material ingredients;
[0143] A raw material nutrient element calculation module 402 is used to determine raw material nutrient element data for the nutrient element based on the dish data, wherein the raw material nutrient element data includes one of a raw material nutrient element content value and a category nutrient element content value, wherein the raw material nutrient element content value is used to describe the content data of the raw material component with respect to the nutrient element, and the category nutrient element content value is used to describe the content data of the raw material category to which the raw material component belongs with respect to the nutrient element;
[0144] A correlation coefficient calculation module 403, for determining a correlation coefficient based on the raw material nutrient element data and the observed nutrient element content, wherein the correlation coefficient is used to indicate the contribution of each raw material nutrient element data to the nutrient element content value of the dish;
[0145] The regression model building module 404 is used to build a regression model with the raw material nutrient element data as the independent variable and the dish nutrient element content value as the dependent variable based on the correlation coefficient.
[0146] In some embodiments, the dish data also includes the dish weight of the dish sample; the raw material data includes the edible part ratio of the raw material, the raw material weight and the nutrient content ratio; the raw material nutrient element calculation module 502 includes:
[0147] The raw material nutrient element content value calculation unit is used to determine the raw material nutrient element content value of any raw material component with respect to the nutrient element based on the raw material edible part ratio, raw material weight, nutrient element content ratio and the dish weight of the raw material component.
[0148] In some embodiments, the dish data also includes the cooking method of the dish sample; the raw material nutrient element calculation module 402 also includes:
[0149] A classification unit, for classifying the raw material components of a corresponding dish sample for any cooking method, and determining the raw material category to which it belongs;
[0150] The category nutrient element content value calculation unit is used to determine the category nutrient element content value of the raw material category with respect to the nutrient element based on the raw material nutrient element content value of at least one raw material component belonging to the same raw material category.
[0151] In some embodiments, the correlation coefficient calculation module 403 includes:
[0152] A solution model building unit, used to establish a multiple linear regression model with the raw material nutrient element data as an independent variable and the nutrient element content observation value as a dependent variable, and to form a solution model that satisfies the function conditions of a preset quadratic programming function, wherein the solution model is used to solve the regression coefficient in the multiple linear regression model;
[0153] The model solving unit is used to determine the model parameters specified in the solution model based on the raw material nutrient element data and the observed values of the nutrient element content, and call the optimization function used to solve the quadratic programming function to calculate the solution model, and determine the regression coefficient as the correlation coefficient.
[0154] In some embodiments, the model solving unit includes:
[0155] A prediction unit, used to determine a predicted value of the nutrient content of the dish sample based on the correlation coefficient;
[0156] The optimization unit is used to calculate the sum of square errors between the predicted value of the nutrient element content and the observed value of the nutrient element content, and optimize the correlation coefficient using the sum of square errors.
[0157] In some embodiments, the correlation coefficient includes a first correlation coefficient and a second correlation coefficient, the first correlation coefficient is used to describe the importance of the raw material component to the nutrient element content value of the dish, and the second correlation coefficient is used to describe the importance of the raw material category to the nutrient element content value of the dish under the cooking method; the regression model includes a first regression model and a second regression model; the regression model construction module 404 includes:
[0158] A first regression model building unit is used to build a first regression model with the raw material nutrient element content value of the raw material composition as an independent variable and the dish nutrient element content value as a dependent variable, and the first correlation coefficient is used as a regression coefficient of the first regression model;
[0159] The second regression model building unit is used to build a second regression model with the category nutrient element content value as the independent variable and the dish nutrient element content value as the dependent variable for any cooking method, and use the second correlation coefficient corresponding to the cooking method as the regression coefficient of the second regression model.
[0160] In some embodiments, the sample data acquisition module 401 includes:
[0161] A database acquisition unit, used for acquiring a food composition database;
[0162] A data filling unit, used for filling missing data values in the dish data based on the food ingredient database;
[0163] The exception processing unit is used to perform exception processing on data abnormal values in the dish data.
[0164] Figure 5The structural diagram of a finished dish nutritional component analysis device provided in an embodiment of the present application, the finished dish nutritional component analysis device 500 comprises:
[0165] The data acquisition module 501 is used to acquire the dish data of the target dish;
[0166] The analysis module 502 is used to input the dish data into a regression model generated by the model training method to perform nutrient component analysis and output the dish nutrient element content value of the target dish.
[0167] The device of the embodiments of the present application can execute the method provided by the embodiments of the present application, and the implementation principles are similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.
[0168] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0169] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0170] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0171] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0172] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0173] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0174] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0175] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0176] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0177] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0178] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A model training method, characterized in that: The method comprises: Acquire dish data of a dish sample and an observed value of a nutrient content of any nutrient element, wherein the dish data includes raw material data of raw material ingredients; Determine raw material nutrient element data for the nutrient element based on the dish data, the raw material nutrient element data including one of a raw material nutrient element content value and a category nutrient element content value, the raw material nutrient element content value is used to describe the content data of the raw material component with respect to the nutrient element, and the category nutrient element content value is used to describe the content data of the raw material category to which the raw material component belongs with respect to the nutrient element; Based on the raw material nutrient element data and the observed value of the nutrient element content, a correlation coefficient is determined, wherein the correlation coefficient is used to indicate the contribution of each of the raw material nutrient element data to the nutrient element content value of the dish; Based on the correlation coefficient, a regression model is constructed with the raw material nutrient element data as the independent variable and the dish nutrient element content as the dependent variable.
2. The training method of the model according to claim 1, characterized in that: The dish data also includes the dish weight of the dish sample; the raw material data includes the edible part ratio of the raw material, the raw material weight and the nutrient element content ratio; The step of determining the raw material nutrient element data for the nutrient element based on the dish data includes: For any raw material component, based on the raw material edible part ratio, raw material weight, nutrient element content ratio and the dish weight of the raw material component, the raw material nutrient element content value of the raw material component with respect to the nutrient element is determined.
3. The training method of the model according to claim 2, characterized in that: The dish data also includes the cooking method of the dish sample; The step of determining the raw material nutrient element data for the nutrient element based on the dish data further includes: For any cooking method, classify the raw material ingredients of the corresponding dish sample and determine the raw material category to which it belongs; Based on the raw material nutrient element content value of at least one raw material component belonging to the same raw material category, the category nutrient element content value of the raw material category with respect to the nutrient element is determined.
4. The training method of the model according to claim 3, characterized in that: The determining of the correlation coefficient based on the raw material nutrient element data and the nutrient element content observation value comprises: Establishing a multiple linear regression model with the raw material nutrient element data as an independent variable and the nutrient element content observation value as a dependent variable, and forming a solution model that satisfies the function conditions of a preset quadratic programming function, wherein the solution model is used to solve the regression coefficient in the multiple linear regression model; Based on the raw material nutrient element data and the observed values of the nutrient element content, the model parameters specified in the solution model are determined, and the optimization function used to solve the quadratic programming function is called to calculate the solution model, and the regression coefficient is determined as the correlation coefficient.
5. The training method of the model according to claim 4, characterized in that: The method of determining the model parameters specified in the solution model based on the raw material nutrient element data and the observed values of the nutrient element content, and calling the optimization function for solving the quadratic programming function to calculate the solution model, and determining the regression coefficient as the correlation coefficient, comprises: Based on the correlation coefficient, determining the predicted value of the nutrient element content of the dish sample; The sum of square errors between the predicted value of the nutrient element content and the observed value of the nutrient element content is calculated, and the correlation coefficient is optimized using the sum of square errors.
6. The training method of the model according to claim 5, characterized in that: The correlation coefficient includes a first correlation coefficient and a second correlation coefficient, wherein the first correlation coefficient is used to describe the importance of the raw material component to the nutrient element content value of the dish, and the second correlation coefficient is used to describe the importance of the raw material category to the nutrient element content value of the dish under the cooking method; the regression model includes a first regression model and a second regression model; The method of constructing a regression model based on the correlation coefficient, taking the raw material nutrient element data as the independent variable and the dish nutrient element content value as the dependent variable, comprises: Constructing a first regression model with the raw material nutrient element content value of the raw material ingredients as the independent variable and the dish nutrient element content value as the dependent variable, and using the first correlation coefficient as the regression coefficient of the first regression model; Or, for any cooking method, a second regression model is constructed with the category nutrient element content value as the independent variable and the dish nutrient element content value as the dependent variable, and the second correlation coefficient corresponding to the cooking method is used as the regression coefficient of the second regression model.
7. The training method of the model according to claim 6, characterized in that: The step of obtaining dish data of a dish sample and observed values of nutrient content of any nutrient element includes: Access to food composition databases; Filling missing values in the dish data based on the food ingredient database; Anomaly processing is performed on data anomalies in the dish data.
8. A method for analyzing the nutritional components of finished dishes, characterized in that: The method comprises: Obtaining dish data of a target dish; The dish data is input into a regression model generated by the model training method according to any one of claims 1 to 7 to perform nutrient component analysis and output the dish nutrient element content value of the target dish.
9. A model training device, characterized in that: The device comprises: A sample data acquisition module, used to acquire dish data of a dish sample and an observed value of a nutrient content of any nutrient element, wherein the dish data includes raw material data of raw material ingredients; a raw material nutrient element calculation module, used to determine raw material nutrient element data for the nutrient element based on the dish data, the raw material nutrient element data including one of a raw material nutrient element content value and a category nutrient element content value, the raw material nutrient element content value is used to describe the content data of the raw material component with respect to the nutrient element, and the category nutrient element content value is used to describe the content data of the raw material category to which the raw material component belongs with respect to the nutrient element; A correlation coefficient calculation module, used to determine a correlation coefficient based on the raw material nutrient element data and the observed value of the nutrient element content, wherein the correlation coefficient is used to indicate the contribution of each of the raw material nutrient element data to the nutrient element content value of the dish; The regression model building module is used to build a regression model with the raw material nutrient element data as the independent variable and the dish nutrient element content value as the dependent variable based on the correlation coefficient.
10. A device for analyzing the nutritional components of finished dishes, characterized in that: The device comprises: A data acquisition module, used to acquire dish data of a target dish; An analysis module is used to input the dish data into a regression model generated by the model training method as described in any one of claims 1 to 7 to perform nutritional component analysis and output the dish nutritional element content value of the target dish.
Citation Information
Patent Citations
Nutrient analysis method and device for menu
CN117912638A
Method and device for endowing menu with nutrition label, cooking machine and electronic equipment
CN118645213A
Food visual nutrition estimation method and device based on segmentation and regression technology
CN118824470A
Estimation device, estimation method, and program
WO2024190841A1