Food nutritional component analysis method, device, electronic device and readable storage medium

Through the progressive recognition technology of pre-built image segmentation and recognition models, combined with nutritional component database analysis, the low accuracy problem of food nutritional component analysis under a single model is solved, achieving higher nutritional component analysis accuracy and personalized dietary recommendations.

CN113936274BActive Publication Date: 2024-09-13SHENZHEN PING AN SMART HEALTHCARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111217587.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-19
Publication Date
2024-09-13
Estimated Expiration
2041-10-19

AI Technical Summary

Technical Problem

In the existing technology, the recognition accuracy of a single artificial intelligence model used for food nutritional component analysis is not high, resulting in a low accuracy of nutritional component analysis and unable to meet the needs of personalized meal matching.

Method used

Use the pre-built image segmentation model to segment and classify food images, and combine it with the food recognition model for progressive identification. After obtaining the food name, query the detailed information from the nutritional ingredient database, and determine the nutritional ingredients to be supplemented through set operations and missing analysis. .

Benefits of technology

It improves the accuracy of food nutritional composition analysis and provides more accurate nutritional composition information to meet personalized dietary needs through progressive identification and database query methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113936274B
    Figure CN113936274B
Patent Text Reader

Abstract

The present invention relates to artificial intelligence technology, and discloses a method for analyzing food nutrients, including: performing interference removal processing on food images to be identified to obtain standard food images; using a pre-constructed image segmentation model to perform food area segmentation and classification on standard food images to obtain segmented food images and corresponding food categories; selecting a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each segmented food image to obtain the corresponding food name; querying the nutritional components of the corresponding food according to the food name to obtain a nutritional component subset; performing missing nutritional analysis based on the standard dietary nutritional component set and the nutritional component subset to obtain the nutritional components to be supplemented. The present invention also relates to blockchain technology, and the nutritional component subset can be stored in a blockchain node. The present invention also proposes a food nutritional component analysis device, equipment and medium. The present invention can improve the accuracy of food nutritional component analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to artificial intelligence technology, and in particular to a food nutrient component analysis method, device, electronic device and readable storage medium. Background Art

[0002] In today's society, people are paying more and more attention to dietary health issues. In order to have a healthier diet and better absorb the nutrients needed by the body from food, it is necessary to accurately analyze the missing nutrients in food and make more targeted dietary combinations. Therefore, the nutritional analysis methods of food are also receiving more and more attention.

[0003] However, currently a single artificial intelligence model is used to directly identify the food people eat for nutritional analysis. Due to the large number of food types, the model's recognition accuracy is not high, and the accuracy of food nutritional analysis is thus low. Summary of the invention

[0004] The present invention provides a method, device, electronic equipment and computer-readable storage medium for analyzing food nutritional components, the main purpose of which is to improve the accuracy of food nutritional component analysis.

[0005] To achieve the above object, the present invention provides a method for analyzing food nutritional components, comprising:

[0006] Acquire a food picture to be identified, and perform interference removal processing on the food picture to be identified to obtain a standard food picture;

[0007] Using a pre-built image segmentation model to segment and classify the food regions of the standard food image, to obtain segmented food images and corresponding food categories;

[0008] Obtain one or more food recognition models and the recognition category corresponding to each of the food recognition models, and select a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain a corresponding food name;

[0009] According to the food name, query the nutritional components of the corresponding food in a preset food nutritional component database to obtain a nutritional component subset;

[0010] Performing a set operation on all the nutrient component subsets to obtain a nutrient component set;

[0011] A standard dietary nutrient component set is obtained, and a missing nutrient analysis is performed based on the standard dietary nutrient component set and the nutrient component set to obtain the nutrient components to be supplemented.

[0012] Optionally, the using a pre-built image segmentation model to perform food region segmentation and classification on the standard food image to obtain the segmented food image and the corresponding food category includes:

[0013] Using the image segmentation model to divide and identify food areas in the image to be identified, and obtain food categories in different divided areas and corresponding analysis coordinates of the divided areas;

[0014] Segment the image within the closed area formed by connecting all coordinate points in the analysis coordinates of each divided area in the image to be identified to obtain the corresponding segmented food image;

[0015] Optionally, the step of dividing and identifying food areas of the image to be identified by using the image segmentation model to obtain food categories of different divided areas and corresponding analysis coordinates of the divided areas includes:

