Model construction method, finished dish nutrient analysis method and device

By fusing features from the raw material composition and cooking method data of dish samples, a food nutrient prediction model is constructed, which solves the problem of low accuracy in nutrient analysis of finished dishes in existing technologies and achieves more efficient and accurate nutrient analysis.

CN119446423BActive Publication Date: 2025-11-07Guangdong Provincial Center for Disease Control and Prevention (Guangdong Academy of Preventive Medicine Sciences)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411632593.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-11-07
Estimated Expiration
2044-11-15

AI Technical Summary

Technical Problem

Existing technologies suffer from low accuracy in rapidly analyzing the nutrient content of finished dishes in large batches and in real time. Chemical analysis methods are time-consuming and costly, while the additive estimation method based on prototype foods lacks accuracy and cannot meet the needs of large-scale, rapid, and real-time applications.

Method used

By fusing the raw material composition data and cooking method data of dish samples, a food nutrient prediction model is constructed. Considering the correlation between multiple feature data, a neural network factor decomposition machine is used for training to generate the food nutrient prediction model.

Benefits of technology

It improves the accuracy and efficiency of nutrient analysis of finished dishes, expands the scope of application, and enables more accurate analysis of the nutrient composition of target dishes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119446423B_ABST
    Figure CN119446423B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of model construction method, finished dish nutrient analysis method and device, belong to artificial intelligence technical field.The method comprises: obtaining the food sample data of dish sample, food sample data contains first food characteristic data and second food characteristic data, first food characteristic data includes raw material component data and cooking method data, and second food characteristic data includes raw material quality data and raw material edible quality data;After encoding first food characteristic data is spliced, first fusion feature data is obtained, and first fusion feature data is used to indicate the influence degree between raw material component data and cooking method data;Based on the first fusion feature data of dish sample, second food characteristic data and second fusion feature data, the preset neural network factor decomposition machine is trained to construct food nutrient prediction model.The application can improve the accuracy of finished dish nutrient analysis.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and in particular to a model construction method and a finished dish nutrient analysis method and device. BACKGROUND

[0002] At present, food ingredient data has important academic, economic and social value.

[0003] In the research process of food nutrients, the calculation of the content of various nutrients of the prototype food mainly adopts a chemical analysis method, but the technical threshold is high, the time is long, the analysis cost is expensive, and in the scene of needing to quickly, batch, real-time conversion of food nutrient content, the application of this method is greatly limited, and it is difficult to become a general method for the research and promotion of finished dish nutrients. In view of this, the research on the nutrient content of finished dishes mainly adopts a prototype food plus estimation method, that is, the nutrient composition of finished dishes is estimated by adding various nutrients in the prototype food, but obviously lacks accuracy, therefore, how to improve the accuracy of finished dish nutrient analysis has become a technical problem to be solved. SUMMARY

[0004] The main purpose of the embodiments of the present application is to provide a model construction method, a finished dish nutrient analysis method and device, which aims to improve the accuracy of finished dish nutrient analysis.

[0005] To achieve the above-mentioned purpose, a first aspect of the embodiments of the present application provides a model construction method, which comprises:

[0006] Obtaining food sample data of a dish sample, the food sample data containing first food feature data and second food feature data, the first food feature data including raw material ingredient data and cooking method data, and the second food feature data including raw material quality data and raw material edible quality data;

[0007] After encoding the first food feature data, the first fusion feature data is obtained by splicing, the first fusion feature data being used to indicate the influence degree between the raw material ingredient data and the cooking method data;

[0008] Based on the first fusion feature data, the second food feature data of the dish sample, and the second fusion feature data generated by the first fusion feature data and the second food feature data, a preset neural network factorization machine is trained to construct a food nutrient prediction model, wherein the second fusion feature data is used to indicate the feature correlation degree between the first food feature data and the second food feature data.

[0009] In one possible implementation, the step of encoding and concatenating the first food feature data to obtain the first fused feature data includes:

[0010] The first food characteristic data is preprocessed to obtain the raw material composition data and the cooking method data to be processed;

[0011] After classifying and encoding the raw material component data to be processed according to the preset component categories, the raw material component data group of the dish sample is obtained. The raw material component data group includes at least one raw material component in the dish sample and its corresponding raw material component category and raw material component vector.

[0012] The cooking method data to be processed is classified and encoded according to the preset cooking category to obtain the cooking method vector of the dish sample;

[0013] The raw material component data set and the cooking method vector are concatenated to form the first fusion feature data of the dish sample.

[0014] In one possible implementation, the food nutrient prediction model includes a cascaded embedding layer, a second-order interaction layer, a hidden layer, and an output layer.

[0015] The training steps of the food nutrient prediction model include:

[0016] The first fusion feature data of the dish sample is input into the embedding layer to perform data transformation and obtain the embedding vector;

[0017] The embedding vector is pooled through the second-order interaction layer to obtain a feature interaction vector, which is used to indicate the degree of interaction between the raw material category and the cooking category corresponding to the dish sample.

[0018] The feature interaction vector is concatenated with the second food feature data to obtain the second fused feature data;

[0019] The second fused feature data is extracted and transformed 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 one possible implementation, the process of training a preset neural network factorization machine based on the first fused feature data, the second food feature data, and the second fused feature data generated from the first fused feature data and the second food feature data of the dish sample to construct a food nutrient prediction model includes:

[0022] The dish samples are divided according to a preset ratio, and training data set, verification data set and test data set are generated correspondingly;

[0023] The preset neural network factorization machine is trained by using the training data set;

[0024] The trained neural network factorization machine is parameter adjusted by using the verification data set;

[0025] The parameter adjusted neural network factorization machine is performance evaluated and tested by using the test data set, and a food nutrient prediction model is obtained.

[0026] In a possible implementation, the first fusion feature data of the dish sample is input into the embedding layer for data conversion to obtain an embedding vector, including:

