AI nutrition and health management service system and method
By designing the AI nutrition and health management service system, using food photos and deep images to identify the food types and quality, analyzing user health data, calculating the matching degree of catering provider units, and formulating supplementary nutrition navigation routes for users, solving the existing technology The problem of user health status was not fully considered, and targeted recommendation and navigation services were achieved for catering units, improving users' nutritional and healthy levels and quality of life.
Patent Information
- Application Number
- CN202411686055.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-24
- Publication Date
- 2025-02-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing catering service software system fails to fully consider the user's personal physical health and is unable to provide targeted recommendation and navigation services for catering units, making it difficult for users to improve their nutritional and healthy levels and quality of life.
An AI nutrition and health management service system was designed, including daily diet type recording module, daily diet type quality estimation module, physical condition recording analysis module, nutrition diet matching module and healthy diet navigation module, and food is recognized by taking food photos and deep images. Type and quality, analyze user health data, calculate the matching degree of catering provision units, and formulate supplementary nutrition navigation routes for users.
It has achieved targeted recommendation and navigation services for catering units based on the user's physical nutritional and health status, and improved the user's nutritional and health level and quality of life.
Smart Images

Figure CN119418864A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software information technology, and in particular to an AI nutrition and health management service system and method. Background Art
[0002] The existing catering service software system can provide meal purchase and store navigation functions, but it fails to fully consider the user's personal health status. Users need more advanced software products that can recommend the best catering unit according to the user's health status and improve the user's nutritional health level and quality of life. Summary of the invention
[0003] In order to provide targeted catering unit recommendations and navigation services according to the user's physical nutritional health status, the present invention designs an AI nutritional health management service system and method.
[0004] The technical solution adopted by the present invention is an AI nutrition and health management service system: It includes daily diet type recording module, daily diet type quality estimation module, physical condition recording and analysis module, nutritional diet matching module and healthy diet navigation module.
[0005] The daily diet type recording module helps users record the types of ingredients in their daily diet at home by taking photos of the ingredients. The specific method is as follows: A1, create a food image library, collect images of various foods, and annotate the food types in the images.
[0006] A2, select the existing pre-trained model VGG16 as the base model, and add a fully connected layer to the model VGG16: ① Input layer: resize the image to 224×224 pixels, scale the pixel values to [0,1], and input the resized image.
[0007] ②Convolutional layer and pooling layer: According to the structure of VGG16, multiple groups of convolutional layers and pooling layers are added, each group contains multiple convolutional layers and one pooling layer; The convolution layer is used to extract image features, and the pooling layer is used to reduce the dimension and computational complexity of the feature map. A 3×3 pixel convolution kernel is used for convolution, and a ReLU activation function f(x)=max(0,x) is used after each convolution layer. When the input value x is greater than zero, the output of ReLU is x, and when x is less than or equal to zero, the output is zero. The convolution layer slides the entire image through the convolution kernel to generate multiple feature maps. The pooling layer uses maximum pooling to take the maximum value in each 2×2 area to reduce the size of the feature map. For example, after using maximum pooling, the 224×224 feature map is reduced to 112×112; the pooling layer reduces the dimension of the feature map to reduce the amount of calculation and prevent overfitting; Finally, the multi-dimensional feature map is flattened into a one-dimensional vector so that it can be connected to the subsequent fully connected layer; for example, if a set of 64 7×7 feature maps is obtained after convolution and pooling, a one-dimensional vector of length 7×7×64=3136 will be obtained after flattening.
[0008] ③Fully connected layer: The features extracted by the previous layer are integrated for final classification; each input feature is connected to each neuron in the fully connected layer, each neuron calculates the weighted sum and adds a bias, and the linear combination of neurons outputs z=W×y+b, where W is the weight matrix, y is the input feature vector, and b is the bias; The ReLU activation function is used again after the fully connected layer. The purpose of using ReLU here is to set negative values to zero, further promoting the effective learning and recognition of complex features by the neural network.
[0009] ④Output layer: Use Softmax activation function ; Output the probability of each food category, where z i is the output of the fully connected layer, where the numerator represents the strength of category i, and the denominator represents the sum of the strengths of all categories, a total of n. i is the predicted probability of each food category.
[0010] A3, training model to optimize model parameters, divide the data set into 70% training set, 15% validation set, and 15% test set. Use the training set and validation set for training, and use the test set to evaluate the model accuracy. Stop training when the accuracy reaches the set threshold.
[0011] A4, using the trained model to identify and record the food type represented by the food pixel elements in the food photos taken by the user.
[0012] The daily diet type quality estimation module helps users estimate the quality of various ingredients in their daily diet at home by taking depth images of the ingredients. The specific method is as follows: B1, use a mobile phone equipped with a depth-sensing camera (such as a TOF camera) to horizontally shoot one side image and the other side image of the food, identify the food pixel element based on A4, and assume that the straight-line distance between the optical center of the lens of the depth-sensing camera and the actual food represented by each food pixel element in the image is L k , each food pixel corresponds to an L k, k is an integer starting from 1, and the maximum integer of k is the total number of food pixels contained in the image; the straight-line distance between the optical center of the lens of the depth-sensing camera and the image sensor is Q, the image collected by the image sensor is scaled β times and displayed on the mobile phone display, the width of the mobile phone display area is G, and the number of pixels per row on the mobile phone screen is m, then The width of each pixel on the display is G÷m. The width of each pixel on the image sensor is G÷m÷β, Because the actual food width d represented by each food pixel on the display divided by the width of each pixel on the image sensor (G ÷ m ÷ β) is equal to L k ÷Q, so the estimated volume of the actual food represented by each food pixel on the display screen is V=d 3 =[(G×L k )÷(m×β×Q)] 3 .
[0013] B2, let L be the farthest horizontal straight-line distance between the optical center of the depth-sensing camera lens and a certain surface of the food. max , then the sum of the food volumes contained in the horizontal and vertical arrangements of the food pixels in the image on the display is estimated to be [floor(L max -L k )]×[(G×L k )÷(m×β×Q)] 3 ; The floor() function is a rounding function; In this way, the sum of the volumes of all the pixel elements of the food in the two food depth images arranged horizontally and vertically is the total volume V0 of the food.
[0014] B3, create a food density database, including food types and corresponding densities.
[0015] B4, multiply the total volume of the food by its density to calculate the mass of the food.
[0016] The physical condition recording and analysis module is used to record the user's health data and analyze the nutritional deficiency status, specifically in the following ways: C1, collects the user's heart rate, blood oxygen saturation, body temperature, blood pressure, blood sugar, and sleep data through health monitoring devices worn by the user, such as health bracelets, medical bracelets, smart watches, etc.
[0017] C2, create a food nutrition database, including food types and corresponding nutrition types and their mass proportions. Nutrition types include carbohydrates, fats, proteins, vitamins, and minerals.
[0018] C3, create a minimum standard library for nutritional intake, including the minimum standard quality of daily intake of five nutritional types: carbohydrates, fats, proteins, vitamins, and minerals under different genders, weights, and ages.
[0019] C4, the user enters his / her gender, weight, and age in the system; When the user's carbohydrate intake quality is lower than the minimum standard for three consecutive days, and the heart rate is lower than 60 beats / min and the fasting blood sugar is lower than 3.9mmol / L in a resting state, it is determined that the user needs to supplement carbohydrates; When the user's fat intake quality is lower than the minimum standard for three consecutive days, and the diastolic blood pressure is lower than 60 mmHg and the blood oxygen saturation is lower than 95% in a resting state, it is determined that the user needs to supplement fat; If the user's protein intake quality is lower than the minimum standard for three consecutive days, and the body temperature is lower than 36°C, and the number of awakenings during the last night's sleep exceeds 2 times, the user is judged to need protein supplementation; When the user's vitamin intake quality is lower than the minimum standard for three consecutive days, and the heart rate fluctuation value in a quiet state exceeds 15 times / minute and the blood oxygen saturation is lower than 95%, it is determined that the user needs vitamin supplementation; When the quality of a user's mineral intake is lower than the minimum standard for three consecutive days, and the fasting blood sugar fluctuation value exceeds 1.5mmol / L and the diastolic blood pressure in a resting state is lower than 60mmHg, the user is judged to need mineral supplementation.
[0020] The nutrition and diet matching module calculates the matching degree of the catering provider according to the user's nutritional deficiency status, specifically in the following manner: D1, encodes the user's nutritional deficiency status from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. When a certain nutrient is lacking, a value of 1 is assigned, otherwise a value of 0 is assigned; for example, if the user only lacks carbohydrates and proteins, then the user's nutritional deficiency status U=10100.
[0021] D2, encode the nutritional status of the catering unit from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. If a certain nutrient can be provided, it is assigned a value of 1, otherwise it is assigned a value of 0. For example, if the catering menu of a catering unit only contains fat and protein, then the nutritional status of this catering unit is R=01100. When the carbohydrate content in 100 grams of food is greater than or equal to 15 grams, the food is judged to provide carbohydrates, otherwise it is judged that the food does not provide carbohydrates; When the fat content in 100 grams of food is greater than or equal to 5 grams, the food is judged to provide fat, otherwise it is judged that the food does not provide fat; When the protein content in 100 grams of food is greater than or equal to 10 grams, it is judged to provide protein, otherwise it is judged to not provide protein; When the content of vitamin A in 100 grams of food is greater than or equal to 50 micrograms, or the content of vitamin C is greater than or equal to 30 milligrams, or the content of vitamin D is greater than or equal to 1 microgram, or the content of vitamin B1 is greater than or equal to 0.6 milligrams, or the content of vitamin B2 is greater than or equal to 0.6 milligrams, it is determined that vitamins can be provided; otherwise, it is determined that vitamins cannot be provided; When the calcium content in 100 grams of food is greater than or equal to 100 mg, or the iron content is greater than or equal to 1.5 mg, or the zinc content is greater than or equal to 1.5 mg, or the potassium content is greater than or equal to 200 mg, it is judged that it can provide minerals; otherwise, it is judged that it cannot provide minerals.
[0022] D3, calculate the matching degree H between the user's nutritional deficiency status U and the nutritional status R provided by the catering provider: Suppose the five digits from left to right in the user's nutritional deficiency status U are U1, U2, U3, U4, U5; the five digits from left to right in the nutritional status R of the catering provider are R1, R2, R3, R4, R5; the total number of 1s in U is |U|, then H=[(U1×R1+U2×R2+U3×R3+U4×R4+U5×R5)÷|U|]×100%.
[0023] |U| of pure water=0, and the food that can be provided by the catering provider in the present invention does not contain pure water.
[0024] The healthy diet navigation module formulates a nutritional supplement navigation route for the user according to the nutritional health status of the user, specifically in the following ways: E1, the maximum straight-line distance T of the catering provider that the user can set max ; Assume that the real-time straight-line distance between the user and the surrounding catering providers is T, then according to H×[1-(T÷T max )] Recommend catering providers to users in descending order of values.
[0025] E2, generates a navigation route between the user and the most highly ranked catering provider based on an electronic map.
[0026] An AI nutrition and health management service method: Step 1: Users can record the types of ingredients in their daily diet by taking photos of the ingredients. The specific method is as follows: A1, create a food image library, collect images of various foods, and annotate the food types in the images.
[0027] A2, select the existing pre-trained model VGG16 as the base model, and add a fully connected layer to the model VGG16: ① Input layer: resize the image to 224×224 pixels, scale the pixel values to [0,1], and input the resized image.
[0028] ②Convolutional layer and pooling layer: According to the structure of VGG16, multiple groups of convolutional layers and pooling layers are added, each group contains multiple convolutional layers and one pooling layer; The convolution layer is used to extract image features, and the pooling layer is used to reduce the dimension and computational complexity of the feature map. A 3×3 pixel convolution kernel is used for convolution, and a ReLU activation function f(x)=max(0,x) is used after each convolution layer. When the input value x is greater than zero, the output of ReLU is x, and when x is less than or equal to zero, the output is zero. The convolution layer slides the entire image through the convolution kernel to generate multiple feature maps. The pooling layer uses maximum pooling to take the maximum value in each 2×2 area to reduce the size of the feature map. For example, after using maximum pooling, the 224×224 feature map is reduced to 112×112; the pooling layer reduces the dimension of the feature map to reduce the amount of calculation and prevent overfitting; Finally, the multi-dimensional feature map is flattened into a one-dimensional vector so that it can be connected to the subsequent fully connected layer; for example, if a set of 64 7×7 feature maps is obtained after convolution and pooling, a one-dimensional vector of length 7×7×64=3136 will be obtained after flattening.
[0029] ③Fully connected layer: The features extracted by the previous layer are integrated for final classification; each input feature is connected to each neuron in the fully connected layer, each neuron calculates the weighted sum and adds a bias, and the linear combination of neurons outputs z=W×y+b, where W is the weight matrix, y is the input feature vector, and b is the bias; The ReLU activation function is used again after the fully connected layer. The purpose of using ReLU here is to set negative values to zero, further promoting the effective learning and recognition of complex features by the neural network.
[0030] ④Output layer: Use Softmax activation function ; Output the probability of each food category, where z i is the output of the fully connected layer, where the numerator represents the strength of category i, and the denominator represents the sum of the strengths of all categories, a total of n. i is the predicted probability of each food category.
[0031] A3, training model to optimize model parameters, divide the data set into 70% training set, 15% validation set, and 15% test set. Use the training set and validation set for training, and use the test set to evaluate the model accuracy. Stop training when the accuracy reaches the set threshold.
[0032] A4, using the trained model to identify and record the food type represented by the food pixel elements in the food photos taken by the user.
[0033] Step 2: The user estimates the quality of various ingredients in daily home diet by taking depth images of the ingredients. The specific method is as follows: B1, use a mobile phone equipped with a depth-sensing camera (such as a TOF camera) to horizontally shoot one side image and the other side image of the food, identify the food pixel element based on A4, and assume that the straight-line distance between the optical center of the lens of the depth-sensing camera and the actual food represented by each food pixel element in the image is L k , each food pixel corresponds to an L k , k is an integer starting from 1, and the maximum integer of k is the total number of food pixels contained in the image; the straight-line distance between the optical center of the lens of the depth-sensing camera and the image sensor is Q, the image collected by the image sensor is scaled β times and displayed on the mobile phone display, the width of the mobile phone display area is G, and the number of pixels per row on the mobile phone screen is m, then The width of each pixel on the display is G÷m. The width of each pixel on the image sensor is G÷m÷β, Because the actual food width d represented by each food pixel on the display divided by the width of each pixel on the image sensor (G ÷ m ÷ β) is equal to L k ÷Q, so the estimated volume of the actual food represented by each food pixel on the display screen is V=d 3 =[(G×L k )÷(m×β×Q)] 3 .
[0034] B2, let L be the farthest horizontal straight-line distance between the optical center of the depth-sensing camera lens and a certain surface of the food. max , then the sum of the food volumes contained in the horizontal and vertical arrangements of the food pixels in the image on the display is estimated to be [floor(L max -L k )]×[(G×L k )÷(m×β×Q)] 3 ; The floor() function is a rounding function; In this way, the sum of the volumes of all the pixel elements of the food in the two food depth images arranged horizontally and vertically is the total volume V0 of the food.
[0035] B3, create a food density database, including food types and corresponding densities.
[0036] B4, multiply the total volume of the food by its density to calculate the mass of the food.
[0037] Step 3: Record user health data and analyze nutritional deficiencies. The specific method is as follows: C1, collects the user's heart rate, blood oxygen saturation, body temperature, blood pressure, blood sugar, and sleep data through health monitoring devices worn by the user, such as health bracelets, medical bracelets, smart watches, etc.
[0038] C2, create a food nutrition database, including food types and corresponding nutrition types and their mass proportions. Nutrition types include carbohydrates, fats, proteins, vitamins, and minerals.
[0039] C3, create a minimum standard library for nutritional intake, including the minimum standard quality of daily intake of five nutritional types: carbohydrates, fats, proteins, vitamins, and minerals under different genders, weights, and ages.
[0040] C4, the user enters his / her gender, weight, and age in the system; When the user's carbohydrate intake quality is lower than the minimum standard for three consecutive days, and the heart rate is lower than 60 beats / min and the fasting blood sugar is lower than 3.9mmol / L in a resting state, it is determined that the user needs to supplement carbohydrates; When the user's fat intake quality is lower than the minimum standard for three consecutive days, and the diastolic blood pressure is lower than 60 mmHg and the blood oxygen saturation is lower than 95% in a resting state, it is determined that the user needs to supplement fat; If the user's protein intake quality is lower than the minimum standard for three consecutive days, and the body temperature is lower than 36°C, and the number of awakenings during the last night's sleep exceeds 2 times, the user is judged to need protein supplementation; When the user's vitamin intake quality is lower than the minimum standard for three consecutive days, and the heart rate fluctuation value in a quiet state exceeds 15 times / minute and the blood oxygen saturation is lower than 95%, it is determined that the user needs vitamin supplementation; When the quality of a user's mineral intake is lower than the minimum standard for three consecutive days, and the fasting blood sugar fluctuation value exceeds 1.5mmol / L and the diastolic blood pressure in a resting state is lower than 60mmHg, the user is judged to need mineral supplementation.
[0041] Step 4: Calculate the matching degree of the catering provider according to the user's nutritional deficiency status. The specific method is as follows: D1, encodes the user's nutritional deficiency status from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. When a certain nutrient is lacking, a value of 1 is assigned, otherwise a value of 0 is assigned; for example, if the user only lacks carbohydrates and proteins, then the user's nutritional deficiency status U=10100.
[0042] D2, encode the nutritional status of the catering unit from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. If a certain nutrient can be provided, it is assigned a value of 1, otherwise it is assigned a value of 0. For example, if the catering menu of a catering unit only contains fat and protein, then the nutritional status of this catering unit is R=01100. When the carbohydrate content in 100 grams of food is greater than or equal to 15 grams, the food is judged to provide carbohydrates, otherwise it is judged that the food does not provide carbohydrates; When the fat content in 100 grams of food is greater than or equal to 5 grams, the food is judged to provide fat, otherwise it is judged that the food does not provide fat; When the protein content in 100 grams of food is greater than or equal to 10 grams, it is judged to provide protein, otherwise it is judged to not provide protein; When the content of vitamin A in 100 grams of food is greater than or equal to 50 micrograms, or the content of vitamin C is greater than or equal to 30 milligrams, or the content of vitamin D is greater than or equal to 1 microgram, or the content of vitamin B1 is greater than or equal to 0.6 milligrams, or the content of vitamin B2 is greater than or equal to 0.6 milligrams, it is determined that vitamins can be provided; otherwise, it is determined that vitamins cannot be provided; When the calcium content in 100 grams of food is greater than or equal to 100 mg, or the iron content is greater than or equal to 1.5 mg, or the zinc content is greater than or equal to 1.5 mg, or the potassium content is greater than or equal to 200 mg, it is judged that it can provide minerals; otherwise, it is judged that it cannot provide minerals.
[0043] D3, calculate the matching degree H between the user's nutritional deficiency status U and the nutritional status R provided by the catering provider: Suppose the five digits from left to right in the user's nutritional deficiency status U are U1, U2, U3, U4, U5; the five digits from left to right in the nutritional status R of the catering provider are R1, R2, R3, R4, R5; the total number of 1s in U is |U|, then H=[(U1×R1+U2×R2+U3×R3+U4×R4+U5×R5)÷|U|]×100%.
[0044] |U| of pure water=0, and the food that can be provided by the catering provider in the present invention does not contain pure water.
[0045] Step 5: formulate a nutritional supplement navigation route for the user based on the user's nutritional health status. The specific method is as follows: E1, the maximum straight-line distance T of the catering provider that the user can set max ; Assume that the real-time straight-line distance between the user and the surrounding catering providers is T, then according to H×[1-(T÷T max )] Recommend catering providers to users in descending order of values.
[0046] E2, generates a navigation route between the user and the most highly ranked catering provider based on an electronic map.
[0047] The principle of the present invention is that the VGG16 model has a simple structure and the pre-trained model performs well on a small data set. The pre-trained model is used for transfer learning, which can speed up the training speed and improve the accuracy.
[0048] In the process of taking photos, light must pass through the optical center of the convex lens to form a clear image. The light reflected by the food passes through the lens of the mobile phone camera and is captured by the image sensor. The image sensor converts the light into an electrical signal, which is then scaled and processed to form a digital image on the display. According to the principle of similar triangles, d÷(G÷m÷β)=L k ÷Q, from which the d value can be calculated, and finally the volume of the food represented by each pixel on the display screen can be calculated. The depth sensing camera sends a short pulse to the object and then returns to the camera. The propagation speed of the short pulse is the speed of light. The distance L can be calculated by the time difference between the transmission and reception of the short pulse. k ; The image is captured by the depth-sensing camera, which outputs a depth map in which the depth value corresponding to each pixel represents the distance between the point on the object and the camera.
[0049] The AI nutrition and health management service system and method of the present invention has the following advantages: (1) By taking pictures of food ingredients, the food type is identified and the food quality is estimated, thereby inferring the nutritional type and quality of the user's daily diet at home. The idea is reasonable and reliable; (2) Analyze users’ nutritional deficiencies through their nutritional intake and health information, which is a novel and unique approach; (3) Design a matching formula between the user's nutritional deficiency status and the nutritional supply status of the catering provider, and design a recommendation formula for the catering provider, which is very creative.
[0050] Other features and advantages of the present invention will be set forth in the following description or may be learned by practicing the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The drawings are only for the purpose of illustrating particular embodiments and are not to be considered limiting of the present invention. Like reference symbols denote like components throughout the drawings.
[0052] Figure 1 It is a flow chart of the method of the present invention.
[0053] Figure 2 It is a geometric diagram of the transmission of light from food through the optical center of the lens to the image sensor.
[0054] Labels in the figure: a-lens of the depth-sensing camera. DETAILED DESCRIPTION
[0055] The following will further describe in detail an AI nutrition and health management service system and method of the present invention in conjunction with the accompanying drawings and embodiments.
[0056] The technical solution adopted by the present invention is an AI nutrition and health management service system: It includes daily diet type recording module, daily diet type quality estimation module, physical condition recording and analysis module, nutritional diet matching module and healthy diet navigation module.
[0057] The daily diet type recording module helps users record the types of ingredients in their daily diet at home by taking photos of the ingredients. The specific method is as follows: A1, create a food image library, collect images of various foods, and annotate the food types in the images.
[0058] A2, select the existing pre-trained model VGG16 as the base model, and add a fully connected layer to the model VGG16: ① Input layer: resize the image to 224×224 pixels, scale the pixel values to [0,1], and input the resized image.
[0059] ②Convolutional layer and pooling layer: According to the structure of VGG16, multiple groups of convolutional layers and pooling layers are added, each group contains multiple convolutional layers and one pooling layer; The convolution layer is used to extract image features, and the pooling layer is used to reduce the dimension and computational complexity of the feature map. A 3×3 pixel convolution kernel is used for convolution, and a ReLU activation function f(x)=max(0,x) is used after each convolution layer. When the input value x is greater than zero, the output of ReLU is x, and when x is less than or equal to zero, the output is zero. The convolution layer slides the entire image through the convolution kernel to generate multiple feature maps. The pooling layer uses maximum pooling to take the maximum value in each 2×2 area to reduce the size of the feature map. For example, after using maximum pooling, the 224×224 feature map is reduced to 112×112; the pooling layer reduces the dimension of the feature map to reduce the amount of calculation and prevent overfitting; Finally, the multi-dimensional feature map is flattened into a one-dimensional vector so that it can be connected to the subsequent fully connected layer; for example, if a set of 64 7×7 feature maps is obtained after convolution and pooling, a one-dimensional vector of length 7×7×64=3136 will be obtained after flattening.
[0060] ③Fully connected layer: The features extracted by the previous layer are integrated for final classification; each input feature is connected to each neuron in the fully connected layer, each neuron calculates the weighted sum and adds a bias, and the linear combination of neurons outputs z=W×y+b, where W is the weight matrix, y is the input feature vector, and b is the bias; The ReLU activation function is used again after the fully connected layer. The purpose of using ReLU here is to set negative values to zero, further promoting the effective learning and recognition of complex features by the neural network.
[0061] ④Output layer: Use Softmax activation function ; Output the probability of each food category, where z i is the output of the fully connected layer, where the numerator represents the strength of category i, and the denominator represents the sum of the strengths of all categories, a total of n. i is the predicted probability of each food category.
[0062] A3, training model to optimize model parameters, divide the data set into 70% training set, 15% validation set, and 15% test set. Use the training set and validation set for training, and use the test set to evaluate the model accuracy. Stop training when the accuracy reaches the set threshold.
[0063] A4, using the trained model to identify and record the food type represented by the food pixel elements in the food photos taken by the user.
[0064] The daily diet type quality estimation module helps users estimate the quality of various ingredients in their daily diet at home by taking depth images of the ingredients. The specific method is as follows: B1, use a mobile phone equipped with a depth-sensing camera (such as a TOF camera) to horizontally shoot one side image and the other side image of the food, identify the food pixel element based on A4, and assume that the straight-line distance between the optical center of the lens of the depth-sensing camera and the actual food represented by each food pixel element in the image is L k , each food pixel corresponds to an L k , k is an integer starting from 1, and the maximum integer of k is the total number of food pixels contained in the image; the straight-line distance between the optical center of the lens of the depth-sensing camera and the image sensor is Q, the image collected by the image sensor is scaled β times and displayed on the mobile phone display, the width of the mobile phone display area is G, and the number of pixels per row on the mobile phone screen is m, then The width of each pixel on the display is G÷m. The width of each pixel on the image sensor is G÷m÷β, like Figure 2 As shown, the actual food width d represented by each food pixel on the display screen divided by the width of each pixel on the image sensor (G ÷ m ÷ β) is equal to L k ÷Q, so the estimated volume of the actual food represented by each food pixel on the display screen is V=d 3 =[(G×L k )÷(m×β×Q)] 3 .
[0065] B2, let L be the farthest horizontal straight-line distance between the optical center of the depth-sensing camera lens and a certain surface of the food. max , then the sum of the food volumes contained in the horizontal and vertical arrangements of the food pixels in the image on the display is estimated to be [floor(L max -L k )]×[(G×L k )÷(m×β×Q)] 3 ; The floor() function is a rounding function; In this way, the sum of the volumes of all the pixel elements of the food in the two food depth images arranged horizontally and vertically is the total volume V0 of the food.
[0066] B3, create a food density database, including food types and corresponding densities.
[0067] B4, multiply the total volume of the food by its density to calculate the mass of the food.
[0068] The physical condition recording and analysis module is used to record the user's health data and analyze the nutritional deficiency status, specifically in the following ways: C1, collects the user's heart rate, blood oxygen saturation, body temperature, blood pressure, blood sugar, and sleep data through health monitoring devices worn by the user, such as health bracelets, medical bracelets, smart watches, etc.
[0069] C2, create a food nutrition database, including food types and corresponding nutrition types and their mass proportions. Nutrition types include carbohydrates, fats, proteins, vitamins, and minerals.
[0070] C3, create a minimum standard library for nutritional intake, including the minimum standard quality of daily intake of five nutritional types: carbohydrates, fats, proteins, vitamins, and minerals under different genders, weights, and ages.
[0071] C4, the user enters his / her gender, weight, and age in the system; When the user's carbohydrate intake quality is lower than the minimum standard for three consecutive days, and the heart rate is lower than 60 beats / min and the fasting blood sugar is lower than 3.9mmol / L in a resting state, it is determined that the user needs to supplement carbohydrates; When the user's fat intake quality is lower than the minimum standard for three consecutive days, and the diastolic blood pressure is lower than 60 mmHg and the blood oxygen saturation is lower than 95% in a resting state, it is determined that the user needs to supplement fat; If the user's protein intake quality is lower than the minimum standard for three consecutive days, and the body temperature is lower than 36°C, and the number of awakenings during the last night's sleep exceeds 2 times, the user is judged to need protein supplementation; When the user's vitamin intake quality is lower than the minimum standard for three consecutive days, and the heart rate fluctuation value in a quiet state exceeds 15 times / minute and the blood oxygen saturation is lower than 95%, it is determined that the user needs vitamin supplementation; When the quality of a user's mineral intake is lower than the minimum standard for three consecutive days, and the fasting blood sugar fluctuation value exceeds 1.5mmol / L and the diastolic blood pressure in a resting state is lower than 60mmHg, the user is judged to need mineral supplementation.
[0072] The nutrition and diet matching module calculates the matching degree of the catering provider according to the user's nutritional deficiency status, specifically in the following manner: D1, encodes the user's nutritional deficiency status from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. When a certain nutrient is lacking, a value of 1 is assigned, otherwise a value of 0 is assigned; for example, if the user only lacks carbohydrates and proteins, then the user's nutritional deficiency status U=10100.
[0073] D2, encode the nutritional status of the catering unit from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. If a certain nutrient can be provided, it is assigned a value of 1, otherwise it is assigned a value of 0. For example, if the catering menu of a catering unit only contains fat and protein, then the nutritional status of this catering unit is R=01100. When the carbohydrate content in 100 grams of food is greater than or equal to 15 grams, the food is judged to provide carbohydrates, otherwise it is judged that the food does not provide carbohydrates; When the fat content in 100 grams of food is greater than or equal to 5 grams, the food is judged to provide fat, otherwise it is judged that the food does not provide fat; When the protein content in 100 grams of food is greater than or equal to 10 grams, it is judged to provide protein, otherwise it is judged to not provide protein; When the content of vitamin A in 100 grams of food is greater than or equal to 50 micrograms, or the content of vitamin C is greater than or equal to 30 milligrams, or the content of vitamin D is greater than or equal to 1 microgram, or the content of vitamin B1 is greater than or equal to 0.6 milligrams, or the content of vitamin B2 is greater than or equal to 0.6 milligrams, it is determined that vitamins can be provided; otherwise, it is determined that vitamins cannot be provided; When the calcium content in 100 grams of food is greater than or equal to 100 mg, or the iron content is greater than or equal to 1.5 mg, or the zinc content is greater than or equal to 1.5 mg, or the potassium content is greater than or equal to 200 mg, it is judged that it can provide minerals; otherwise, it is judged that it cannot provide minerals.
[0074] D3, calculate the matching degree H between the user's nutritional deficiency status U and the nutritional status R provided by the catering provider: Suppose the five digits from left to right in the user's nutritional deficiency status U are U1, U2, U3, U4, U5; the five digits from left to right in the nutritional status R of the catering provider are R1, R2, R3, R4, R5; the total number of 1s in U is |U|, then H=[(U1×R1+U2×R2+U3×R3+U4×R4+U5×R5)÷|U|]×100%.
[0075] |U| of pure water=0, and the food that can be provided by the catering provider in the present invention does not contain pure water.
[0076] The healthy diet navigation module formulates a nutritional supplement navigation route for the user according to the nutritional health status of the user, specifically in the following ways: E1, the maximum straight-line distance T of the catering provider that the user can set max ; Assume that the real-time straight-line distance between the user and the surrounding catering providers is T, then according to H×[1-(T÷T max )] Recommend catering providers to users in descending order of values.
[0077] E2, generates a navigation route between the user and the most highly ranked catering provider based on an electronic map.
[0078] like Figure 1 As shown, an AI nutrition and health management service method: Step 1: Users can record the types of ingredients in their daily diet by taking photos of the ingredients. The specific method is as follows: A1, create a food image library, collect images of various foods, and annotate the food types in the images.
[0079] A2, select the existing pre-trained model VGG16 as the base model, and add a fully connected layer to the model VGG16: ① Input layer: resize the image to 224×224 pixels, scale the pixel values to [0,1], and input the resized image.
[0080] ②Convolutional layer and pooling layer: According to the structure of VGG16, multiple groups of convolutional layers and pooling layers are added, each group contains multiple convolutional layers and one pooling layer; The convolution layer is used to extract image features, and the pooling layer is used to reduce the dimension and computational complexity of the feature map. A 3×3 pixel convolution kernel is used for convolution, and a ReLU activation function f(x)=max(0,x) is used after each convolution layer. When the input value x is greater than zero, the output of ReLU is x, and when x is less than or equal to zero, the output is zero. The convolution layer slides the entire image through the convolution kernel to generate multiple feature maps. The pooling layer uses maximum pooling to take the maximum value in each 2×2 area to reduce the size of the feature map. For example, after using maximum pooling, the 224×224 feature map is reduced to 112×112; the pooling layer reduces the dimension of the feature map to reduce the amount of calculation and prevent overfitting; Finally, the multi-dimensional feature map is flattened into a one-dimensional vector so that it can be connected to the subsequent fully connected layer; for example, if a set of 64 7×7 feature maps is obtained after convolution and pooling, a one-dimensional vector of length 7×7×64=3136 will be obtained after flattening.
[0081] ③Fully connected layer: The features extracted by the previous layer are integrated for final classification; each input feature is connected to each neuron in the fully connected layer, each neuron calculates the weighted sum and adds a bias, and the linear combination of neurons outputs z=W×y+b, where W is the weight matrix, y is the input feature vector, and b is the bias; The ReLU activation function is used again after the fully connected layer. The purpose of using ReLU here is to set negative values to zero, further promoting the effective learning and recognition of complex features by the neural network.
[0082] ④Output layer: Use Softmax activation function ; Output the probability of each food category, where z i is the output of the fully connected layer, where the numerator represents the strength of category i, and the denominator represents the sum of the strengths of all categories, a total of n. i is the predicted probability of each food category.
[0083] A3, training model to optimize model parameters, divide the data set into 70% training set, 15% validation set, and 15% test set. Use the training set and validation set for training, and use the test set to evaluate the model accuracy. Stop training when the accuracy reaches the set threshold.
[0084] A4, using the trained model to identify and record the food type represented by the food pixel elements in the food photos taken by the user.
[0085] Step 2: The user estimates the quality of various ingredients in daily home diet by taking depth images of the ingredients. The specific method is as follows: B1, use a mobile phone equipped with a depth-sensing camera (such as a TOF camera) to horizontally shoot one side image and the other side image of the food, identify the food pixel element based on A4, and assume that the straight-line distance between the optical center of the lens of the depth-sensing camera and the actual food represented by each food pixel element in the image is L k , each food pixel corresponds to an L k , k is an integer starting from 1, and the maximum integer of k is the total number of food pixels contained in the image; the straight-line distance between the optical center of the lens of the depth-sensing camera and the image sensor is Q, the image collected by the image sensor is scaled β times and displayed on the mobile phone display, the width of the mobile phone display area is G, and the number of pixels per row on the mobile phone screen is m, then The width of each pixel on the display is G÷m. The width of each pixel on the image sensor is G÷m÷β, like Figure 2 As shown, the actual food width d represented by each food pixel on the display screen divided by the width of each pixel on the image sensor (G ÷ m ÷ β) is equal to L k ÷Q, so the estimated volume of the actual food represented by each food pixel on the display screen is V=d 3 =[(G×L k )÷(m×β×Q)] 3 .
[0086] B2, let L be the farthest horizontal straight-line distance between the optical center of the depth-sensing camera lens and a certain surface of the food. max , then the sum of the food volumes contained in the horizontal and vertical arrangements of the food pixels in the image on the display is estimated to be [floor(L max -L k )]×[(G×L k )÷(m×β×Q)] 3 ; The floor() function is a rounding function; In this way, the sum of the volumes of all the pixel elements of the food in the two food depth images arranged horizontally and vertically is the total volume V0 of the food.
[0087] B3, create a food density database, including food types and corresponding densities.
[0088] B4, multiply the total volume of the food by its density to calculate the mass of the food.
[0089] Step 3: Record user health data and analyze nutritional deficiencies. The specific method is as follows: C1, collects the user's heart rate, blood oxygen saturation, body temperature, blood pressure, blood sugar, and sleep data through health monitoring devices worn by the user, such as health bracelets, medical bracelets, smart watches, etc.
[0090] C2, create a food nutrition database, including food types and corresponding nutrition types and their mass proportions. Nutrition types include carbohydrates, fats, proteins, vitamins, and minerals.
[0091] C3, create a minimum standard library for nutritional intake, including the minimum standard quality of daily intake of five nutritional types: carbohydrates, fats, proteins, vitamins, and minerals under different genders, weights, and ages.
[0092] C4, the user enters his / her gender, weight, and age in the system; When the user's carbohydrate intake quality is lower than the minimum standard for three consecutive days, and the heart rate is lower than 60 beats / min and the fasting blood sugar is lower than 3.9mmol / L in a resting state, it is determined that the user needs to supplement carbohydrates; When the user's fat intake quality is lower than the minimum standard for three consecutive days, and the diastolic blood pressure is lower than 60 mmHg and the blood oxygen saturation is lower than 95% in a resting state, it is determined that the user needs to supplement fat; If the user's protein intake quality is lower than the minimum standard for three consecutive days, and the body temperature is lower than 36°C, and the number of awakenings during the last night's sleep exceeds 2 times, the user is judged to need protein supplementation; When the user's vitamin intake quality is lower than the minimum standard for three consecutive days, and the heart rate fluctuation value in a quiet state exceeds 15 times / minute and the blood oxygen saturation is lower than 95%, it is determined that the user needs vitamin supplementation; When the quality of a user's mineral intake is lower than the minimum standard for three consecutive days, and the fasting blood sugar fluctuation value exceeds 1.5mmol / L and the diastolic blood pressure in a resting state is lower than 60mmHg, the user is judged to need mineral supplementation.
[0093] Step 4: Calculate the matching degree of the catering provider according to the user's nutritional deficiency status. The specific method is as follows: D1, encodes the user's nutritional deficiency status from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. When a certain nutrient is lacking, a value of 1 is assigned, otherwise a value of 0 is assigned; for example, if the user only lacks carbohydrates and proteins, then the user's nutritional deficiency status U=10100.
[0094] D2, encode the nutritional status of the catering unit from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. If a certain nutrient can be provided, it is assigned a value of 1, otherwise it is assigned a value of 0. For example, if the catering menu of a catering unit only contains fat and protein, then the nutritional status of this catering unit is R=01100. When the carbohydrate content in 100 grams of food is greater than or equal to 15 grams, the food is judged to provide carbohydrates, otherwise it is judged that the food does not provide carbohydrates; When the fat content in 100 grams of food is greater than or equal to 5 grams, the food is judged to provide fat, otherwise it is judged that the food does not provide fat; When the protein content in 100 grams of food is greater than or equal to 10 grams, it is judged to provide protein, otherwise it is judged to not provide protein; When the content of vitamin A in 100 grams of food is greater than or equal to 50 micrograms, or the content of vitamin C is greater than or equal to 30 milligrams, or the content of vitamin D is greater than or equal to 1 microgram, or the content of vitamin B1 is greater than or equal to 0.6 milligrams, or the content of vitamin B2 is greater than or equal to 0.6 milligrams, it is determined that vitamins can be provided; otherwise, it is determined that vitamins cannot be provided; When the calcium content in 100 grams of food is greater than or equal to 100 mg, or the iron content is greater than or equal to 1.5 mg, or the zinc content is greater than or equal to 1.5 mg, or the potassium content is greater than or equal to 200 mg, it is judged that it can provide minerals; otherwise, it is judged that it cannot provide minerals.
[0095] D3, calculate the matching degree H between the user's nutritional deficiency status U and the nutritional status R provided by the catering provider: Suppose the five digits from left to right in the user's nutritional deficiency status U are U1, U2, U3, U4, U5; the five digits from left to right in the nutritional status R of the catering provider are R1, R2, R3, R4, R5; the total number of 1s in U is |U|, then H=[(U1×R1+U2×R2+U3×R3+U4×R4+U5×R5)÷|U|]×100%.
[0096] |U| of pure water=0, and the food that can be provided by the catering provider in the present invention does not contain pure water.
[0097] Step 5: formulate a nutritional supplement navigation route for the user based on the user's nutritional health status. The specific method is as follows: E1, the maximum straight-line distance T of the catering provider that the user can set max ; Assume that the real-time straight-line distance between the user and the surrounding catering providers is T, then according to H×[1-(T÷T max)] Recommend catering providers to users in descending order of values.
[0098] E2, generates a navigation route between the user and the most highly ranked catering provider based on an electronic map.
[0099] The VGG16 model has a simple structure and the pre-trained model performs well on small datasets. Using the pre-trained model for transfer learning can speed up training and improve accuracy.
[0100] In the process of taking photos, light must pass through the optical center of the convex lens to form a clear image. The light reflected by the food passes through the lens of the mobile phone camera and is captured by the image sensor. The image sensor converts the light into an electrical signal, which is then scaled and processed to form a digital image on the display. Figure 2 As shown, according to the principle of similar triangles, d÷(G÷m÷β)=L k ÷Q, from which the d value can be calculated, and finally the volume of the food represented by each pixel on the display screen can be calculated. The depth sensing camera sends a short pulse to the object and then returns to the camera. The propagation speed of the short pulse is the speed of light. The distance L can be calculated by the time difference between the transmission and reception of the short pulse. k ; The image is captured by the depth-sensing camera, which outputs a depth map in which the depth value corresponding to each pixel represents the distance between the point on the object and the camera.
[0101] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. An AI nutrition and health management service system, characterized by: It includes daily diet type recording module, daily diet type quality estimation module, physical condition recording and analysis module, nutrition diet matching module, and healthy diet navigation module; The daily diet type recording module helps users record the types of ingredients in their daily diet at home by taking photos of the ingredients. The specific method is as follows: A1, create a food image library, collect images of various food ingredients, and annotate the food types in the images; A2, select the existing pre-trained model VGG16 as the base model, and add a fully connected layer to the model VGG16: ① Input layer: resize the image to 224×224 pixels, scale the pixel values to [0,1], and input the resized image; ②Convolutional layer and pooling layer: According to the structure of VGG16, multiple groups of convolutional layers and pooling layers are added, each group contains multiple convolutional layers and one pooling layer; The convolution layer is used to extract image features, and the pooling layer is used to reduce the dimension and computational complexity of the feature map. A 3×3 pixel convolution kernel is used for convolution, and a ReLU activation function f(x)=max(0,x) is used after each convolution layer. When the input value x is greater than zero, the output of ReLU is x, and when x is less than or equal to zero, the output is zero. The convolution layer slides the entire image through the convolution kernel to generate multiple feature maps. The pooling layer uses maximum pooling to take the maximum value in each 2×2 area to reduce the size of the feature map. The pooling layer reduces the dimension of the feature map to reduce the amount of calculation and prevent overfitting. Finally, the multi-dimensional feature map is flattened into a one-dimensional vector so that it can be connected to the subsequent fully connected layer; ③Fully connected layer: The features extracted by the previous layer are integrated for final classification; each input feature is connected to each neuron in the fully connected layer, each neuron calculates the weighted sum and adds a bias, and the linear combination of neurons outputs z=W×y+b, where W is the weight matrix, y is the input feature vector, and b is the bias; After the fully connected layer, the ReLU activation function is used again. The purpose of using ReLU here is to set negative values to zero, further promoting the effective learning and recognition of complex features by the neural network. ④Output layer: Use Softmax activation function ; Output the probability of each food category, where z i is the output of the fully connected layer, where the numerator represents the strength of category i, and the denominator represents the sum of the strengths of all categories, a total of n. i is the predicted probability of each food category; A3, training model to optimize model parameters, divide the data set into 70% training set, 15% validation set, and 15% test set. Use the training set and validation set for training, and use the test set to evaluate the model accuracy. Stop training when the accuracy reaches the set threshold. A4, using the trained model to identify and record the food type represented by the food pixel element in the food photo taken by the user; The daily diet type quality estimation module helps users estimate the quality of various ingredients in their daily diet at home by taking depth images of the ingredients. The specific method is as follows: B1, use a mobile phone equipped with a depth-sensing camera to horizontally shoot one side image and the other side image of the food, identify the food pixel element based on A4, and assume that the straight-line distance between the optical center of the lens of the depth-sensing camera and the actual food represented by each food pixel element in the image is L k , each food pixel corresponds to an L k , k is an integer starting from 1, and the maximum integer of k is the total number of food pixels contained in the image; the straight-line distance between the optical center of the lens of the depth-sensing camera and the image sensor is Q, the image collected by the image sensor is scaled β times and displayed on the mobile phone display, the width of the mobile phone display area is G, and the number of pixels per row on the mobile phone screen is m, then The width of each pixel on the display is G÷m. The width of each pixel on the image sensor is G÷m÷β, Because the actual food width d represented by each food pixel on the display divided by the width of each pixel on the image sensor (G ÷ m ÷ β) is equal to L k ÷Q, so the estimated volume of the actual food represented by each food pixel on the display screen is V=d 3 =[(G×L k )÷(m×β×Q)] 3 ; B2, let L be the farthest horizontal straight-line distance between the optical center of the depth-sensing camera lens and a certain surface of the food. max , then the sum of the food volumes contained in the horizontal and vertical arrangements of the food pixels in the image on the display is estimated to be [floor(L max -L k )]×[(G×L k )÷(m×β×Q)] 3 ; The floor() function is a rounding function; In this way, the sum of the volumes of all the food pixel elements in the two food depth images arranged horizontally and vertically is the total volume V0 of the food; B3, creating a food density database, including food types and corresponding densities; B4, multiply the total volume of the food by its density to calculate the mass of the food; The physical condition recording and analysis module is used to record the user's health data and analyze the nutritional deficiency status, specifically in the following ways: C1, collects the user's heart rate, blood oxygen saturation, body temperature, blood pressure, blood sugar, and sleep data through the health monitoring device worn by the user; C2, create a food nutrition database, including food types and corresponding nutrition types and their mass proportions. Nutrition types include carbohydrates, fats, proteins, vitamins, and minerals. C3, create a minimum standard library for nutrient intake, including the minimum standard quality of daily intake of five nutrient types: carbohydrates, fats, proteins, vitamins, and minerals under different genders, weights, and ages; C4, the user enters his / her gender, weight, and age in the system; When the user's carbohydrate intake quality is lower than the minimum standard for three consecutive days, and the heart rate is lower than 60 beats / min and the fasting blood sugar is lower than 3.9mmol / L in a resting state, it is determined that the user needs to supplement carbohydrates; When the user's fat intake quality is lower than the minimum standard for three consecutive days, and the diastolic blood pressure is lower than 60 mmHg and the blood oxygen saturation is lower than 95% in a resting state, it is determined that the user needs to supplement fat; If the user's protein intake quality is lower than the minimum standard for three consecutive days, and the body temperature is lower than 36°C, and the number of awakenings during the last night's sleep exceeds 2 times, the user is judged to need protein supplementation; When the user's vitamin intake quality is lower than the minimum standard for three consecutive days, and the heart rate fluctuation value in a quiet state exceeds 15 times / minute and the blood oxygen saturation is lower than 95%, it is determined that the user needs vitamin supplementation; When the user's mineral intake quality is lower than the minimum standard for three consecutive days, and the fasting blood sugar fluctuation value exceeds 1.5mmol / L and the diastolic blood pressure in a resting state is lower than 60mmHg, the user is judged to need mineral supplementation; The nutrition and diet matching module calculates the matching degree of the catering provider according to the user's nutritional deficiency status, specifically in the following manner: D1, encodes the user's nutritional deficiency status from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. When a certain nutrient is lacking, a value of 1 is assigned, otherwise a value of 0 is assigned; D2, encode the nutritional status of the catering provider from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. If a certain nutrient can be provided, a value of 1 is assigned, otherwise a value of 0 is assigned; When the carbohydrate content in 100 grams of food is greater than or equal to 15 grams, the food is judged to provide carbohydrates, otherwise it is judged that the food does not provide carbohydrates; When the fat content in 100 grams of food is greater than or equal to 5 grams, the food is judged to provide fat, otherwise it is judged that the food does not provide fat; When the protein content in 100 grams of food is greater than or equal to 10 grams, it is judged to provide protein, otherwise it is judged to not provide protein; When the content of vitamin A in 100 grams of food is greater than or equal to 50 micrograms, or the content of vitamin C is greater than or equal to 30 milligrams, or the content of vitamin D is greater than or equal to 1 microgram, or the content of vitamin B1 is greater than or equal to 0.6 milligrams, or the content of vitamin B2 is greater than or equal to 0.6 milligrams, it is determined that vitamins can be provided; otherwise, it is determined that vitamins cannot be provided; When the calcium content in 100 grams of food is greater than or equal to 100 mg, or the iron content is greater than or equal to 1.5 mg, or the zinc content is greater than or equal to 1.5 mg, or the potassium content is greater than or equal to 200 mg, it is determined that it can provide minerals, otherwise it is determined that it cannot provide minerals; D3, calculate the matching degree H between the user's nutritional deficiency status U and the nutritional status R provided by the catering provider: Suppose the five digits from left to right in the user's nutritional deficiency status U are U1, U2, U3, U4, U5; the five digits from left to right in the nutritional status R of the catering provider are R1, R2, R3, R4, R5; the total number of 1s in U is |U|, then H=[(U1×R1+U2×R2+U3×R3+U4×R4+U5×R5)÷|U|]×100%; Pure water's |U|=0, the food that catering providers can provide does not contain pure water; The healthy diet navigation module formulates a nutritional supplement navigation route for the user according to the nutritional health status of the user, specifically in the following ways: E1, the longest straight-line distance T of the catering provider that the user can set max ; Assume that the real-time straight-line distance between the user and the surrounding catering providers is T, then according to H×[1-(T÷T max )] recommends catering providers to users in descending order of values; E2, generates a navigation route between the user and the most highly ranked catering provider based on an electronic map.
2. An AI nutrition and health management service method, characterized by: Step 1: Users can record the types of ingredients in their daily diet by taking photos of the ingredients. The specific method is as follows: A1, create a food image library, collect images of various food ingredients, and annotate the food types in the images; A2, select the existing pre-trained model VGG16 as the base model, and add a fully connected layer to the model VGG16: ① Input layer: resize the image to 224×224 pixels, scale the pixel values to [0,1], and input the resized image; ②Convolutional layer and pooling layer: According to the structure of VGG16, multiple groups of convolutional layers and pooling layers are added, each group contains multiple convolutional layers and one pooling layer; The convolution layer is used to extract image features, and the pooling layer is used to reduce the dimension and computational complexity of the feature map. A 3×3 pixel convolution kernel is used for convolution, and a ReLU activation function f(x)=max(0,x) is used after each convolution layer. When the input value x is greater than zero, the output of ReLU is x, and when x is less than or equal to zero, the output is zero. The convolution layer slides the entire image through the convolution kernel to generate multiple feature maps. The pooling layer uses maximum pooling to take the maximum value in each 2×2 area to reduce the size of the feature map. The pooling layer reduces the dimension of the feature map to reduce the amount of calculation and prevent overfitting. Finally, the multi-dimensional feature map is flattened into a one-dimensional vector so that it can be connected to the subsequent fully connected layer; ③Fully connected layer: The features extracted by the previous layer are integrated for final classification; each input feature is connected to each neuron in the fully connected layer, each neuron calculates the weighted sum and adds a bias, and the linear combination of neurons outputs z=W×y+b, where W is the weight matrix, y is the input feature vector, and b is the bias; After the fully connected layer, the ReLU activation function is used again. The purpose of using ReLU here is to set negative values to zero, further promoting the effective learning and recognition of complex features by the neural network. ④Output layer: Use Softmax activation function ; Output the probability of each food category, where z i is the output of the fully connected layer, where the numerator represents the strength of category i, and the denominator represents the sum of the strengths of all categories, a total of n. i is the predicted probability of each food category; A3, training model to optimize model parameters, divide the data set into 70% training set, 15% validation set, and 15% test set. Use the training set and validation set for training, and use the test set to evaluate the model accuracy. Stop training when the accuracy reaches the set threshold. A4, using the trained model to identify and record the food type represented by the food pixel element in the food photo taken by the user; Step 2: The user estimates the quality of various ingredients in daily home diet by taking depth images of the ingredients. The specific method is as follows: B1, use a mobile phone equipped with a depth-sensing camera to horizontally shoot one side image and the other side image of the food, identify the food pixel element based on A4, and assume that the straight-line distance between the optical center of the lens of the depth-sensing camera and the actual food represented by each food pixel element in the image is L k , each food pixel corresponds to an L k , k is an integer starting from 1, and the maximum integer of k is the total number of food pixels contained in the image; the straight-line distance between the optical center of the lens of the depth-sensing camera and the image sensor is Q, the image collected by the image sensor is scaled β times and displayed on the mobile phone display, the width of the mobile phone display area is G, and the number of pixels per row on the mobile phone screen is m, then The width of each pixel on the display is G÷m. The width of each pixel on the image sensor is G÷m÷β, Because the actual food width d represented by each food pixel on the display divided by the width of each pixel on the image sensor (G ÷ m ÷ β) is equal to L k ÷Q, so the estimated volume of the actual food represented by each food pixel on the display screen is V=d 3 =[(G×L k )÷(m×β×Q)] 3 ; B2, let L be the farthest horizontal straight-line distance between the optical center of the depth-sensing camera lens and a certain surface of the food. max , then the sum of the food volumes contained in the horizontal and vertical arrangements of the food pixels in the image on the display is estimated to be [floor(L max -L k )]×[(G×L k )÷(m×β×Q)] 3 ; The floor() function is a rounding function; In this way, the sum of the volumes of all the food pixel elements in the two food depth images arranged horizontally and vertically is the total volume V0 of the food; B3, creating a food density database, including food types and corresponding densities; B4, multiply the total volume of the food by its density to calculate the mass of the food; Step 3: Record user health data and analyze nutritional deficiencies. The specific method is as follows: C1, collects the user's heart rate, blood oxygen saturation, body temperature, blood pressure, blood sugar, and sleep data through the health monitoring device worn by the user; C2, create a food nutrition database, including food types and corresponding nutrition types and their mass proportions. Nutrition types include carbohydrates, fats, proteins, vitamins, and minerals. C3, create a minimum standard library for nutrient intake, including the minimum standard quality of daily intake of five nutrient types: carbohydrates, fats, proteins, vitamins, and minerals under different genders, weights, and ages; C4, the user enters his / her gender, weight, and age in the system; When the user's carbohydrate intake quality is lower than the minimum standard for three consecutive days, and the heart rate is lower than 60 beats / min and the fasting blood sugar is lower than 3.9mmol / L in a resting state, it is determined that the user needs to supplement carbohydrates; When the user's fat intake quality is lower than the minimum standard for three consecutive days, and the diastolic blood pressure is lower than 60 mmHg and the blood oxygen saturation is lower than 95% in a resting state, it is determined that the user needs to supplement fat; If the user's protein intake quality is lower than the minimum standard for three consecutive days, and the body temperature is lower than 36°C, and the number of awakenings during the last night's sleep exceeds 2 times, the user is judged to need protein supplementation; When the user's vitamin intake quality is lower than the minimum standard for three consecutive days, and the heart rate fluctuation value in a quiet state exceeds 15 times / minute and the blood oxygen saturation is lower than 95%, it is determined that the user needs vitamin supplementation; When the user's mineral intake quality is lower than the minimum standard for three consecutive days, and the fasting blood sugar fluctuation value exceeds 1.5mmol / L and the diastolic blood pressure in a resting state is lower than 60mmHg, the user is judged to need mineral supplementation; Step 4: Calculate the matching degree of the catering provider according to the user's nutritional deficiency status. The specific method is as follows: D1, encodes the user's nutritional deficiency status from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. When a certain nutrient is lacking, a value of 1 is assigned, otherwise a value of 0 is assigned; D2, encode the nutritional status of the catering provider from left to right in the order of carbohydrates, fats, proteins, vitamins, and minerals. If a certain nutrient can be provided, a value of 1 is assigned, otherwise a value of 0 is assigned; When the carbohydrate content in 100 grams of food is greater than or equal to 15 grams, the food is judged to provide carbohydrates, otherwise it is judged that the food does not provide carbohydrates; When the fat content in 100 grams of food is greater than or equal to 5 grams, the food is judged to provide fat, otherwise it is judged that the food does not provide fat; When the protein content in 100 grams of food is greater than or equal to 10 grams, it is judged to provide protein, otherwise it is judged to not provide protein; When the content of vitamin A in 100 grams of food is greater than or equal to 50 micrograms, or the content of vitamin C is greater than or equal to 30 milligrams, or the content of vitamin D is greater than or equal to 1 microgram, or the content of vitamin B1 is greater than or equal to 0.6 milligrams, or the content of vitamin B2 is greater than or equal to 0.6 milligrams, it is determined that vitamins can be provided; otherwise, it is determined that vitamins cannot be provided; When the calcium content in 100 grams of food is greater than or equal to 100 mg, or the iron content is greater than or equal to 1.5 mg, or the zinc content is greater than or equal to 1.5 mg, or the potassium content is greater than or equal to 200 mg, it is determined that it can provide minerals, otherwise it is determined that it cannot provide minerals; D3, calculate the matching degree H between the user's nutritional deficiency status U and the nutritional status R provided by the catering provider: Suppose the five digits from left to right in the user's nutritional deficiency status U are U1, U2, U3, U4, U5; the five digits from left to right in the nutritional status R of the catering provider are R1, R2, R3, R4, R5; the total number of 1s in U is |U|, then H=[(U1×R1+U2×R2+U3×R3+U4×R4+U5×R5)÷|U|]×100%; Pure water's |U|=0, the food that catering providers can provide does not contain pure water; Step 5: formulate a nutritional supplement navigation route for the user based on the user's nutritional health status. The specific method is as follows: E1, the longest straight-line distance T of the catering provider that the user can set max ; Assume that the real-time straight-line distance between the user and the surrounding catering providers is T, then according to H×[1-(T÷T max )] recommends catering providers to users in descending order of values; E2, generates a navigation route between the user and the most highly ranked catering provider based on an electronic map.