[0016] Using the region extraction network in the image segmentation model to mark the region of interest in the image to be identified, to obtain the corresponding divided region;

[0017] Using the image recognition network in the image segmentation model to identify the food category of the divided area, to obtain the corresponding food category;

[0018] The coordinates of the area edge pixels of the divided area are obtained to obtain the corresponding analysis coordinates of the divided area.

[0019] Optionally, the selecting a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain a corresponding food name includes:

[0020] Select the recognition category that is the same as the food category to which each of the segmented food images belongs, to obtain a target recognition category;

[0021] Selecting a food recognition model corresponding to the target recognition category to obtain a target food recognition model;

[0022] Using the target food recognition model, convolution pooling is performed on the corresponding segmented food image to obtain corresponding segmentation feature data;

[0023] Calculating the segmentation feature data using a preset activation function to obtain recognition probabilities of different preset types of food;

[0024] The name of the preset type of food corresponding to the largest recognition probability is selected to obtain the food name.

[0025] Optionally, querying the nutritional components of the corresponding food in a preset food nutritional component database according to the food name to obtain a nutritional component subset includes:

[0026] Using the food name as a query condition to query in the preset food nutrition database, to obtain the corresponding food nutrition information;

[0027] All the nutrients in the nutrient component information of each food are extracted and summarized to obtain the nutrient component subset.

[0028] Optionally, performing a set operation on all the nutrient component subsets to obtain a nutrient component set includes:

[0029] Aggregating all nutrients in all of said nutrient subsets;

[0030] All the aggregated nutrients are deduplicated to obtain the nutrient set.

[0031] Optionally, performing missing nutrition analysis according to the standard dietary nutrient component set and the nutrient component set to obtain the nutrient components to be supplemented includes:

[0032] Performing an intersection operation on the standard dietary nutrient component set and the nutrient component set to obtain an analysis nutrient component set;

[0033] Calculating the complement of the analyzed nutrient component set in the standard dietary nutrient component set to obtain a target nutrient component set;

[0034] All nutrients in the target nutrient set are extracted to obtain the nutrients to be supplemented.

[0035] In order to solve the above problems, the present invention also provides a food nutritional component analysis device, the device comprising:

[0036] An image processing module is used to obtain a picture of food to be identified, and to perform interference removal processing on the picture of food to be identified to obtain a standard food picture;

[0037] The food recognition module is used to segment and classify the food regions of the standard food images using a pre-built image segmentation model to obtain segmented food images and corresponding food categories; obtain one or more food recognition models and the recognition category corresponding to each of the food recognition models, select a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain the corresponding food name;

[0038] The nutrition analysis module is used to query the nutrition components of the corresponding food in a preset food nutrition component database according to the food name to obtain a nutrition component subset; perform set operation on all the nutrition component subsets to obtain a nutrition component set; obtain a standard dietary nutrition component set, perform missing nutrition analysis based on the standard dietary nutrition component set and the nutrition component set, and obtain the nutrition components to be supplemented.

[0039] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:

[0040] a memory storing at least one computer program; and

[0041] The processor executes the computer program stored in the memory to implement the above-mentioned food nutritional component analysis method.

[0042] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned food nutritional component analysis method.

[0043] The embodiment of the present invention utilizes a pre-built image segmentation model to perform food area segmentation and classification on the standard food image to obtain segmented food images and corresponding food categories, selects a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain the corresponding food name, and utilizes two models to perform progressive recognition of food, thereby improving the accuracy of food recognition, and then performs nutritional analysis based on the recognized food name, thereby improving the accuracy of nutritional analysis. Therefore, the food nutritional component analysis method, device, electronic device and readable storage medium proposed in the embodiment of the present invention improve the accuracy of food nutritional component analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 A schematic diagram of a method for analyzing food nutritional components according to an embodiment of the present invention;

[0045] Figure 2 A schematic diagram of a module of a food nutritional component analysis device provided by an embodiment of the present invention;

[0046] Figure 3 A schematic diagram of the internal structure of an electronic device for implementing a method for analyzing food nutritional components provided by an embodiment of the present invention;

[0047] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0048] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0049] The embodiment of the present invention provides a method for analyzing food nutrients. The execution subject of the method for analyzing food nutrients includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided in the embodiment of the present application. In other words, the method for analyzing food nutrients can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.