[0027] A first embedding matrix associated with ingredient categories corresponding to the dish sample and a second embedding matrix associated with cooking categories corresponding to the dish sample are obtained;

[0028] A vector indicating the ingredient category in the first fusion feature data is multiplied by the first embedding matrix to determine an ingredient embedding vector;

[0029] A vector indicating the cooking category in the first fusion feature data is multiplied by the second embedding matrix to determine a cooking embedding vector;

[0030] The ingredient embedding vector and the cooking embedding vector are combined to form an embedding vector.

[0031] In a possible implementation, the feature interaction vector and the second food feature data are spliced to obtain second fusion feature data, including:

[0032] The second food feature data is preprocessed to obtain to-be-processed quality data;

[0033] The to-be-processed quality data is standardized to obtain a quality vector;

[0034] The feature interaction vector and the quality vector are spliced to form the second fusion feature data of the dish sample.

[0035] In a possible implementation, the first food feature data and / or the second food feature data are preprocessed by the following steps, including:

[0036] A food ingredient database is obtained;

[0037] Fill in missing data in the first food characteristic data and / or the second food characteristic data based on the food ingredient database.

[0038] Perform abnormal processing on abnormal values in the first food characteristic data and / or the second food characteristic data.

[0039] To achieve the above object, a second aspect of the embodiment of the present application provides a method for analyzing nutrients of a finished dish, the method comprising:

[0040] Obtaining food data of a target dish;

[0041] Analyzing the food data by using a food nutrient prediction model generated by the method for constructing the model according to the first aspect or any possible implementation manner of the first aspect, to obtain nutrient composition results of the target dish.

[0042] To achieve the above object, a third aspect of the embodiment of the present application provides a device for constructing a model, the device comprising:

[0043] A sample data obtaining module is configured to obtain food sample data of a dish sample, the food sample data comprising first food characteristic data and second food characteristic data, the first food characteristic data including raw material ingredient data and cooking method data, and the second food characteristic data including raw material quality data and raw material edible quality data.

[0044] A feature processing module is configured to splice the first food characteristic data after encoding to obtain first fusion feature data, the first fusion feature data being used to indicate an influence degree between the raw material ingredient data and the cooking method data.

[0045] A model constructing module is configured to train a preset neural network factorization machine based on the first fusion feature data, the second food characteristic data, and second fusion feature data generated from the first fusion feature data and the second food characteristic data, to construct a food nutrient prediction model, wherein the second fusion feature data is used to indicate a feature correlation degree between the first food characteristic data and the second food characteristic data.

[0046] To achieve the above object, a fourth aspect of the embodiment of the present application provides a device for analyzing nutrients of a finished dish, the device comprising:

[0047] A data obtaining module is configured to obtain food data of a target dish.

[0048] An analysis module is configured to analyze the food data by using the food nutrient prediction model generated by the model construction method of the first aspect or any possible implementation manner of the first aspect, to obtain the nutrient composition result of the target dish.

[0049] The model construction method, the finished dish nutrient analysis method and the device provided in the application can effectively improve the accuracy and efficiency of the finished dish nutrient analysis, and have a wide application range. BRIEF DESCRIPTION OF DRAWINGS

[0050] Figure 1 A flowchart of a model construction method provided by an embodiment of the application is shown in the figure;

[0051] Figure 2 A structure diagram of the neural network factorization machine provided by an exemplary embodiment of the application is shown in the figure;

[0052] Figure 3 A flowchart of data encoding and splicing provided by an embodiment of the application is shown in the figure;

[0053] Figure 4 A distribution diagram of the ingredient categories of the dish sample provided by an exemplary embodiment of the application is shown in the figure;

[0054] Figure 5 A structure diagram of the food nutrient prediction model provided by an embodiment of the application is shown in the figure;

[0055] Figure 6 A training flowchart of the food nutrient prediction model provided by an embodiment of the application is shown in the figure;

[0056] Figure 7 A flowchart of the model construction provided by an embodiment of the application is shown in the figure;

[0057] Figure 8 A flowchart of the finished dish nutrient analysis method provided by an embodiment of the application is shown in the figure;

[0058] Figure 9A structural schematic diagram of a model construction device provided by an embodiment of the present application;

[0059] Figure 10 A structural schematic diagram of a finished dish nutrient analysis device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application is further described in detail below in combination with the 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 can be executed in a manner different from the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification and claims and the above-described 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 commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.

[0063] First, several terms involved in the present application are analyzed:

[0064] Artificial intelligence (AI): is a new technical science that studies, develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence; artificial intelligence is a branch of computer science, and artificial intelligence attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. The research in this field includes robots, language recognition, image recognition, natural language processing and expert systems, etc. Artificial intelligence can simulate the information process of human consciousness and thinking. Artificial intelligence is also the theory, method, technology and application system of using digital computers or digital computer controlled machines to simulate, extend and expand human intelligence, to perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0065] Artificial neural network (ANN): Also known as neural network (NN), it is a mathematical model or computational model that simulates the structure and function of biological neural networks (central nervous system of animals, especially brain) and is used to estimate or approximate functions. A neural network is composed of a large number of nodes (or neurons) and interconnections between nodes. Each node represents a specific output function, called activation function. The connection between each two nodes represents a weighted value for the signal passing through the connection, called weight, which is equivalent to the memory of the artificial neural network. The output of the network depends on the connection mode of the network, the weight value and the activation function. Neural networks have successfully solved many practical problems that modern computers cannot solve in the fields of pattern recognition, intelligent robots, automatic control, prediction and estimation, biology, medicine, economy, etc., and have shown good intelligent characteristics.

