Model construction method and finished dish nutrient analysis method and device
By constructing a neural network factor decomposition machine model and combining multiple characteristic data of dish samples, the problem of insufficient accuracy in nutrient analysis of finished dishes is solved, and more efficient and accurate nutrient analysis is achieved.
Patent Information
- Application Number
- CN202411632593.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-11-15
AI Technical Summary
The prior art has the problem of insufficient accuracy in the analysis of nutrients of finished dishes. The chemical analysis method takes time and is costly, while the prototype food addition estimation method lacks accuracy.
By obtaining the food sample data of the dish sample, including raw material ingredient data, cooking method data, raw material quality data and raw material edible quality data, characteristic encoding and fusion, a neural network factor decomposition machine model is constructed to predict the content of food nutrients.
It improves the accuracy and efficiency of nutrient analysis of finished dishes, takes into account the correlation between multiple characteristic data, and expands the scope of application of the analysis.
Smart Images

Figure CN119446423A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a model construction method, a finished dish nutrient analysis method and a device. Background Art
[0002] Currently, food composition data has important academic, economic and social value.
[0003] In the process of studying food nutrients, chemical analysis is mainly used to calculate the content of various nutrients in prototype foods. However, this method has high technical barriers, is time-consuming, and has high analysis costs. In scenarios where rapid, batch, and real-time conversion of food nutrient content is required, the application of this method is greatly limited, and it is difficult to become a universal method for the research and promotion of nutrients in finished dishes. In this regard, the research on the nutrient content of finished dishes mainly uses the prototype food addition estimation method, which estimates the nutrient composition of the finished dish by adding the various nutrients in the prototype food. However, this method obviously lacks accuracy. Therefore, how to improve the accuracy of nutrient analysis of finished dishes has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a model construction method, a finished dish nutrient analysis method and a device, aiming to improve the accuracy of the finished dish nutrient analysis.
[0005] To achieve the above purpose, a first aspect of an embodiment of the present application proposes a method for constructing a model, the method comprising:
[0006] Acquire food sample data of a dish sample, wherein the food sample data comprises first food characteristic data and second food characteristic data, wherein the first food characteristic data comprises raw material composition data and cooking method data, and the second food characteristic data comprises raw material quality data and raw material edible quality data;
[0007] The first food feature data is encoded and then spliced to obtain first fused feature data, where the first fused feature data is used to indicate the influence between the raw material ingredient data and the cooking method data;
[0008] Based on the first fused feature data of the dish sample, the second food feature data, and the second fused feature data generated by the first fused feature data and the second food feature data, a preset neural network factor decomposition machine is trained to construct a food nutrient prediction model, wherein the second fused feature data is used to indicate the feature correlation between the first food feature data and the second food feature data.
[0009] In a possible implementation, encoding and splicing the first food feature data to obtain first fused feature data includes:
[0010] Preprocessing the first food characteristic data to obtain raw material component data to be processed and cooking method data to be processed;
[0011] Classifying and encoding the raw material component data to be processed according to preset component categories to obtain a raw material component data group of the dish sample, wherein the raw material component data group includes at least one raw material component in the dish sample and a raw material component category and a raw material component vector corresponding thereto;
[0012] Classifying and encoding the to-be-processed cooking method data according to preset cooking categories to obtain a cooking method vector of the dish sample;
[0013] The raw material component data group and the cooking method vector are spliced into first fusion feature data of the dish sample.
[0014] In a possible implementation, the food nutrient prediction model includes a cascade-ordered embedding layer, a second-order interaction layer, a hidden layer, and an output layer;
[0015] The training step of the food nutrient prediction model comprises:
[0016] Inputting the first fused feature data of the dish sample into the embedding layer to perform data conversion to obtain an embedding vector;
[0017] Performing pooling processing on the embedding vector through the second-order interaction layer to obtain a feature interaction vector, wherein the feature interaction vector is used to indicate the degree of interaction between the raw material component category and the cooking category corresponding to the dish sample;
[0018] splicing the feature interaction vector with the second food feature data to obtain second fused feature data;
[0019] Extracting and transforming the second fused feature data through the hidden layer to obtain interactive feature data;
[0020] The interactive feature data is transmitted to the output layer, and the output of the output layer is used as the output of the food nutrient prediction model.
[0021] In a possible implementation, the training of a preset neural network factorization machine based on the first fused feature data of the dish sample, the second food feature data, and the second fused feature data generated by the first fused feature data and the second food feature data to construct a food nutrient prediction model includes:
[0022] Divide the dish samples according to the preset ratio, and generate training data set, verification data set and test data set accordingly;
[0023] Using the training data set to train a preset neural network factorization machine;
[0024] Using the validation data set to adjust parameters of the trained neural network factorization machine;
[0025] The test data set is used to perform a performance evaluation test on the neural network factorization machine after parameter adjustment to obtain a food nutrient prediction model.
[0026] In a possible implementation, inputting the first fused feature data of the dish sample into the embedding layer to perform data conversion to obtain an embedding vector includes:
[0027] Obtaining a first embedding matrix associated with the ingredient category corresponding to the dish sample and a second embedding matrix associated with the cooking category corresponding to the dish sample;
[0028] Multiplying the vector indicating the raw material component category in the first fused feature data by the first embedding matrix to determine a component embedding vector;
[0029] Multiplying the vector indicating the cooking category in the first fused feature data by the second embedding matrix to determine a cooking embedding vector;
[0030] The ingredient embedding vector and the cooking embedding vector are combined into an embedding vector.
[0031] In a possible implementation, the step of concatenating the feature interaction vector with the second food feature data to obtain second fused feature data includes:
[0032] Preprocessing the second food characteristic data to obtain quality data to be processed;
[0033] Standardizing the quality data to be processed to obtain a quality vector;
[0034] The feature interaction vector and the quality vector are concatenated into second fused feature data of the dish sample.
[0035] In a possible implementation, the first food characteristic data and / or the second food characteristic data are preprocessed through the following steps, including:
[0036] Access to food composition databases;
[0037] Filling missing values in the first food characteristic data and / or the second food characteristic data based on the food composition database;
[0038] An abnormality process is performed on abnormal data values in the first food characteristic data and / or the second food characteristic data.
[0039] To achieve the above-mentioned purpose, the second aspect of the embodiment of the present application proposes a method for analyzing nutrients in finished dishes, the method comprising:
[0040] Obtain food data of target dish;
[0041] The food data is analyzed using the food nutrient prediction model generated by the model construction method described in the first aspect or any possible implementation of the first aspect to obtain the nutrient composition result of the target dish.
[0042] To achieve the above purpose, a third aspect of the embodiments of the present application provides a model construction device, the device comprising:
[0043] A sample data acquisition module, used to acquire food sample data of a dish sample, wherein the food sample data includes first food characteristic data and second food characteristic data, wherein the first food characteristic data includes raw material composition data and cooking method data, and the second food characteristic data includes raw material quality data and raw material edible quality data;
[0044] a feature processing module, used for encoding and splicing the first food feature data to obtain first fused feature data, wherein the first fused feature data is used to indicate the influence between the raw material ingredient data and the cooking method data;
[0045] A model building module is used to train a preset neural network factor decomposition machine based on the first fused feature data of the dish sample, the second food feature data, and the second fused feature data generated by the first fused feature data and the second food feature data to build a food nutrient prediction model, wherein the second fused feature data is used to indicate the feature correlation between the first food feature data and the second food feature data.
[0046] To achieve the above-mentioned purpose, a fourth aspect of the embodiment of the present application provides a finished dish nutrient analysis device, the device comprising:
[0047] A data acquisition module, used to acquire food data of a target dish;
[0048] An analysis module is used to analyze the food data using a food nutrient prediction model generated by the model construction method described in the first aspect or any possible implementation of the first aspect to obtain a nutrient composition result of the target dish.
[0049] The model construction method, finished dish nutrient analysis method and device proposed in the present application encode and splice the raw material ingredient data and cooking method data of the dish sample to obtain the first fused feature data, taking into account the influence of the cooking method on the changes in the raw material ingredients during the cooking process, and taking into account the correlation between the raw material ingredients and the cooking method, and then based on the first fused feature data of the dish sample, the raw material quality data and the raw material edible quality data and the second fused feature data composed of the above combination, train a preset neural network factor decomposition machine to construct a food nutrient prediction model, taking into account the correlation between multiple feature data such as raw material ingredients, cooking methods, raw material quality, raw material edible quality, etc., the accuracy of model training is improved, thereby effectively improving the accuracy and efficiency of nutrient analysis of finished dishes, and has a large range of applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A schematic diagram of a flow chart of a method for constructing a model provided in an embodiment of the present application;
[0051] Figure 2 A structural diagram of a neural network factorization machine provided for an exemplary embodiment of the present application;
[0052] Figure 3 A schematic diagram of the data encoding and splicing process provided in the embodiment of the present application;
[0053] Figure 4 A schematic diagram of the distribution of raw material ingredient categories of a dish sample provided for an exemplary embodiment of the present application;
[0054] Figure 5 A structural diagram of a food nutrient prediction model provided in an embodiment of the present application;
[0055] Figure 6 A training flow chart of a food nutrient prediction model provided in an embodiment of the present application;
[0056] Figure 7 A schematic diagram of the process of constructing a model provided in an embodiment of the present application;
[0057] Figure 8 A schematic diagram of a method for analyzing nutrients in finished dishes provided in an embodiment of the present application;
[0058] Fig. 9A schematic diagram of the structure of a model building device provided in an embodiment of the present application;
[0059] Fig.10 A schematic diagram of the structure of a finished dish nutrient analysis device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] 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.
[0061] 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.
[0062] 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.
[0063] First, some nouns involved in this application are analyzed:
[0064] 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.
[0065] Artificial neural network (ANN): abbreviated as neural network (NN), is a mathematical model or computational model that imitates the structure and function of biological neural networks (the central nervous system of animals, especially the brain), and is used to estimate or approximate functions. A neural network consists of a large number of nodes (or neurons) and the interconnections between nodes. Each node represents a specific output function, called an activation function. The connection between each two nodes represents a weighted value for the signal passing through the connection, called the weight, which is equivalent to the memory of the artificial neural network. The output of the network varies depending on the network's connection method, weight value and activation function. Neural networks have successfully solved many practical problems that are difficult to solve with modern computers in the fields of pattern recognition, intelligent robots, automatic control, prediction and estimation, biology, medicine, and economics, and have demonstrated good intelligent characteristics.
[0066] Factorization Machine (FM) is a machine learning algorithm based on matrix decomposition, which is mainly used to mine the relationship between high-dimensional discrete features. The factorization machine estimates the parameters of feature combinations by matrix decomposition and uses latent vectors to learn the association between features. It assumes that the combination of features is determined by K latent features, and learns a latent vector of size K for each feature. When predicting, the combined weight of any two features can be represented by the inner product of their corresponding latent vectors. This method enables the factorization machine to handle feature combination problems in large-scale sparse matrices, and still estimate reliable parameters for prediction when the data is sparse.
[0067] Currently, food composition data has important academic, economic and social value.
[0068] In the process of studying food nutrients, chemical analysis is mainly used to calculate the content of various nutrients in prototype foods, that is, to separate the nutrients in food and identify their concentrations using various chemical or biochemical reactions, which can obtain relatively accurate results. However, the technical threshold is high, the time is long, and the analysis cost is expensive. In scenarios where rapid, batch, and real-time conversion of food nutrient content is required, the application of this method is greatly limited, and it is difficult to become a universal method for the research and promotion of nutrients in finished dishes.
[0069] In this regard, the research on the nutrient content of finished dishes mainly adopts the prototype food addition estimation method, that is, through dietary survey and inquiry method, weighing calculation method or image-based food recognition system, the category and weight of known raw materials are obtained, combined with the "Food Composition Table", through simple addition, to estimate the various nutrients ingested by individuals through diet, and provide basic data for the estimation of energy and nutrient intake. However, the results of many studies have shown that various cooking methods, especially frying and pickling, will cause different degrees of loss of nutrients in food, especially vitamins. Although a small number of foods have nutrient retention rate and weight change factor data as a reference, the coverage of food categories and processing and cooking methods is far from meeting the actual research needs. In addition, different food components may produce synergistic or antagonistic interactions, affecting the conversion and absorption of nutrients, and reducing or increasing the effective utilization rate of nutrients. For example, oxalic acid in spinach and phytic acid in soybeans will affect the body's absorption of minerals such as calcium and iron. Therefore, estimating the nutrient composition of finished dishes by adding up the various nutrients in the prototype food is obviously inaccurate. Accurate analysis of the food ingredients of finished dishes is an important scientific basis for accurately analyzing the nutritional status of the population, evaluating the nutritional quality of diets, conducting nutritional science research and implementing nutrition improvement plans.
[0070] In view of this, the chemical analysis method is time-consuming and costly for the study of nutrients in finished dishes, and cannot be applied to large-scale, fast and real-time application scenarios, which has great limitations. The accuracy of the prototype food addition estimation method is low.
[0071] Based on the above problems, the embodiments of the present application provide a model construction method, a finished dish nutrient analysis method and a device. By performing feature fusion on the raw material ingredient data and cooking method data of the dish sample, first fused feature data is obtained, and a food nutrient prediction model is constructed based on the first fused feature data of the dish sample, the raw material quality data and the raw material edible quality data, and the second fused feature data composed of the above combinations. Taking into account the correlation between multiple feature data, the food nutrient prediction model is used to perform nutrient analysis of the target dish, which can effectively improve the accuracy and efficiency of the nutrient analysis of the finished dish and has a large range of applications.
[0072] The model construction method, finished dish nutrient analysis method and device provided in the embodiments of the present application are specifically illustrated through the following examples. First, the model construction method and finished dish nutrient analysis method in the embodiments of the present application are described.
[0073] 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.
[0074] 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.
[0075] The model construction method and the finished dish nutrient analysis method provided in the embodiment of the present application relate to the field of artificial intelligence technology. The model construction method and the finished dish nutrient analysis method provided in the embodiment of the present application 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 big data and artificial intelligence platforms and other basic cloud computing services. Cloud servers; software can be the application of the model construction method and the finished dish nutrient analysis method, etc., but is not limited to the above forms.
[0076] 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.
[0077] 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.
[0078] Figure 1 A schematic diagram of a flow chart of a method for constructing a model provided in an embodiment of the present application, Figure 1 The method may include but is not limited to steps S101 to S103.
[0079] S101. Acquire food sample data of a dish sample, wherein the food sample data comprises first food characteristic data and second food characteristic data, wherein the first food characteristic data comprises raw material composition data and cooking method data, and the second food characteristic data comprises raw material quality data and raw material edible quality data.
[0080] In the present application, the first food characteristic data represents discrete variable data, such as raw material ingredient data and cooking method data, and the second food characteristic data represents numerical variable data, such as raw material quality data, raw material edible part data, raw material edible quality data and nutritional elements of raw material ingredients.
[0081] Exemplarily, 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), for a total of 20. The raw material quality data represents the weight, specific gravity, net weight, and other data of each raw material component in the dish, and the raw material edible quality data represents the weight, specific gravity, net weight, and other data of the edible part of each raw material component in the dish.
[0082] S102: Encode and concatenate the first food feature data to obtain first fused feature data, where the first fused feature data is used to indicate the influence between the raw material ingredient data and the cooking method data.
[0083] In the present application, the encoding may be one-hot encoding, i.e., one-hot encoding, which maps each category value into a binary vector whose length is equal to the number of categories, in which only one position has a value of 1, indicating the category, and the rest of the positions are 0. Therefore, the present application performs one-hot encoding on the raw material ingredient data and the cooking method data, respectively, converts them into vectors, and concatenates the corresponding vectors to obtain the first fused feature data.
[0084] It should be noted that different combinations of raw materials and cooking methods of dishes may have a certain impact on the nutritional element analysis of the dishes. Therefore, this application generates a first fusion feature data, takes into account the impact of cooking methods on the changes in raw materials during the cooking process, and takes into account the correlation between raw materials and cooking methods, thereby improving the accuracy of model training.
[0085] S103. Based on the first fused feature data of the dish sample, the second food feature data, and the second fused feature data generated by the first fused feature data and the second food feature data, a preset neural network factor decomposition machine is trained to construct a food nutrient prediction model, wherein the second fused feature data is used to indicate the feature correlation between the first food feature data and the second food feature data.
[0086] It should be noted that the neural network factorization machine model is similar to the factorization machine, which is a general machine learning machine that can process any real-valued feature vector. This model borrows the idea of the factorization machine and introduces a second-order interaction layer in the neural network model to effectively model the interaction of high-order and nonlinear features, thereby improving the expressiveness of the factorization machine. For example, Figure 2 A structural diagram of a neural network factorization machine provided by an exemplary embodiment of the present application, wherein the neural network factorization machine comprises an embedding layer, a second-order interaction layer, a hidden layer, and an output layer. Discrete features (i.e., first fused feature data) are input into the embedding layer. The neural network factorization machine first embeds the discrete features to make them low-dimensional dense features, such as the embedding vector {v1, v2…v n}. Then, the second-order interaction layer is used to perform element-wise multiplication on the embedded vectors to form vectors of the same dimension, which are summed and horizontally spliced with the continuous features (i.e., the second food feature data) to serve as the input of the hidden layer. It should be noted that in the present application, the second food feature data is spliced with the first fused feature data so that the generated second fused feature data takes into account the feature correlation between multiple feature data such as raw material ingredients, cooking methods, raw material quality, and raw material edible quality, so as to improve the accuracy of model training.
[0087] exist Figure 2In , the second-order interaction layer is followed by a set of fully connected layers, including hidden layers and output layers, which are able to learn higher-order interactions between features. Figure 2 The hidden layer contains L levels, such as Layer1, Layer2, ... Layer L. The definition of the fully connected layer is as follows: z1 = σ1 (W1z0 + b1), z2 = σ2 (W2z1 + b2), ..., z L =σ L (W L z L-1 +b L ),z L+1 =σ L+1 (W L+1 z L +b L+1 ), where L represents the number of hidden layers, z L represents the output of the Lth hidden layer, W L represents the weight matrix of the Lth hidden layer, b L represents the bias vector of the Lth hidden layer, σ L represents the activation function of the Lth hidden layer, z L+1 represents the output of the output layer, W L+1 represents the weight matrix of the output layer, b L+1 represents the bias vector of the output layer, σ L+1 represents the activation function of the output layer.
[0088] Specifically, for the activation function, the activation function in this application can be a nonlinear activation function ELU(x), which allows the model to learn higher-order interactive features in a nonlinear way. The structure of the fully connected layer (i.e., the size of each layer) is limited to 20 neurons, and can also be freely selected, such as fixed size, growth or diamond shape. Further, the output z of the output layer L+1 The predicted value of the objective function of the fully connected layer is a one-dimensional vector of length 20, where the activation function is softplus(x)=log(1+e x ), x is the input variable.
[0089] The model construction method proposed in this embodiment encodes and splices the raw material ingredient data and cooking method data of the dish sample to obtain the first fused feature data, taking into account the impact of the cooking method on the changes in the raw material ingredients during the cooking process, and taking into account the correlation between the raw material ingredients and the cooking method, and then based on the first fused feature data of the dish sample, the raw material quality data and the raw material edible quality data and the second fused feature data composed of the above combination, a preset neural network factor decomposition machine is trained to construct a food nutrient prediction model, taking into account the correlation between multiple feature data such as raw material ingredients, cooking methods, raw material quality, raw material edible quality, etc., the accuracy of model training is improved, thereby effectively improving the accuracy and efficiency of nutrient analysis of finished dishes, and has a large range of applications.
[0090] In some embodiments, Figure 3 This is a flow chart of data encoding and splicing provided in an embodiment of the present application. This embodiment provides a method for data encoding and splicing, that is, step S102 may include but is not limited to steps S301 to S304.
[0091] S301, preprocessing the first food characteristic data to obtain raw material component data to be processed and cooking method data to be processed;
[0092] S302, classifying and encoding the raw material component data to be processed according to preset component categories to obtain a raw material component data group of the dish sample, wherein the raw material component data group includes at least one raw material component in the dish sample and a raw material component category and a raw material component vector corresponding thereto;
[0093] S303, classifying and encoding the to-be-processed cooking method data according to preset cooking categories to obtain a cooking method vector of the dish sample;
[0094] S304: Concatenate the raw material component data group and the cooking method vector into first fusion feature data of the dish sample.
[0095] In this embodiment, the preprocessing includes but is not limited to data missing value processing and abnormal value processing. Then, the raw material component data to be processed and the cooking method data to be processed are respectively uniquely encoded, that is, each category value is mapped into a binary vector.
[0096] It should be noted that the cooking category can include frying, steaming, frying, frying, and boiling, a total of 4 categories. The ingredient category (i.e. raw material ingredient 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.
[0097] For example, let's take 106 dishes as an example, including 216 ingredients (raw materials), 21 cooking methods, and numerical variables: raw material quality, edible parts of raw materials, edible parts of raw materials, and 20 nutrients (raw materials). The cooking method data of the dishes are classified according to the above cooking categories, such as "frying" counts 11, "deep-fried" counts 27, "steaming, stir-frying, and braising" counts 15, and "boiling" counts 53. The raw material ingredient data of the dishes are classified according to the above ingredient categories, and the distribution is as follows: Figure 4 shown.
[0098] For example, if "poultry" is in the first position among the 16 categories of ingredient categories, its one-hot encoding (i.e., raw material component vector) is [1, 0, 0, ..., 0] (a total of 16 bits, the first bit is 1, and the rest are 0). For "fried food", if it is also in the first position among the four cooking categories, its one-hot encoding (i.e., cooking method vector) is [1, 0, 0, 0]. Then, the above raw material component vector and cooking method vector are concatenated in sequence to obtain the first fused feature vector [1, 0, 0, ..., 0, 1, 0, 0, 0].
[0099] Further, at least one raw material component vector is spliced with the cooking method vector, wherein the raw material component vector and the cooking method vector may be spliced in sequence. Alternatively, the raw material component vector and the cooking method vector may be processed according to a preset data processing rule, and then the processed vectors are fused to form a first fused feature vector. This application does not limit the splicing method.
[0100] Therefore, this embodiment classifies, encodes and splices the raw material ingredient data and the cooking method data to ensure the difference of each data, and takes into account the impact of the cooking method on the changes in the raw material ingredients during the cooking process, and the correlation between the raw material ingredient category and the cooking category, and then performs model training based on the first fusion feature data obtained, which can improve the accuracy of model training.
[0101] In some embodiments, Figure 5 This is a structural diagram of a food nutrient prediction model provided in an embodiment of the present application, wherein the food nutrient prediction model includes a cascade-ordered embedding layer 501, a second-order interaction layer 502, a hidden layer 503, and an output layer 504.
[0102] Specifically, Figure 6 This is a training flowchart of a food nutrient prediction model provided in an embodiment of the present application. This embodiment provides a training method for a food nutrient prediction model, that is, step S103 may include but is not limited to steps S601 to S605.
[0103] S601, inputting the first fusion feature data of the dish sample into the embedding layer to perform data conversion to obtain an embedding vector;
[0104] S602, performing pooling processing on the embedding vector through the second-order interaction layer to obtain a feature interaction vector, wherein the feature interaction vector is used to indicate the degree of interaction between the raw material component category and the cooking category corresponding to the dish sample;
[0105] S603, concatenating the feature interaction vector with the second food feature data to obtain second fused feature data;
[0106] S604, extracting and transforming the second fused feature data through the hidden layer to obtain interactive feature data;
[0107] S605: Transmit the interactive feature data to the output layer, and use the output of the output layer as the output of the food nutrient prediction model.
[0108] For explanation, see Figure 5 , the embedding layer is a fully connected layer that projects each feature into a vector representation and converts the first fused feature data into an embedding vector. Then, the embedding vector is input into the second-order interaction layer for pooling to convert a set of embedding vectors into a vector. The output of the second-order interaction layer is a k-dimensional vector that encodes the second-order interactions between features in the embedding space. It should be noted that second-order interaction pooling does not introduce additional model parameters and can be efficiently calculated in linear time. The feature interaction vector output by the second-order interaction layer expresses the mutual influence between two category features (i.e., cooking category and ingredient category), such as the mutual influence between "poultry" and "fried". The element-by-element product captures how two features interact in different dimensions, and the interaction strength of each dimension is represented by the corresponding product result.
[0109] In this embodiment, in order to avoid co-adaptation between feature embeddings and overfitting data, Dropout (random deactivation) is applied on the second-order interaction layer. Specifically, after obtaining the feature interaction vector, i.e., a k-dimensional latent factor vector, a percentage of latent factors is randomly discarded, where ρ represents the Dropout ratio. In addition, Dropout is applied to the hidden layer of the neural network factorization machine model to prevent co-adaptation and overfitting when learning high-order feature interactions.
[0110] Furthermore, the feature interaction vector f(V x ) and the second food characteristic data (the second food characteristic data is represented by s=[s1, s2…s m]) to obtain the second fused feature data. In the second food feature data, m can be composed of raw material quality, edible quality, edible part, and Count parameter. The Count parameter can be the number of component subcategories contained in each component category (i.e., the component category in the embodiment). The second fused feature data can be expressed as z=Concat[s;f(V x )].
[0111] Furthermore, the second fused feature data is input into the hidden layer for feature extraction and transformation to obtain interactive feature data. Specifically, the hidden layer is used for data processing and feature extraction, and the complex features of the input data are gradually extracted and combined through layer-by-layer transformation of multiple hidden layers. Then, the interactive feature data output by the hidden layer is input into the output layer, and the output layer is used to generate the final output result, such as a classification label or a regression value. Thus, the output of the output layer is used as the output result of the food nutrient prediction model.
[0112] Therefore, this embodiment realizes the extraction of the interaction between the raw material component category and the cooking category by setting a second-order interaction layer. And by splicing the feature interaction vector used to characterize the correlation between the raw material component and the cooking method with the raw material quality data and the raw material edible quality data, the second fused feature data is obtained, and the second fused feature data is extracted and transformed through the hidden layer and the output layer to further extract the interaction features between the raw material component, cooking method, raw material quality, raw material edible quality and other features, thereby realizing model training, taking into account the feature correlation between multiple data features, and improving the accuracy of model training. Therefore, the model obtained in this embodiment is used for the analysis of nutritional elements, which improves the analysis accuracy and scope of use.
[0113] In some embodiments, the step of inputting the first fused feature data of the dish sample into the embedding layer to perform data conversion to obtain an embedding vector includes:
[0114] Obtaining a first embedding matrix associated with the ingredient category corresponding to the dish sample and a second embedding matrix associated with the cooking category corresponding to the dish sample;
[0115] Multiplying the vector indicating the raw material component category in the first fused feature data by the first embedding matrix to determine a component embedding vector;
[0116] Multiplying the vector indicating the cooking category in the first fused feature data by the second embedding matrix to determine a cooking embedding vector;
[0117] The ingredient embedding vector and the cooking embedding vector are combined into an embedding vector.
[0118] In this embodiment, each category (such as ingredient category, cooking category) is associated with an embedding matrix, and the size of the embedding matrix depends on the number of categories (input dimension) and the predetermined embedding dimension. For example, if the embedding dimension of each category is 10, then the embedding matrix of "poultry" will be a 16x10 matrix, and the embedding matrix of "fried food" will be a 4x10 matrix. These matrices are initially randomly generated.
[0119] Furthermore, the corresponding embedding vector is determined by the product of the first fused feature data (including the raw material component vector and the cooking method vector) and the embedding matrix. Since only one position in the one-hot encoding (i.e., the first fused feature data) is 1, this product operation is actually to select a vector from the embedding matrix. For example, the embedding vectors of "poultry" and "fried food" are the first row of the corresponding embedding matrix. If the first row in the embedding matrix of "poultry" is [0.5, -0.3, 0.8, ..., 0.1] (a total of 10 elements), then this vector is the ingredient embedding vector. Similarly, the cooking embedding vector of "fried food" is [0.2, -0.1, 0.3, ..., 0.4] (also 10 elements).
[0120] Therefore, this embodiment maps complex, high-dimensional or sparse data (i.e., the first fused feature data) to vectors represented in a low-dimensional, dense vector space (i.e., embedded vectors), and performs data mapping by ingredient category and cooking category, thereby retaining the semantic or structural information of the original data, thereby enabling the model to learn and calculate more efficiently, thereby improving the accuracy of model training.
[0121] In some embodiments, the step of concatenating the feature interaction vector with the second food feature data to obtain second fused feature data includes:
[0122] Preprocessing the second food characteristic data to obtain quality data to be processed;
[0123] Standardizing the quality data to be processed to obtain a quality vector;
[0124] The feature interaction vector and the quality vector are concatenated into second fused feature data of the dish sample.
[0125] In this embodiment, by standardizing the data representing the quality of raw materials and the edible quality of raw materials, the efficiency and accuracy of training are improved, and the sample size can be effectively expanded while retaining all important information. In addition, by converting into a quality vector, the feature interaction vector output by the second-order interaction layer is spliced with the quality vector to obtain the second fusion feature data of the dish sample, taking into account the correlation between multiple feature data such as raw material composition, cooking method, raw material quality, and edible quality of raw materials, the training accuracy is improved.
[0126] In some embodiments, the first food characteristic data and / or the second food characteristic data are preprocessed by the following steps, including:
[0127] Access to food composition databases;
[0128] Filling missing values in the first food characteristic data and / or the second food characteristic data based on the food composition database;
[0129] An abnormality process is performed on abnormal data values in the first food characteristic data and / or the second food characteristic data.
[0130] In this embodiment, for the missing values of the nutritional elements of the raw materials in the second food characteristic data and / or the second food characteristic data, in the first optional implementation method, the raw material ingredient data of the corresponding dishes are extracted from the food ingredient database (such as a 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 nutritional element data of the same (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.
[0131] The second food characteristic data and / or the abnormal value in the second food characteristic data may be replaced with water content: 0.1; protein: 0.05; fat: 0.1. Alternatively, all of them may be replaced with 0.
[0132] Therefore, this embodiment improves the integrity of the data by processing the missing values and abnormal values in the first food characteristic data and / or the second food characteristic data, so as to improve the accuracy and efficiency of data processing.
[0133] In some embodiments, Figure 7 This is a flow chart of model construction provided in an embodiment of the present application. This embodiment provides a model construction method, which includes steps S701 to S704.
[0134] S701, dividing the dish samples according to a preset ratio, and correspondingly generating a training data set, a verification data set, and a test data set;
[0135] S702, using the training data set to train a preset neural network factorization machine;
[0136] S703, using the verification data set to adjust parameters of the trained neural network factorization machine;
[0137] S704: Use the test data set to perform a performance evaluation test on the neural network factorization machine after parameter adjustment to obtain a food nutrient prediction model.
[0138] In this embodiment, the data set of the dish samples (i.e., including the first fusion feature data and the second food feature data) is divided according to a preset ratio, such as 60% for the training data set, 20% for the validation data set, and 20% for the test data set. The training data set is used to train the model, the validation data set is used to adjust the hyperparameters, and the final performance comparison is performed on the test data set. In order to evaluate the performance, the present embodiment uses the root mean square error RMSE and the mean absolute error MAE (between the predicted value (calculated value) and the measured value), where a lower RMSE or MAE score indicates better performance. It should be noted that the dish samples in the training data set, validation data set, and test data set are not repeated, that is, if food A is divided into the training data set, it is no longer used as the validation data set and the test data set. The final prediction result is averaged according to the name of the dish to obtain the final result of each dish.
[0139] During the training process, as the parameters of the previous layers change, the subsequent layers need to adapt to these changes (these changes are often noise), which will be adversely affected when updating their parameters, thereby slowing down the training speed. Batch normalization (BN) is added here, which normalizes the layer input to a zero-mean unit variance Gaussian distribution for each training mini-batch.
[0140] During testing, batch normalization (BN) is also applied, where the mini-batch mean and mini-batch variance are estimated from the entire training data. In NFM (Neural Factorization Machines is an algorithm model used to solve the click-through rate CTR problem), BN is performed on the output of the second-order interaction pooling to avoid the update of feature embeddings changing the input distribution to the hidden layer or prediction layer. For each subsequent hidden layer, BN is also applied.
[0141] Exemplarily, a test data set of 22 dish samples is used as an example for illustration. The following Table 1 shows the test results of the 22 dish samples.
[0142] Serial number Nutritional elements Model predictions calculate 0 Water content (g) 26.71527 28.167682 1 Energy (kcal) 81.930497 185.074732 2 Protein (g) 5.798159 7.636043 3 Fat (g) 5.999277 11.841579 4 Carbohydrate (g) 10.719017 23.580524 5 Cholesterol (mg) 33.446674 63.7004 6 Vitamin A (mg) 319.144763 323.946066 7 Vitamin B1 (mg) 0.001533 0.066936 8 Vitamin B2 (mg) 0.065715 0.120312 9 Vitamin E (mg) 0.862159 5.941005 10 Calcium (mg) 42.605633 72.97515 11 Phosphorus (mg) 51.403499 69.053662 12 Potassium (mg) 73.98812 167.342891 13 Sodium (mg) 77.714311 4995.990512 14 Magnesium (mg) 10.774609 32.016732 15 Iron (mg) 0.945166 3.277701 16 Zinc (mg) 0.717255 1.063437 17 Selenium (ug) 10.831657 12.905166 18 Copper (mg) 0.307396 0.336462 19 Manganese (mg) 0.115221 0.581318 37.70429655 300.2809155
[0143] Table 1
[0144] In this regard, the prediction errors of the 20 nutrients are lower than those of the traditional calculation method, with an average absolute error of 37.70, which is 265.58 lower than the calculation method (300.28). Without changing any parameters, the neural network factorization machine was tested nine times with different data set divisions, and the errors were all lower than the calculation. Among them, the errors of all nutrients were lower than the calculation in 4 cases, and the model was overfitted in 3 cases, and some nutrients were slightly higher than the calculation method. After multiple training, verification and testing, the model prediction values basically overlapped with the observed values, while the values of the traditional calculation method were relatively deviated from the true values.
[0145] Therefore, this embodiment can improve the accuracy of the model and further improve the accuracy of nutrient element analysis by training, verifying and testing the neural network factorization machine.
[0146] Figure 8 This is a flow chart of a method for analyzing nutrients in finished dishes provided in an embodiment of the present application. Figure 8 The method may include but is not limited to steps S801 to S802.
[0147] S801, obtaining food data of a target dish;
[0148] S802: Analyze the food data using the food nutrient prediction model generated by the model construction method to obtain the nutrient composition result of the target dish.
[0149] The food data includes first food characteristic data and second food characteristic data, wherein the first food characteristic data includes raw material composition data and cooking method data, and the second food characteristic data includes raw material quality data and raw material edible quality data. Then, the food data of the target dish is input into the food nutrient prediction model generated by the above embodiment to perform nutrient element content analysis and output the nutrient composition result of the target dish.
[0150] The method for analyzing the nutrient content of finished dishes proposed in this embodiment analyzes the target dishes through a food nutrient prediction model constructed by a first fused feature data that integrates cooking methods and raw material ingredients and a second fused feature data that integrates multiple feature data such as raw material ingredients, cooking methods, raw material quality, and edible quality of raw materials, to obtain nutrient composition results. This can improve the accuracy and efficiency of data analysis and has a large range of applications.
[0151] Fig. 9 A schematic diagram of a structure of a model construction device provided in an embodiment of the present application, wherein the model construction device 900 includes:
[0152] The sample data acquisition module 901 is used to acquire food sample data of a dish sample, wherein the food sample data includes first food characteristic data and second food characteristic data, wherein the first food characteristic data includes raw material composition data and cooking method data, and the second food characteristic data includes raw material quality data and raw material edible quality data;
[0153] A feature processing module 902 is used to encode and splice the first food feature data to obtain first fused feature data, where the first fused feature data is used to indicate the influence between the raw material ingredient data and the cooking method data;
[0154] The model building module 903 is used to train a preset neural network factor decomposition machine based on the first fused feature data of the dish sample, the second food feature data, and the second fused feature data generated by the first fused feature data and the second food feature data to build a food nutrient prediction model, wherein the second fused feature data is used to indicate the feature correlation between the first food feature data and the second food feature data.
[0155] In some embodiments, the feature processing module 902 includes:
[0156] A first preprocessing unit, used for preprocessing the first food characteristic data to obtain raw material component data to be processed and cooking method data to be processed;
[0157] a first classification encoding unit, configured to classify and encode the raw material component data to be processed according to a preset component category, so as to obtain a raw material component data group of the dish sample, wherein the raw material component data group includes at least one raw material component in the dish sample and a raw material component category and a raw material component vector corresponding thereto;
[0158] a second classification encoding unit, configured to classify and encode the to-be-processed cooking method data according to preset cooking categories, so as to obtain a cooking method vector of the dish sample;
[0159] The first feature fusion unit is used to splice the raw material component data group and the cooking method vector into the first fused feature data of the dish sample.
[0160] In some embodiments, the food nutrient prediction model comprises a cascade-ordered embedding layer, a second-order interaction layer, a hidden layer, and an output layer;
[0161] The model building module 903 includes:
[0162] An embedding layer processing unit, used for inputting the first fusion feature data of the dish sample into the embedding layer to perform data conversion to obtain an embedding vector;
[0163] A pooling processing unit, used for performing pooling processing on the embedding vector through the second-order interaction layer to obtain a feature interaction vector, wherein the feature interaction vector is used to indicate the degree of interaction between the raw material component category and the cooking category corresponding to the dish sample;
[0164] a concatenation unit, configured to concatenate the feature interaction vector with the second food feature data to obtain second fused feature data;
[0165] A feature extraction and transformation unit, used for performing feature extraction and transformation on the second fused feature data through the hidden layer to obtain interactive feature data;
[0166] The integrated output unit is used to transmit the interactive feature data to the output layer, and use the output of the output layer as the output of the food nutrient prediction model.
[0167] In some embodiments, the model building module 903 includes:
[0168] A data division unit, used to divide the dish samples according to a preset ratio, and correspondingly generate a training data set, a validation data set, and a test data set;
[0169] A training unit, used to train a preset neural network factorization machine using the training data set;
[0170] A verification unit, used to adjust parameters of the trained neural network factorization machine using the verification data set;
[0171] The testing unit is used to use the test data set to perform a performance evaluation test on the neural network factorization machine after parameter adjustment to obtain a food nutrient prediction model.
[0172] In some embodiments, the embedded layer processing unit includes:
[0173] An embedding matrix acquisition unit, used to acquire a first embedding matrix associated with the raw material component category corresponding to the dish sample, and a second embedding matrix associated with the cooking category corresponding to the dish sample;
[0174] A first product unit, configured to multiply the vector indicating the raw material component category in the first fused feature data by the first embedding matrix to determine a component embedding vector;
[0175] A second product unit, configured to multiply the vector indicating the cooking category in the first fused feature data by the second embedding matrix to determine a cooking embedding vector;
[0176] A vector combining unit is used to combine the ingredient embedding vector and the cooking embedding vector into an embedding vector.
[0177] In some embodiments, the splicing unit comprises:
[0178] A second preprocessing unit, used for preprocessing the second food characteristic data to obtain quality data to be processed;
[0179] A standardization processing unit, used for performing standardization processing on the quality data to be processed to obtain a quality vector;
[0180] The second feature fusion unit is used to splice the feature interaction vector and the quality vector into second fused feature data of the dish sample.
[0181] In some embodiments, the apparatus 900 further includes:
[0182] A database acquisition unit, used for acquiring a food composition database;
[0183] A filling unit, configured to fill missing values in the first food characteristic data and / or the second food characteristic data based on the food composition database;
[0184] An exception processing unit is used to perform exception processing on data abnormal values in the first food characteristic data and / or the second food characteristic data.
[0185] Fig.10 This is a schematic diagram of the structure of a finished dish nutrient analysis device provided in an embodiment of the present application. The finished dish nutrient analysis device 1000 includes:
[0186] The data acquisition module 1001 is used to acquire food data of a target dish;
[0187] The analysis module 1002 is used to analyze the food data using the food nutrient prediction model generated by the model construction method described in the above embodiment to obtain the nutrient composition result of the target dish.
[0188] 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.
[0189] 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.
[0190] 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.
[0191] 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.
[0192] 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.
[0193] 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.
[0194] 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.
[0195] 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.
[0196] 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.
[0197] 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.
[0198] 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.
[0199] 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 method for constructing a model, characterized in that: include: Acquire food sample data of a dish sample, wherein the food sample data comprises first food characteristic data and second food characteristic data, wherein the first food characteristic data comprises raw material composition data and cooking method data, and the second food characteristic data comprises raw material quality data and raw material edible quality data; The first food feature data is encoded and then spliced to obtain first fused feature data, where the first fused feature data is used to indicate the influence between the raw material ingredient data and the cooking method data; Based on the first fused feature data of the dish sample, the second food feature data, and the second fused feature data generated by the first fused feature data and the second food feature data, a preset neural network factor decomposition machine is trained to construct a food nutrient prediction model, wherein the second fused feature data is used to indicate the feature correlation between the first food feature data and the second food feature data.
2. The method for constructing a model according to claim 1, characterized in that: The encoding and splicing of the first food feature data to obtain first fused feature data includes: Preprocessing the first food characteristic data to obtain raw material component data to be processed and cooking method data to be processed; Classifying and encoding the raw material component data to be processed according to preset component categories to obtain a raw material component data group of the dish sample, wherein the raw material component data group includes at least one raw material component in the dish sample and a raw material component category and a raw material component vector corresponding thereto; Classifying and encoding the to-be-processed cooking method data according to preset cooking categories to obtain a cooking method vector of the dish sample; The raw material component data group and the cooking method vector are spliced into first fusion feature data of the dish sample.
3. The method for constructing a model according to claim 2, characterized in that: The food nutrient prediction model includes a cascade-ordered embedding layer, a second-order interaction layer, a hidden layer, and an output layer; The training step of the food nutrient prediction model comprises: Inputting the first fused feature data of the dish sample into the embedding layer to perform data conversion to obtain an embedding vector; Performing pooling processing on the embedding vector through the second-order interaction layer to obtain a feature interaction vector, wherein the feature interaction vector is used to indicate the degree of interaction between the raw material component category and the cooking category corresponding to the dish sample; splicing the feature interaction vector with the second food feature data to obtain second fused feature data; Extracting and transforming the second fused feature data through the hidden layer to obtain interactive feature data; The interactive feature data is transmitted to the output layer, and the output of the output layer is used as the output of the food nutrient prediction model.
4. The method for constructing a model according to claim 3, characterized in that: The method of training a preset neural network factorization machine based on the first fused feature data of the dish sample, the second food feature data, and the second fused feature data generated by the first fused feature data and the second food feature data to construct a food nutrient prediction model includes: Divide the dish samples according to the preset ratio, and generate training data set, verification data set and test data set accordingly; Using the training data set to train a preset neural network factorization machine; Using the validation data set to adjust parameters of the trained neural network factorization machine; The test data set is used to perform a performance evaluation test on the neural network factorization machine after parameter adjustment to obtain a food nutrient prediction model.
5. The method for constructing a model according to claim 3, characterized in that: The step of inputting the first fused feature data of the dish sample into the embedding layer to perform data conversion to obtain an embedding vector includes: Obtaining a first embedding matrix associated with the ingredient category corresponding to the dish sample and a second embedding matrix associated with the cooking category corresponding to the dish sample; Multiplying the vector indicating the raw material component category in the first fused feature data by the first embedding matrix to determine a component embedding vector; Multiplying the vector indicating the cooking category in the first fused feature data by the second embedding matrix to determine a cooking embedding vector; The ingredient embedding vector and the cooking embedding vector are combined into an embedding vector.
6. The method for constructing a model according to claim 3 or 5, characterized in that: The step of concatenating the feature interaction vector with the second food feature data to obtain second fused feature data includes: Preprocessing the second food characteristic data to obtain quality data to be processed; Standardizing the quality data to be processed to obtain a quality vector; The feature interaction vector and the quality vector are concatenated into second fused feature data of the dish sample.
7. The method for constructing a model according to claim 6, characterized in that: The first food characteristic data and / or the second food characteristic data are preprocessed by the following steps, including: Access to food composition databases; Filling missing values in the first food characteristic data and / or the second food characteristic data based on the food composition database; An abnormality process is performed on abnormal data values in the first food characteristic data and / or the second food characteristic data.
8. A method for analyzing nutrients in finished dishes, characterized in that: include: Obtain food data of target dish; The food data is analyzed using a food nutrient prediction model generated by the model construction method as described in any one of claims 1 to 7 to obtain the nutrient composition result of the target dish.
9. A model construction device, characterized in that: The device comprises: A sample data acquisition module, used to acquire food sample data of a dish sample, wherein the food sample data includes first food characteristic data and second food characteristic data, wherein the first food characteristic data includes raw material composition data and cooking method data, and the second food characteristic data includes raw material quality data and raw material edible quality data; a feature processing module, used for encoding and splicing the first food feature data to obtain first fused feature data, wherein the first fused feature data is used to indicate the influence between the raw material ingredient data and the cooking method data; A model building module is used to train a preset neural network factor decomposition machine based on the first fused feature data of the dish sample, the second food feature data, and the second fused feature data generated by the first fused feature data and the second food feature data to build a food nutrient prediction model, wherein the second fused feature data is used to indicate the feature correlation between the first food feature data and the second food feature data.
10. A nutrient analysis device for finished dishes, characterized in that: The device comprises: A data acquisition module, used to acquire food data of a target dish; An analysis module is used to analyze the food data using a food nutrient prediction model generated by the model construction method as described in any one of claims 1 to 7 to obtain a nutrient composition result of the target dish.
Citation Information
Patent Citations
Intelligent nutrition diet management method and system based on data analysis and deep learning
CN113990444A
Meal research system and method
CN115337651A
Cross-modal retrieval method for images and menus based on ternary fusion neural network
CN115438206A
Automatic nutrient element identification method based on OCR (Optical Character Recognition)
CN116645687A
Nutrient analysis method and device for menu
CN117912638A
Cited By
Cooking control method and device for cubilose porridge and storage medium
CN120821215A