[0050] Reference Figure 1 FIG. 1 is a flow chart of a method for analyzing food nutritional components according to an embodiment of the present invention. In the embodiment of the present invention, the method for analyzing food nutritional components includes:

[0051] In an embodiment of the present invention, the method for analyzing nutritional components of food comprises:

[0052] S1. Obtain a picture of food to be identified, and perform interference removal processing on the picture of food to be identified to obtain a standard food picture;

[0053] In detail, the food picture to be identified in the embodiment of the present invention is a food picture taken and needs to be analyzed for nutritional components.

[0054] Further, in detail, since the food pictures to be identified may have different colors, in order to reduce the amount of data, reduce storage space, and reduce image processing time, the interference removal processing in the embodiment of the present invention may include grayscale processing of the food pictures to be identified; further, since there is image noise in the food pictures to be identified, in order to reduce the impact of image noise on subsequent processing, the interference removal processing in the embodiment of the present invention may also include filtering the food pictures to be identified. Preferably, the embodiment of the present invention uses a median filtering algorithm to filter the food pictures to be identified; in addition, since the food pictures to be identified may be affected by the lighting environment in which the pictures are taken and there is uneven lighting, in order to remove the impact of uneven image lighting, the interference removal processing in the embodiment of the present invention may also include binarization processing of the food pictures to be identified. Preferably, the embodiment of the present invention uses an adaptive illumination balance algorithm and an Otsu algorithm to binarize the denoised food pictures to be identified.

[0055] Therefore, in summary, in an embodiment of the present invention, the interference removal processing of the food picture to be identified includes: grayscale processing of the food picture to be identified to obtain a grayscale food picture to be identified; filtering processing of the grayscale food picture to be identified to obtain a denoised food picture to be identified; binarization processing of the denoised food picture to be identified to obtain a standard food picture.

[0056] S2. Using a pre-built image segmentation model to perform food region segmentation and classification on the standard food image to obtain segmented food images and corresponding food categories;

[0057] The image segmentation model in the embodiment of the embodiment of the present invention is a trained convolutional neural network model. Optionally, the image segmentation model can be a full convolutional model.

[0058] The standard food pictures in the embodiment of the present invention include different types of food, such as cooked food and fruits and vegetables.

[0059] Since different categories of food need to be further accurately identified, it is necessary to segment and identify different categories of food areas in the to-be-identified physical object image.

[0060] In detail, in the embodiment of the present invention, a pre-built image segmentation model is used to segment and classify the food regions of the standard food images to obtain segmented food images and corresponding food categories. Optionally, the image segmentation model is a Mask-RCNN model, and the image segmentation model includes a region extraction network and an image recognition network. The region extraction network is used to mark the corresponding region of interest, and the image recognition network is used to identify the food category of the marked region of interest.

[0061] Furthermore, before the embodiment of the present invention uses the pre-built image segmentation model to perform food region segmentation and classification on the standard food image, the method further includes:

[0062] Acquire a historical food picture set, wherein each historical food picture in the historical food picture set includes a division area coordinate and a food category;

[0063] Optionally, the food categories in the embodiment of the present invention include but are not limited to: meat, vegetables, fruits, etc.

[0064] Selecting historical food pictures from the historical food picture collection and inputting them into a preset initial picture segmentation model to obtain predicted coordinates of the divided areas and predicted values ​​of the food categories;

[0065] Optionally, the initial image segmentation model in the embodiment of the present invention includes: a region extraction network and an image recognition network;

[0066] Furthermore, an embodiment of the present invention utilizes the region extraction network in the initial image segmentation model to mark the region of interest of the historical food image, and extracts the coordinates of the edge pixels of the region of interest to obtain the predicted coordinates of the divided region, and utilizes the image recognition network to identify the food category of the marked region of interest to obtain the corresponding food category prediction value.

[0067] Optionally, in the embodiment of the present invention, the region extraction network is an RPN (Region Proposal Network), and the image recognition network is a convolutional neural network.

[0068] determining a food category true value according to the food category;

[0069] For example: if the food category is "vegetables", then the corresponding true value of the food category is: vegetables: 1.

[0070] Calculate the classification loss value by using a preset first loss function according to the actual value of the food category and the predicted value of the food category;