[0066] Factorization machine (FM) is a matrix factorization-based machine learning algorithm, mainly used to mine the relationship between high-dimensional discrete features. Factorization machine estimates the parameters of feature combinations through matrix factorization, and learns the correlation between features using hidden vectors. It assumes that the combination of features is determined by K hidden features, and learns a hidden vector of size K for each feature. When predicting, the combination weight of any two features can be represented by the inner product of their corresponding hidden vectors. This way, factorization machine can handle feature combination problems in large-scale sparse matrices, and can still estimate reliable parameters for prediction in the case of sparse data.

[0067] At present, food ingredient data has important academic, economic and social value.

[0068] In the research process of food nutrients, the calculation of the content of various nutrients of the prototype food mainly adopts chemical analysis method, that is, using various chemical or biochemical reactions to separate the nutrients of the food and identify their concentration, which can obtain relatively accurate results. However, the technical threshold is high, the time-consuming is long, and the analysis cost is expensive. In the scene of needing to quickly, batch, real-time conversion of food nutrient content, the application of this method is greatly limited, and it is difficult to become a general method for research and promotion of finished dishes nutrients.

[0069] To this end, the research on the nutrient content of finished dishes mainly adopts the prototype food plus estimation method, that is, through dietary survey questionnaire, weighing calculation method or food recognition system based on image, the category and weight of known raw materials are obtained, combined with the food composition table, and the various nutrients ingested by individuals through diet are estimated by simple addition, to 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 part of food has nutrient retention rate and weight change factor data as a reference, but the covered food categories and processing cooking methods far cannot meet the actual research needs. In addition, different food ingredients may have 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 can affect the absorption of calcium, iron and other minerals in the human body. Therefore, it is obviously inaccurate to estimate the nutrient composition of finished dishes by adding various nutrients in the prototype food, and accurate analysis of the food composition of finished dishes is an important scientific basis for accurate analysis of the nutritional status of the population, evaluation of dietary nutrition quality, development of nutrition science research and implementation of nutrition improvement plan.

[0070] Therefore, for the research on the nutrient content of finished dishes, the chemical analysis method is time-consuming and high-cost, and cannot be applied to large quantities, rapid and real-time application scenarios with high requirements, and has great limitations. The accuracy of the prototype food plus estimation method is low.

[0071] Based on the above problems, the embodiment of the present application provides a model construction method, a finished dish nutrient analysis method and device, by fusing the raw material ingredient data and cooking method data of the dish sample to obtain first fusion feature data, and constructing a food nutrient prediction model based on the first fusion feature data, the raw material quality data and the edible quality data of the dish sample and the second fusion feature data composed of the above combination, considering the correlation between multiple feature data, so as to utilize the food nutrient prediction model for nutrient analysis of the target dish, which can effectively improve the accuracy and efficiency of the finished dish nutrient analysis, and has a large application range.

[0072] The model construction method, the finished dish nutrient analysis method and the device provided by the embodiment of the present application are specifically described by the following embodiments. First, the model construction method and the finished dish nutrient analysis method in the embodiment of the present application are described.

[0073] The embodiments of the present application can acquire and process related data based on artificial intelligence technology. The artificial intelligence (AI) is a theory, method, technology and application system for simulating, extending and expanding human intelligence by using a digital computer or a machine controlled by a digital computer, perceiving environment, acquiring knowledge and using knowledge to obtain optimal results.

[0074] The artificial intelligence basic technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The artificial intelligence software technology mainly includes computer vision technology, robot technology, biometric identification technology, speech processing technology, natural language processing technology and machine learning / deep learning, etc.

[0075] The model construction method and the finished dish nutrient analysis method provided by the embodiments of the present application relate to the field of artificial intelligence. The model construction method and the finished dish nutrient analysis method provided by the embodiments of the present application can be applied in a terminal, can also be applied in a server end, and can also be software running in a terminal or a server end. In some embodiments, the terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, etc.; the server end can be configured as an independent physical server, can also be configured as a server cluster or a distributed system composed of multiple physical servers, can also be configured as a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN and big data and artificial intelligence platform, etc.; and the software can be an application implementing 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 devices or portable devices, tablet devices, multi-processor 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 a distributed computing environment in which tasks are performed by remote processing devices connected by 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 various specific embodiments of the present application, when relevant processing needs to be performed on data related to the identity or characteristics of the user, such as user information, user behavior data, user history data, and user location information, the user's permission or consent is obtained first, and the collection, use, and processing of such data comply with relevant laws, regulations, and standards. In addition, when the embodiments of the present application need to obtain sensitive personal information of the user, the separate permission or separate consent of the user is obtained through a pop-up window or a jump to a confirmation page, and after obtaining the separate permission or separate consent of the user, the necessary user-related data for the normal operation of the embodiments of the present application is obtained.

[0078] Figure 1 A flowchart of a model construction method provided by an embodiment of the present application, Figure 1 The method in the method can include but is not limited to steps S101-S103.

[0079] S101, obtain food sample data of a dish sample, the food sample data includes first food characteristic data and second food characteristic data, the first food characteristic data includes raw material ingredient data and cooking method data, and the second food characteristic data includes 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] For example, the nutritional elements can include water (grams), energy (kcal), protein (grams), fat (grams), carbohydrates (grams), cholesterol (milligrams), vitamin A (micrograms), vitamin B1 (milligrams), vitamin B2 (milligrams), vitamin E (milligrams), calcium (milligrams), phosphorus (milligrams), potassium (milligrams), sodium (milligrams), magnesium (milligrams), iron (milligrams), zinc (milligrams), selenium (micrograms), copper (milligrams), and manganese (milligrams), a total of 20 kinds. The raw material quality data represents the weight, specific gravity, net weight, etc. of each raw material ingredient in the dish, and the raw material edible quality data represents the weight, specific gravity, net weight, etc. of the edible part of each raw material ingredient in the dish.

[0082] S102, after encoding the first food characteristic data, splicing is performed to obtain first fusion characteristic data, the first fusion characteristic data is used to indicate the influence degree between the raw material ingredient data and the cooking method data.

[0083] In the present application, the encoding can be One-Hot encoding, which maps each category value into a binary vector with the length equal to the number of categories, where only one position has a value of 1, representing the category, and the remaining positions are all 0. Therefore, the present application separately One-Hot encodes the raw material ingredient data and the cooking method data, converts them into vectors, and splices the corresponding vectors to obtain the first fusion feature data.

[0084] It should be noted that different combinations of raw material ingredients and cooking methods of dishes may have some impact on the analysis of the nutritional elements of the dishes. Therefore, by generating the first fusion feature data, the present application takes into account the influence of cooking methods on the changes of raw material ingredients during cooking, and the correlation between raw material ingredients and cooking methods, so as to improve the accuracy of model training.

[0085] S103, based on the first fusion feature data, the second food feature data, and the second fusion feature data generated by the first fusion feature data and the second food feature data, the preset neural network factor decomposition machine is trained to construct a food nutrient prediction model, wherein the second fusion 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 factor decomposition machine model is similar to the factor decomposition machine, which is a general machine learner that can process any real-valued feature vector. This model introduces a second-order interaction layer into the neural network model to effectively model the interaction of high-order and nonlinear features, improving the expressiveness of the factor decomposition machine. For example, Figure 2 The structure diagram of the neural network factor decomposition machine provided for an exemplary embodiment of the present application includes an embedding layer, a second-order interaction layer, a hidden layer, and an output layer. The discrete features (i.e., the first fusion feature data) are input into the embedding layer, and the neural network factor decomposition machine first embeds the discrete features to make them low-dimensional dense features, such as embedding vectors {v1, v2…v n Then, the second-order interaction layer is used to multiply the embedded vectors element by element 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 fusion feature data, so that the generated second fusion feature data takes into account the feature correlation between the raw material ingredients, the cooking method, the raw material quality, the edible quality of the raw material, and other feature data, so as to improve the accuracy of model training.

[0087] In Figure 2In this model, following the second-order interaction layer is a set of fully connected layers, including hidden layers and output layers, which learn higher-order interactions between features. Figure 2 The hidden layers contain L levels, such as Layer1, Layer2, ..., Layer L. The fully connected layers are defined 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 W represents the output of the Lth hidden layer. L Let b represent the weight matrix of the Lth hidden layer. L σ represents the bias vector of the Lth hidden layer. L Let z represent the activation function of the Lth hidden layer. L+1 W represents the output of the output layer. L+1 b represents the weight matrix of the output layer. L+1 σ represents the bias vector of the output layer. L+1 This represents the activation function of the output layer.

[0088] Specifically, regarding the activation function, in this application, the activation function can be a non-linear activation function ELU(x), allowing the model to learn higher-order interaction features in a non-linear manner. The structure of the fully connected layers (i.e., the size of each layer) is limited to 20 neurons, but can also be freely chosen, such as fixed size, growing, or diamond shape, etc. Furthermore, the output z of the output layer... L+1 The predicted value will be used as the objective function of the fully connected layer. It is a one-dimensional vector of length 20, where the activation function is softplus(x) = log(1 + e^x). x ), where x is the input variable.

[0089] The model construction method provided in the embodiment is used to splice the first fusion feature data obtained by encoding the raw material component data and the cooking method data of the dish sample, consider the influence of the cooking method on the change of the raw material component in the cooking process, and consider the correlation between the raw material component and the cooking method, and then train the preset neural network factor decomposition machine based on the first fusion feature data of the dish sample, the raw material quality data, the raw material edible quality data and the second fusion feature data combined from the above, so as to construct the food nutrient prediction model. The correlation between the raw material component, the cooking method, the raw material quality and the raw material edible quality is considered, the accuracy of model training is improved, the accuracy and efficiency of the finished dish nutrient analysis can be effectively improved, and the application range is large.

[0090] In some embodiments, Figure 3 The flowchart of the data encoding and splicing provided in the embodiment of the application, the data encoding and splicing method provided in the embodiment, that is, step S102 can include but is not limited to steps S301 to S304.

[0091] S301, pre-processing the first food feature data to obtain processed raw material component data and processed cooking method data;

[0092] S302, classifying and encoding the processed raw material component data according to a preset classification of raw materials to obtain a raw material component data group of the dish sample, the raw material component data group containing at least one raw material component in the dish sample and a raw material classification corresponding thereto and a raw material component vector;

[0093] S303, classifying and encoding the processed cooking method data according to a preset cooking classification to obtain a cooking method vector of the dish sample;

[0094] S304, splicing the raw material component data group and the cooking method vector into the first fusion feature data of the dish sample.

[0095] In the embodiment, the pre-processing includes but is not limited to data missing value processing and abnormal value processing. Then, the processed raw material component data and the processed cooking method data are respectively one-hot encoded, that is, each category value is mapped into a binary vector.

[0096] It should be noted that the cooking classification can include deep-frying, steaming, frying, stewing, frying, a total of 4 categories. The classification of raw materials (that is, the classification of raw materials) can be classified into poultry, other vegetables, condiments, oils, aquatic products, livestock meat, edible fungi, rice products, leaf vegetables, soybeans, fresh fruits, eggs, miscellaneous grains and beans and their products, nuts, potatoes, milk and dairy products, a total of 16 categories.

[0097] For example, taking 106 dish samples as an example, the ingredient (216 kinds), the cooking method (21 kinds), the numerical variable: the ingredient quality, the edible part of the ingredient, the edible part quality of the ingredient and the nutritional elements of the ingredient (20 kinds). According to the above cooking category, the cooking method data of the dish sample is classified, such as “frying class” count is 11, “deep-frying class” count is 27, “steaming and frying class” count is 15, “boiling class” count is 53. According to the above ingredient category, the ingredient data of the dish sample is classified, and the distribution is as shown in the table. Figure 4