[0071] Calculating the area division loss value by using a preset second loss function according to the division area coordinates and the prediction area coordinates;

[0072] Optionally, in the embodiment of the present invention, the first loss function and the second loss function may be: a logarithmic loss function, a square loss function, a cross entropy loss function, etc.

[0073] A target loss value is obtained by calculating the annotation loss value and the region division loss value;

[0074] When the target loss value is greater than a preset loss threshold, the model parameters of the initial picture segmentation model are adjusted, and the process returns to the step of selecting historical food pictures from the historical food picture set to input the preset initial picture segmentation model; when the target loss value is not greater than the preset loss threshold, the initial picture segmentation model is output to obtain the picture segmentation model.

[0075] Furthermore, an embodiment of the present invention uses the image segmentation model to divide and identify food areas in the image to be identified, obtain food categories in different divided areas and corresponding divided area analysis coordinates, divide the image within the closed area formed by connecting all coordinate points in the divided area analysis coordinates in the image to be identified, obtain the segmented food image, and associate the food category with the corresponding segmented food image, such as: using the food category to mark the segmented food image.

[0076] In detail, in the embodiment of the present invention, the image segmentation model is used to divide and identify the food areas of the image to be identified, and the food categories of different divided areas and the corresponding divided area analysis coordinates are obtained, including:

[0077] Using the region extraction network in the image segmentation model to mark the region of interest in the image to be identified, to obtain the corresponding divided region;

[0078] Using the image recognition network in the image segmentation model to identify the food category of the divided area, to obtain the corresponding food category;

[0079] The coordinates of the area edge pixels of the divided area are obtained to obtain the corresponding analysis coordinates of the divided area.

[0080] S3, obtaining one or more food recognition models and the recognition category corresponding to each of the food recognition models, and selecting a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain a corresponding food name;

[0081] Specifically, the food recognition model described in the embodiment of the present invention is an artificial intelligence model that has been trained to recognize and classify different types of food. Each of the food recognition models can recognize different types of food. For example, if the recognition category corresponding to food recognition model A is fruit, then the food recognition model A can recognize various fruits. Optionally, the food recognition model described in the embodiment of the present invention is a convolutional neural network model.

[0082] Furthermore, in the embodiment of the present invention, a food recognition model corresponding to the food category and the recognition category is selected to perform food recognition on each of the segmented food images to obtain a corresponding food name, including:

[0083] Select the recognition category that is the same as the food category to which each of the segmented food images belongs, to obtain a target recognition category;

[0084] Selecting a food recognition model corresponding to the target recognition category to obtain a target food recognition model;

[0085] The target food recognition model is used to recognize the corresponding segmented food pictures to obtain the food names corresponding to the segmented food pictures.

[0086] For example: the food category corresponding to the segmented food picture A is "fruit", then the food recognition model with the recognition category of "fruit" is selected from all the food recognition models as the target food recognition model for the segmented food picture A, and the target food recognition model is used to identify the food in the segmented food picture A to obtain the corresponding food name.

[0087] Furthermore, in an embodiment of the present invention, a set of historically recognized food pictures of a preset recognition category is obtained, wherein the set of historically recognized food pictures contains different historically recognized pictures, and the historically recognized pictures are all pictures of food corresponding to the preset recognition category, and the parameters of the historically recognized pictures and the segmented food pictures are the same but the contents are different, and each of the historically recognized pictures has a label of a corresponding historical food name, and the pre-constructed convolutional neural network model is iteratively trained using the set of historically recognized food pictures to obtain the food recognition model, including:

[0088] Step A: using the convolutional neural network model to perform a preset number of convolution pooling operations on the historically identified food picture set to obtain a feature set;

[0089] In detail, in an embodiment of the present invention, the historical food recognition picture set is input into the input layer of the convolutional neural network model. Furthermore, the convolution layer of the hidden layer of the convolutional neural network model convolves each historical food picture in the historical food recognition picture set to obtain a convolutional data set. The pooling layer of the convolutional neural network model then pools the convolutional data to obtain feature data, and all the feature data are aggregated to obtain the feature set.

[0090] Step B: Calculate each feature data in the feature set using a preset activation function to obtain a food name prediction value for each feature data;

[0091] Optionally, the activation function in the embodiment of the present invention is a Softmax function