[0098] For example, considering that “poultry” is in the first position in the 16 categories of ingredient categories, its one-hot encoding (i.e. ingredient vector) is [1, 0, 0, …, 0] (16 bits in total, the first bit is 1 and the rest are 0). For “deep-frying class”, if it is also in the first position in the 4 cooking categories, its one-hot encoding (i.e. cooking method vector) is [1, 0, 0, 0]. Then, the above ingredient vector and cooking method vector are spliced in sequence to obtain the first fusion feature vector [1, 0, 0, …, 0, 1, 0, 0, 0].

[0099] Further, at least one ingredient vector and cooking method vector are spliced, wherein the ingredient vector and the cooking method vector can be spliced in sequence. Or the ingredient vector and the cooking method vector are processed according to a preset data processing rule, and then the processed vectors are fused to form the first fusion feature vector. The splicing method is not limited in the present application.

[0100] Therefore, the embodiment classifies, encodes and splices the ingredient data and the cooking method data, ensures the difference of each data, considers the influence of the cooking method on the change of the ingredient in the cooking process, considers the correlation between the ingredient category and the cooking category, and then trains the model according to the obtained first fusion feature data, which can improve the accuracy of model training.

[0101] In some embodiments, Figure 5 The structure diagram of the food nutrient prediction model provided by the embodiment of the present application includes an embedded layer 501, a second-order interaction layer 502, a hidden layer 503 and an output layer 504 in cascade.

[0102] Specifically, Figure 6 The training flowchart of the food nutrient prediction model provided by the embodiment of the present application, the training method of the food nutrient prediction model provided by the embodiment of the present application, that is, step S103 can include but is not limited to steps S601 to S605.​

[0103] S601, input the first fusion feature data of the dish sample into the embedding layer for data conversion to obtain an embedding vector;

[0104] S602, perform pooling processing on the embedding vector through the second-order interaction layer to obtain a feature interaction vector, the feature interaction vector being used to indicate an interaction degree between a cooking category and a raw material category corresponding to the dish sample;

[0105] S603, splice the feature interaction vector and the second food feature data to obtain second fusion feature data;

[0106] S604, perform feature extraction and transformation on the second fusion feature data through the hidden layer to obtain interaction feature data;

[0107] S605, transmit the interaction feature data to the output layer, and take an output of the output layer as an output of the food nutrient prediction model.

[0108] It should be noted that, as shown in Figure 5 , the embedding layer is a fully connected layer, which projects each feature into a vector representation, and converts the first fusion feature data into an embedding vector. Then, the embedding vector is input into the second-order interaction layer for pooling processing, and a group of embedding vectors is converted into a vector. The output of the second-order interaction layer is a k-dimensional vector that encodes the second-order interaction between features in the embedding space. It should be noted that the 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 categories and ingredient categories), such as the mutual influence between “poultry” and “frying”.

[0109] In the embodiment, to avoid co-adaptation between feature embeddings and overfitting data, Dropout is applied on the second-order interaction layer. Specifically, after obtaining the feature interaction vector, which is a k-dimensional latent factor vector, ρ percentage of latent factors are randomly discarded, where ρ represents a Dropout ratio. In addition, Dropout is applied on the hidden layer of the neural network factorization machine model to prevent co-adaptation and overfitting when learning high-order feature interactions.