[0092] Step C: Calculate the historical food name to confirm the true value of the food name, and use a pre-constructed loss function to calculate the loss value between the true value of the food name and the predicted value of the food name;

[0093] For example, if the historical food name is “apple”, then the actual value of the food name corresponding to “apple” is 1.

[0094] Step D: If the loss value is greater than or equal to the preset threshold, update the parameters of the convolutional neural network model and return to the above step A;

[0095] Step E: If the loss value is less than a preset threshold, the food recognition model is obtained and output.

[0096] In detail, the convolution and pooling operation includes: a convolution operation and a pooling operation.

[0097] Preferably, the pooling operation in the embodiment of the present invention is to perform an average pooling operation on the convolution data set to obtain the feature set.

[0098] Optionally, the loss function in the embodiment of the present invention includes: an absolute value loss function, a square loss function, a cross entropy loss function, etc.

[0099] In detail, in the embodiment of the present invention, the target food recognition model is used to recognize the corresponding segmented food image to obtain the food name corresponding to the segmented food image, including:

[0100] Using the target food recognition model, convolution pooling is performed on the corresponding segmented food image to obtain corresponding segmentation feature data;

[0101] Calculating the segmentation feature data using a preset activation function to obtain recognition probabilities of different preset types of food;

[0102] Select the name of the preset type of food corresponding to the largest recognition probability to obtain the food name. S4, query the nutritional components of the corresponding food in a preset food nutritional component database according to the food name to obtain a nutritional component subset;

[0103] In the embodiment of the present invention, the food nutrient database is a database containing nutrient data of different foods. The nutrient data can be data of all nutrient components of food or data of nutrient components of a specific category, such as the nutrient count can be data of vitamins contained in food.

[0104] Furthermore, the embodiment of the present invention uses the food name as a query condition to query in the preset food nutrition database to obtain the corresponding food nutrition information, extracts all the nutrients in each of the food nutrition information and summarizes them to obtain the nutrition subset.

[0105] In another embodiment of the present invention, the nutrient subset can be stored in a blockchain node, utilizing the high throughput characteristics of the blockchain node to improve data access efficiency.

[0106] S5, performing set operations on all the nutrient component subsets to obtain a nutrient component set;

[0107] In detail, in the embodiment of the present invention, all nutrients in all the nutrient component subsets are summarized, and all the summarized nutrients are deduplicated to obtain the nutrient component set.

[0108] In another embodiment of the present invention, a union operation is performed on all the nutrient component subsets to obtain the nutrient component set.

[0109] For example: there are nutrient subsets A and B, nutrient subset A is {vitamin A, vitamin B}, nutrient subset B is {vitamin B, vitamin C}, then after the union operation of nutrient subset A and nutrient subset B, the resulting nutrient set is {vitamin A, vitamin B, vitamin C}.

[0110] S6. Obtain a standard dietary nutrient component set, perform missing nutrient analysis based on the standard dietary nutrient component set and the nutrient component set, and obtain nutrients to be supplemented.

[0111] In an embodiment of the present invention, an intersection operation is performed on the standard dietary nutrient set and the nutrient set to obtain an analysis nutrient set, and the complement of the analysis nutrient set in the standard dietary nutrient set is calculated to obtain a corresponding target nutrient set. For example, the analysis nutrient set is {vitamin A, vitamin C}, and the standard dietary nutrient set is a nutrient set {vitamin A, vitamin B, vitamin C}, then the complement of the analysis nutrient set in the standard dietary nutrient set is {vitamin C}, all nutrients in the target nutrient set are extracted to obtain the nutrients to be supplemented, and the missing nutrients are pushed to the user. The user can adjust the diet more specifically according to the missing nutrients. In another embodiment of the present invention, foods or food combinations containing all nutrients in the target nutrient set can also be selected and recommended to the user.

[0112] like Figure 2 The figure shows a functional module diagram of the food nutrient component analysis device of the present invention.

[0113] The food nutrient component analysis device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the food nutrient component analysis device can include an image processing module 101, a food recognition module 102, and a nutrient analysis module 103. The modules described in the present invention can also be referred to as units, which refer to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, and are stored in the memory of the electronic device.

[0114] In this embodiment, the functions of each module / unit are as follows:

[0115] The image processing module is used to obtain the food image to be identified, perform interference removal processing on the food image to be identified, and obtain a standard food image;

[0116] The food recognition module is used to segment and classify the food regions of the standard food images using a pre-built image segmentation model to obtain segmented food images and corresponding food categories; obtain one or more food recognition models and the recognition category corresponding to each of the food recognition models, select a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain the corresponding food name;

[0117] The nutritional analysis module is used to query the nutritional components of the corresponding food in a preset food nutritional component database according to the food name to obtain a nutritional component subset; perform set operations on all the nutritional component subsets to obtain a nutritional component set; obtain a standard dietary nutritional component set, perform missing nutritional analysis based on the standard dietary nutritional component set and the nutritional component set, and obtain nutritional components to be supplemented.

[0118] In detail, each module described in the food nutrition component analysis device 100 in the embodiment of the present invention is used in the same manner as described above. Figure 1 The technical means are the same as the food nutritional component analysis method described in and can produce the same technical effects, so they will not be repeated here.

[0119] like Figure 2 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing the method for analyzing food nutritional components of the present invention.

[0120] The electronic device may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a food nutrient analysis program.

[0121] Wherein, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. The memory 11 may be an internal storage unit of an electronic device in some embodiments, such as a mobile hard disk of the electronic device. The memory 11 may also be an external storage device of an electronic device in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device, such as the code of a food nutrient analysis program, but also be used to temporarily store data that has been output or is to be output.

[0122] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules (such as food nutrient analysis programs, etc.) stored in the memory 11, and calls data stored in the memory 11 to execute various functions of the electronic device and process data.

[0123] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The communication bus 12 is configured to realize connection and communication between the memory 11 and at least one processor 10, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0124] Figure 2 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 2The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0125] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure classification circuits, power converters or inverters, power status indicators, etc. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0126] Optionally, the communication interface 13 may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.

[0127] Optionally, the communication interface 13 may also include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.

[0128] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0129] The food nutrition component analysis program stored in the memory 11 in the electronic device is a combination of multiple computer programs. When running in the processor 10, it can achieve:

[0130] Acquire a food picture to be identified, and perform interference removal processing on the food picture to be identified to obtain a standard food picture;

[0131] Using a pre-built image segmentation model to segment and classify the food regions of the standard food image, to obtain segmented food images and corresponding food categories;

[0132] Obtain one or more food recognition models and the recognition category corresponding to each of the food recognition models, and select a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain a corresponding food name;

[0133] According to the food name, query the nutritional components of the corresponding food in a preset food nutritional component database to obtain a nutritional component subset;

[0134] Performing a set operation on all the nutrient component subsets to obtain a nutrient component set;

[0135] A standard dietary nutrient component set is obtained, and a missing nutrient analysis is performed based on the standard dietary nutrient component set and the nutrient component set to obtain the nutrient components to be supplemented.

[0136] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0137] Furthermore, if the module / unit integrated in the electronic device 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. The computer-readable medium can be non-volatile or volatile. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM).

[0138] An embodiment of the present invention may further provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program may implement:

[0139] Acquire a food picture to be identified, and perform interference removal processing on the food picture to be identified to obtain a standard food picture;

[0140] Using a pre-built image segmentation model to segment and classify the food regions of the standard food image, to obtain segmented food images and corresponding food categories;

[0141] Obtain one or more food recognition models and the recognition category corresponding to each of the food recognition models, and select a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain a corresponding food name;

[0142] According to the food name, query the nutritional components of the corresponding food in a preset food nutritional component database to obtain a nutritional component subset;

[0143] Performing a set operation on all the nutrient component subsets to obtain a nutrient component set;

[0144] A standard dietary nutrient component set is obtained, and a missing nutrient analysis is performed based on the standard dietary nutrient component set and the nutrient component set to obtain the nutrient components to be supplemented.

[0145] Furthermore, the computer-usable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0146] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0147] The modules described as separate components may or may not be physically separated, and the components shown as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0148] 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.

[0149] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, 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 hardware plus software functional modules.

[0150] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0151] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0152] The blockchain referred to in the present invention is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.

[0153] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.