[0110] Further, the feature interaction vector f(V x ) output by the second-order interaction layer is spliced with the second food feature data (the second food feature data is represented as s=[s1,s2…s m) to obtain second fusion 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 ingredient subcategories included in each ingredient category (i.e., the category of ingredients in the embodiment). The second fusion feature data can be represented as z = Concat[s; f(V x )].

[0111] Further, the second fusion feature data is input into a hidden layer for feature extraction and transformation to obtain interaction feature data. Specifically, the hidden layer is used for data processing and feature extraction. Through layer-by-layer transformation of multiple hidden layers, the complex features of the input data are gradually extracted and combined. Then, the interaction feature data output by the hidden layer is input into an output layer, which 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 taken as the output result of the food nutrient prediction model.

[0112] Therefore, by setting the second-order interaction layer, the embodiment realizes the extraction of the interaction between the ingredient categories and the cooking categories. By concatenating the feature interaction vector representing the correlation between the ingredient and the cooking method with the raw material quality data and the raw material edible quality data to obtain the second fusion feature data, the embodiment further extracts the interaction features between the ingredient, the cooking method, the raw material quality, and the raw material edible quality through the feature extraction and transformation of the second fusion feature data by the hidden layer and the output layer. Thus, the model is trained, the feature correlation between multiple data features is considered, and the accuracy of the model training is improved. Therefore, the model obtained by the embodiment improves the analysis accuracy and the use range for the analysis of nutritional elements.

[0113] In some embodiments, the inputting of the first fusion feature data of the dish sample into the embedding layer to perform data conversion to obtain an embedding vector comprises:

[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 ingredient category in the first fusion feature data with the first embedding matrix to determine an ingredient embedding vector;

[0116] multiplying the vector indicating the cooking category in the first fusion feature data with the second embedding matrix to determine a cooking embedding vector;

[0117] combining the ingredient embedding vector and the cooking embedding vector to obtain an embedding vector.

[0118] In this embodiment, each category (such as the cooking category, the 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 "frying" will be a 4x10 matrix. Among them, these matrices are initially randomly generated.

[0119] Further, the corresponding embedding vector is determined by the product of the first fusion feature data (containing the ingredient vector and the cooking method vector) and the embedding matrix. Since only one position in the one-hot encoding (i.e. the first fusion feature data) is 1, this multiplication operation is actually selecting a vector from the embedding matrix. For example, the embedding vectors of "poultry" and "frying" are the first row of the corresponding embedding matrix, and if the first row of 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 "frying" 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 fusion feature data) to vectors represented in a low-dimensional, dense vector space (i.e. the embedding vector), and maps the data according to the cooking category and the cooking category, preserves the semantic or structural information of the original data, and further enables the model to more efficiently learn and calculate, improving the accuracy of model training.

[0121] In some embodiments, the feature interaction vector is spliced with the second food feature data to obtain second fusion feature data, including:

[0122] The second food feature data is preprocessed to obtain the to-be-processed quality data;

[0123] The to-be-processed quality data is standardized to obtain a quality vector;

[0124] The feature interaction vector and the quality vector are spliced to obtain the second fusion feature data of the dish sample.

[0125] In this embodiment, by standardizing the data representing the quality of the ingredients and the edible quality of the ingredients, the efficiency and accuracy of the training are improved, and the sample size can be effectively expanded while preserving all important information. Moreover, by converting it 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 ingredient composition, cooking method, ingredient quality, and ingredient edible quality, thereby improving the training accuracy.

[0126] In some embodiments, the first food characteristic data and / or the second food characteristic data are preprocessed by the following steps, comprising:

[0127] obtaining a food ingredient database;

[0128] filling data missing values in the first food characteristic data and / or the second food characteristic data based on the food ingredient database;

[0129] performing abnormal processing on data abnormal values in the first food characteristic data and / or the second food characteristic data.

[0130] In the present embodiment, for the missing values of the raw materials and / or the nutritional elements of the raw materials in the second food characteristic data, in the first optional implementation, the raw material ingredient data of the corresponding dishes is extracted from the food ingredient database (such as regional food database) for filling. Specifically, the same ingredients are preferred, followed by similar ingredients, and the ingredients with fewer missing values are preferred. In the second optional implementation, the remaining missing values are filled, specifically, the priority is food safety, the United States Department of Agriculture Food Data Center, other platforms, and the nutritional element data of the same (preferred) or similar ingredients of the raw materials are taken to fill. In the third optional implementation, the raw materials of a certain region dish are processed foods, such as cakes, and materials for platters, and then the weighted average value is taken according to the food formula and ratio.

[0131] For the abnormal values in the second food characteristic data and / or the second food characteristic data, they can be replaced by water: 0.1; protein 0.05; fat: 0.1. They can also be replaced by 0.

[0132] Therefore, the present embodiment improves the completeness 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 The present embodiment provides a model construction method, which comprises steps S701-S704.

[0134] S701, dividing the dish samples according to a preset ratio to correspondingly generate a training data set, a verification data set and a test data set;

[0135] S702, training a preset neural network factorization machine using the training data set;

[0136] S703, adjusting the parameters of the trained neural network factorization machine using the verification data set;

[0137] S704, performing performance evaluation test on the neural network factorization machine with parameter adjustment using the test data set to obtain a food nutrient prediction model.

[0138] In the embodiment, the data set of dish samples (i.e., containing first fusion feature data and second food feature data) is divided according to a preset ratio, such as 60% of training data set, 20% of validation data set, and 20% of 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 embodiment adopts root mean square error RMSE and mean absolute error MAE (between predicted value (calculated value) and measured value), wherein a lower RMSE or MAE score indicates better performance. It should be noted that the dish samples in the training data set, the validation data set, and the test data set are not repeated, i.e., if the dish A is divided into the training data set, it will not be 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, due to the change of the parameters of the previous layer, the subsequent layer needs to adapt to these changes (which are often noise), and the update of its parameters will be adversely affected, 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 the test process, batch normalization (BN) is also applied, wherein the mean of the mini-batch and the variance of the mini-batch are estimated from the entire training data. In NFM (Neural Factorization Machines is an algorithm model for solving click-through rate CTR problem), in order to avoid the update of feature embedding changing the input distribution to the hidden layer or the prediction layer, BN is performed on the output of the second-order interaction pooling. For each subsequent hidden layer, BN is also applied.

[0141] Exemplarily, the test data set is taken as 22 dish samples for illustration, and the test results of the 22 dish samples are shown in Table 1 as follows.

[0142] Serial number Nutritional element Model prediction Calculation 0 Water (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] The prediction errors of the 20 nutrients are lower than the traditional calculation method, and the average absolute error is 37.70, which is 265.58 lower than the calculation method (300.28). Without changing any parameters, the neural network factor decomposition machine is experimented for nine times in different data set division conditions, and the error is lower than the calculation. Among them, the error of all nutrients is lower than the calculation in 4 times, 3 times overfitting model, and individual nutrients are slightly higher than the calculation method. After multiple training, verification and testing, the model prediction value and the observed value are basically overlapped, and the value of the traditional calculation method deviates from the true value.

[0145] Therefore, by training, verifying and testing the neural network factor decomposition machine, the accuracy of the model can be improved, and the accuracy of the nutrient element analysis can be further improved.

[0146] Figure 8 A process schematic diagram of a finished dish nutrient analysis method provided by the embodiment of the present application, Figure 8 The method in the embodiment of the present application can include but not limited to steps S801 to S802.

[0147] S801, obtaining food data of a target dish;

[0148] S802, analyzing the food data by 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 feature data and second food feature data, the first food feature data includes raw material ingredient data and cooking method data, and the second food feature 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 analyze the content of the nutrient element, and the nutrient composition result of the target dish is output.

[0150] The finished dish nutrient analysis method provided by the embodiment of the present application can improve the accuracy and efficiency of data analysis, and has a wide application range.

[0151] Figure 9 A structure schematic diagram of a model construction device provided by the embodiment of the present application is provided, and the model construction device 900 includes:

[0152] The sample data acquisition module 901 is configured to acquire food sample data of a dish sample, the food sample data comprising first food feature data and second food feature data, the first food feature data including raw material ingredient data and cooking method data, and the second food feature data including raw material quality data and raw material edible quality data.

[0153] The feature processing module 902 is configured to splice the first food feature data after encoding to obtain first fusion feature data, the first fusion feature data being used to indicate an influence degree between the raw material ingredient data and the cooking method data.

[0154] The model construction module 903 is configured to train a preset neural network factorization machine based on the first fusion feature data of the dish sample, the second food feature data, and second fusion feature data generated from the first fusion feature data and the second food feature data, to construct a food nutrient prediction model, wherein the second fusion feature data is used to indicate a feature correlation degree between the first food feature data and the second food feature data.

[0155] In some embodiments, the feature processing module 902 comprises:

[0156] The first preprocessing unit is configured to preprocess the first food feature data to obtain to-be-processed raw material ingredient data and to-be-processed cooking method data.

[0157] The first classification and encoding unit is configured to classify and encode the to-be-processed raw material ingredient data according to a preset ingredient classification to obtain a raw material ingredient data group of the dish sample, the raw material ingredient data group comprising at least one raw material ingredient in the dish sample, a raw material ingredient classification corresponding to the raw material ingredient, and a raw material ingredient vector.

[0158] The second classification and encoding unit is configured to classify and encode the to-be-processed cooking method data according to a preset cooking classification to obtain a cooking method vector of the dish sample.

[0159] The first feature fusion unit is configured to splice the raw material ingredient data group and the cooking method vector into the first fusion feature data of the dish sample.

[0160] In some embodiments, the food nutrient prediction model comprises an embedding layer, a second-order interaction layer, a hidden layer, and an output layer arranged in cascade.

[0161] The model construction module 903 comprises:

[0162] The embedding layer processing unit is configured to input 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 configured to perform a pooling processing on the embedding vector through the second-order interaction layer to obtain a feature interaction vector, the feature interaction vector being used to indicate an interaction degree between a raw material ingredient category and a cooking category corresponding to the dish sample;

[0164] a concatenation unit configured to concatenate the feature interaction vector and the second food feature data to obtain second fusion feature data;

[0165] a feature extraction and transformation unit configured to perform feature extraction and transformation on the second fusion feature data through the hidden layer to obtain interaction feature data;

[0166] an integration output unit configured to transmit the interaction feature data to the output layer and take an output of the output layer as an output of the food nutrient prediction model.

[0167] In some embodiments, the model construction module 903 comprises:

[0168] a data division unit configured to divide dish samples according to a preset proportion to generate a training data set, a verification data set and a test data set;

[0169] a training unit configured to train a preset neural network factorization machine using the training data set;

[0170] a verification unit configured to adjust parameters of the trained neural network factorization machine using the verification data set;

[0171] a test unit configured to perform performance evaluation testing on the neural network factorization machine with adjusted parameters using the test data set to obtain a food nutrient prediction model.

[0172] In some embodiments, the embedding layer processing unit comprises:

[0173] an embedding matrix acquisition unit configured to acquire a first embedding matrix associated with a raw material ingredient category corresponding to the dish sample and a second embedding matrix associated with a cooking category corresponding to the dish sample;

[0174] a first multiplication unit configured to multiply a vector indicating the raw material ingredient category in the first fusion feature data with the first embedding matrix to determine an ingredient embedding vector;

[0175] a second multiplication unit configured to multiply a vector indicating the cooking category in the first fusion feature data with the second embedding matrix to determine a cooking embedding vector;

[0176] a vector combination unit, configured 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, configured to preprocess the second food feature data to obtain to-be-processed quality data;

[0179] a standardization processing unit, configured to perform standardization processing on the to-be-processed quality data to obtain a quality vector;

[0180] a second feature fusion unit, configured to splice the feature interaction vector and the quality vector into second fusion feature data of the dish sample.

[0181] In some embodiments, the apparatus 900 further comprises:

[0182] a database acquisition unit, configured to acquire a food ingredient database;

[0183] a filling unit, configured to fill data missing values in the first food feature data and / or the second food feature data based on the food ingredient database;

[0184] an abnormality processing unit, configured to perform abnormality processing on data abnormal values in the first food feature data and / or the second food feature data.

[0185] Figure 10 A structure schematic diagram of a finished dish nutrient analysis apparatus provided by an embodiment of the present application, the finished dish nutrient analysis apparatus 1000 comprises:

[0186] a data acquisition module 1001, configured to acquire food data of a target dish;

[0187] an analysis module 1002, configured to analyze the food data by using a food nutrient prediction model generated by a model construction method as described in the above embodiments, to obtain a nutrient composition result of the target dish.

[0188] The apparatus of the embodiments of the present application can execute the method provided by the embodiments of the present application, the implementation principles of which are similar, and the actions performed by each module in the apparatus of the embodiments of the present application are corresponding to the steps in the method of the embodiments of the present application. For the detailed function description of each module of the apparatus, refer to the description in the corresponding method in the foregoing description, which will not be repeated here.

[0189] The embodiments described in the specification are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0190] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than shown in the figures, or combine certain steps, or different steps.

[0191] The device embodiments described above are only schematic, and the units described as separate components can or can not be physically separate, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0192] Those skilled in the art can understand that all or some of the steps in the above disclosed method, the functional modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.

[0193] The terms "first", "second", "third", "fourth" and the like (if any) in the specification of the present application and the above-described figures are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, 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 "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can 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 application, "at least one" refers to one or more, and "multiple" refers to two or more. "And / or" is used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, "A and / or B" can represent three cases of only A, only B, and A and B existing at the same time, wherein A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after it. "At least one of the following" or similar expressions means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can represent a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, and c can be single or multiple.

[0195] In several embodiments provided in the 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 illustrative, for example, the division of the above units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0196] The units described above as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed on multiple network units. According to actual needs, some or all of the units can be selected to achieve the purpose of the embodiment scheme.

[0197] In addition, each functional unit in each embodiment of the application can be integrated into a processing unit, or each unit can exist physically, or two or more units can be integrated into one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0198] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes multiple instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program storage media.

[0199] The preferred embodiments of the embodiments of the present application are described above with reference to the accompanying drawings, and are not limited to the scope of the embodiments of the present application. Any modifications, equivalent replacements and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the embodiments of the present application.

Claims

1. A method of constructing a model, characterized by, The method comprises the following steps: acquiring food sample data of a dish sample, the food sample data comprising first food feature data and second food feature data, the first food feature data including raw material ingredient data and cooking method data, and the second food feature data including raw material quality data and raw material edible quality data; encoding and splicing the first food feature data to obtain first fusion feature data, the first fusion feature data being used to indicate the influence degree between the raw material ingredient data and the cooking method data; training a preset neural network factorization machine based on the first fusion feature data, the second food feature data, and second fusion feature data generated from the first fusion feature data and the second food feature data, to construct a food nutrient prediction model, wherein the second fusion feature data is used to indicate the feature correlation degree between the first food feature data and the second food feature data; the food nutrient prediction model comprises a cascade-ordered embedding layer, a second-order interaction layer, a hidden layer, and an output layer; the training steps of the food nutrient prediction model comprise: inputting the first fusion feature data of the dish sample into the embedding layer for 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, the feature interaction vector being used to indicate the interaction degree between the raw material ingredient categories and the cooking categories corresponding to the dish sample; splicing the feature interaction vector and the second food feature data to obtain second fusion feature data; performing feature extraction and transformation on the second fusion feature data through the hidden layer to obtain interaction feature data; transmitting the interaction feature data to the output layer, and taking the output of the output layer as the output of the food nutrient prediction model.