[0154] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for analyzing food nutritional components, characterized in that: The method comprises: Acquire a food picture to be identified, and perform interference removal processing on the food picture to be identified to obtain a standard food picture; The method comprises the following steps: using a pre-built image segmentation model to segment and classify the food regions of the standard food images to obtain segmented food images and corresponding food categories, including: using a region extraction network in the image segmentation model to mark the region of interest in the image to be identified to obtain one or more segmented regions, using an image recognition network in the image segmentation model to identify the food category of each segmented region, obtaining the coordinates of the region edge pixels of each segmented region to obtain the analysis coordinates of each segmented region, and segmenting the image within a closed region formed by connecting all coordinate points in the analysis coordinates of each segmented region to obtain the segmented food image; Obtain one or more food recognition models and the recognition category corresponding to each of the food recognition models, and select a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain a corresponding food name; According to the food name, query the nutritional components of the corresponding food in a preset food nutritional component database to obtain a nutritional component subset; Performing a set operation on all the nutrient component subsets to obtain a nutrient component set; A standard dietary nutrient component set is obtained, and a missing nutrient analysis is performed based on the standard dietary nutrient component set and the nutrient component set to obtain the nutrient components to be supplemented.

2. The method for analyzing food nutrients according to claim 1, wherein: The step of selecting a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain a corresponding food name includes: Select the recognition category that is the same as the food category to which each of the segmented food images belongs, to obtain a target recognition category; Selecting a food recognition model corresponding to the target recognition category to obtain a target food recognition model; Using the target food recognition model, convolution pooling is performed on the corresponding segmented food image to obtain corresponding segmentation feature data; Calculating the segmentation feature data using a preset activation function to obtain recognition probabilities of different preset types of food; The name of the preset type of food corresponding to the largest recognition probability is selected to obtain the food name.

3. The method for analyzing food nutrients according to claim 1, wherein: The step of querying the nutritional components of the corresponding food in a preset food nutritional component database according to the food name to obtain a nutritional component subset includes: Using the food name as a query condition to query in the preset food nutrition database, to obtain the corresponding food nutrition information; All the nutrients in the nutrient component information of each food are extracted and summarized to obtain the nutrient component subset.

4. The method for analyzing food nutrients according to claim 1, wherein: The step of performing a set operation on all the nutrient component subsets to obtain a nutrient component set includes: Aggregating all nutrients in all of said nutrient subsets; All the aggregated nutrients are deduplicated to obtain the nutrient set.

5. The method for analyzing food nutritional components according to any one of claims 1 to 4, characterized in that: The step of performing a missing nutrient analysis based on the standard dietary nutrient component set and the nutrient component set to obtain the nutrient components to be supplemented includes: Performing an intersection operation on the standard dietary nutrient component set and the nutrient component set to obtain an analysis nutrient component set; Calculating the complement of the analyzed nutrient component set in the standard dietary nutrient component set to obtain a target nutrient component set; All nutrients in the target nutrient set are extracted to obtain the nutrients to be supplemented.

6. A food nutritional component analysis device, characterized in that: include: An image processing module is used to obtain a picture of food to be identified, and to perform interference removal processing on the picture of food to be identified to obtain a standard food picture; A food recognition module is used to segment and classify the food regions of the standard food images using a pre-built image segmentation model to obtain segmented food images and corresponding food categories, including: using a region extraction network in the image segmentation model to mark the region of interest in the image to be identified to obtain one or more segmented regions, using an image recognition network in the image segmentation model to identify the food category of each segmented region, obtaining the coordinates of the regional edge pixels of each segmented region to obtain the analysis coordinates of each segmented region, and segmenting the image within a closed region formed by connecting all coordinate points in the analysis coordinates of each segmented region to obtain the segmented food image; Obtain one or more food recognition models and the recognition category corresponding to each of the food recognition models, and select a corresponding food recognition model according to the food category and the recognition category to perform food recognition on each of the segmented food images to obtain a corresponding food name; The nutrition analysis module is used to query the nutrition components of the corresponding food in a preset food nutrition component database according to the food name to obtain a nutrition component subset; perform set operation on all the nutrition component subsets to obtain a nutrition component set; obtain a standard dietary nutrition component set, perform missing nutrition analysis based on the standard dietary nutrition component set and the nutrition component set, and obtain the nutrition components to be supplemented.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; Wherein, the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the food nutrient analysis method as described in any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the food nutritional component analysis method according to any one of claims 1 to 5 is implemented.