2. The method of constructing a model according to claim 1, wherein, the encoding and splicing of the first food feature data to obtain the first fusion feature data comprise: preprocessing the first food feature data to obtain processed raw material ingredient data and processed cooking method data; classifying and encoding the processed raw material ingredient data according to preset ingredient categories to obtain a raw material ingredient data group of the dish sample, the raw material ingredient data group comprising at least one raw material ingredient in the dish sample, a raw material ingredient category corresponding to the raw material ingredient, and a raw material ingredient vector; classifying and encoding the processed cooking method data according to preset cooking categories to obtain a cooking method vector of the dish sample; splicing the raw material ingredient data group and the cooking method vector into the first fusion feature data of the dish sample.

3. The method of constructing a model according to claim 1, wherein, the training of the preset neural network factorization machine based on the first fusion feature data, the second food feature data, and the second fusion feature data generated from the first fusion feature data and the second food feature data to construct the food nutrient prediction model comprises: dividing the dish sample according to a preset proportion to correspondingly generate a training data set, a verification data set, and a test data set; Training a preset neural network factorization machine using the training data set; Parameter adjustment is performed on the trained neural network factorization machine using the verification data set; Performance evaluation test is performed on the parameter-adjusted neural network factorization machine using the test data set to obtain a food nutrient prediction model.

4. The method of constructing a model according to claim 1, wherein, The first fusion feature data of the dish sample is input into the embedding layer for data conversion to obtain an embedding vector, including: 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 ingredient category in the first fusion feature data with the first embedding matrix to determine the ingredient embedding vector; Multiplying the vector indicating the cooking category in the first fusion feature data with the second embedding matrix to determine the cooking embedding vector; The ingredient embedding vector and the cooking embedding vector form an embedding vector.

5. The method of building a model according to claim 1 or 4, characterized in that, The feature interaction vector and the second food feature data are spliced to obtain second fusion feature data, including: Pretreating the second food feature data to obtain to-be-processed quality data; Standardizing the to-be-processed quality data to obtain a quality vector; Splicing the feature interaction vector and the quality vector to obtain the second fusion feature data of the dish sample.

6. The method of building a model according to claim 5, wherein, The first food feature data and / or the second food feature data are pretreated by the following steps, including: Obtaining a food ingredient database; Based on the food ingredient database, filling the data missing values in the first food feature data and / or the second food feature data; Abnormal processing is performed on the data abnormal values in the first food feature data and / or the second food feature data.

7. A method of finished dish nutrient analysis, the method comprising: Including: Obtaining food data of a target dish; Using the food nutrient prediction model generated by the model construction method of any one of claims 1 to 6 to analyze the food data to obtain the nutrient composition result of the target dish.

8. A model building apparatus, characterized by comprising: The device includes: A sample data acquisition module for acquiring food sample data of a dish sample, the food sample data including first food feature data and second food feature data, the first food feature data including ingredient data and cooking method data, and the second food feature data including ingredient quality data and edible ingredient quality data; A feature processing module for splicing the first food feature data after encoding to obtain first fusion feature data, the first fusion feature data being used to indicate the influence degree between the ingredient data and the cooking method data; The model construction module is configured to train a preset neural network factorization machine based on the first fusion feature data of the dish sample, the second food feature data, and second fusion feature data generated from the first fusion feature data and the second food feature data, to construct a food nutrient prediction model, wherein the second fusion feature data is used to indicate a feature correlation degree between the first food feature data and the second food feature data. The food nutrient prediction model includes a cascade-ordered embedding layer, a second-order interaction layer, a hidden layer, and an output layer; wherein the training steps of the food nutrient prediction model include: inputting the first fusion feature data of the dish sample into the embedding layer for 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, the feature interaction vector being used to indicate an interaction degree between a raw material category and a cooking category corresponding to the dish sample; splicing the feature interaction vector and the second food feature data to obtain second fusion feature data; performing feature extraction and transformation on the second fusion feature data through the hidden layer to obtain interaction feature data; transmitting the interaction feature data to the output layer, and taking an output of the output layer as an output of the food nutrient prediction model.

9. A finished dish nutrient analysis device, comprising: The device includes: a data acquisition module configured to acquire food data of a target dish; an analysis module configured to analyze the food data by using the food nutrient prediction model generated by the model construction method of any one of claims 1 to 6, to obtain a nutrient composition result of the target dish.

Citation Information

Patent Citations

  • Nutrient analysis method and device for menu

    CN117912638A

  • Intelligent nutrition diet management system and method based on multi-source data acquisition

    CN118016245A