Food image processing method and system based on AI, medium and product
By identifying food cooking methods and combining them with ingredient information, the system dynamically adjusts food calorie information, thus addressing the impact of food processing methods on calorie calculation and enabling more accurate calorie control and personalized dietary recommendations.
Patent Information
- Application Number
- CN202511050729.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2025-10-31
AI Technical Summary
Existing technologies fail to adequately consider the impact of food processing methods on calorie calculations, resulting in inaccurate calorie information.
By identifying the cooking method of food, combined with the type and weight of ingredients, the food cooking recognition model obtains initial calorie information, adjusts the final calorie information according to the cooking method, adjusts the portion size for homogeneous and heterogeneous foods, and dynamically adjusts the diet plan by combining user exercise data and meal time.
It improves the accuracy of food calorie calculation, enables personalized and scientific calorie control, adapts to dynamic changes in user needs, and enhances the adaptability and practicality of diet management.
Smart Images

Figure CN120878076A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence application technology, and in particular to an AI-based food image processing method, system, medium, and product. Background Technology
[0002] With the improvement of people's living standards and the enhancement of health awareness, diet management and nutritional balance have gradually become a focus of attention. A scientific and reasonable diet plan can help people control their weight, improve their physical condition, and prevent chronic diseases. In recent years, the development of intelligent technology has provided new solutions for diet management. Among them, image processing technology can quickly analyze food information and provide users with convenient diet management support. The application scenarios of this technology cover daily dietary records, calorie analysis, and personalized dietary recommendations, and it has attracted increasing attention and use from users.
[0003] In related technologies, food image processing systems typically achieve dietary management through the following steps: users take pictures of food and upload them to the system; the system uses a pre-set image recognition model to analyze the image, identify the type of food in the image, and estimate the food weight. Subsequently, the system matches the recognition results with a pre-set food database to determine the basic nutritional components and calorie information of the food. Furthermore, some systems, based on the user's provided calorie needs and the basic calorie information of the food, provide dietary suggestions, including recommended intake amounts or appropriate adjustment strategies. These technical solutions can, to a certain extent, meet users' needs for dietary records and calorie estimation.
[0004] However, related technologies typically calculate calorie information based on the type and weight of food ingredients, resulting in a standard calorie count that fails to adequately account for differences in how users prepare food. These differences in food preparation methods can, in turn, affect the accuracy of the calculated calorie information. Summary of the Invention
[0005] This application provides an AI-based food image processing method, system, medium, and product for identifying the cooking method of food and improving the accuracy of calculating food calorie information by combining the types and weights of the ingredients.
[0006] Firstly, this application provides an AI-based food image processing method applied to a food image processing system. The method includes: after a user has cooked the required food according to a preset diet plan, acquiring a food image uploaded by the user, the diet plan including calorie requirements for each meal and the types and weights of ingredients for each meal; inputting the food image into a preset food cooking recognition model for matching to obtain the cooking method of the food; determining the initial calorie information corresponding to the food based on the type and weight of the ingredients, combined with a preset food database; determining the final calorie information corresponding to the food based on the cooking method and the initial calorie information; when the final calorie information exceeds the calorie requirement information, adjusting the recommended portion size ratio of the food and determining it as dietary advice information, the dietary advice information including the required portion size of the food for this meal; and feeding back the final calorie information and the dietary advice information to the user.
[0007] By employing the above technical solution, the system first acquires food images uploaded by the user that conform to the dietary plan. The cooking method is then determined using a food cooking recognition model. Based on ingredient information and a database, the initial calorie count is calculated. Next, the calorie change of the corresponding ingredients after cooking is determined through the cooking method, thus determining the final calorie count of the food. When the final calorie count exceeds the preset dietary plan, the recommended portion size is adjusted according to the user's calorie needs. By matching the initial calorie count of the corresponding ingredients in the database and then considering the impact of the cooking method on the calorie count, the final calorie count of the food is determined. This approach considers the influence of different food processing methods on the calorie count, improving the accuracy of calorie information calculation.
[0008] In conjunction with some embodiments of the first aspect, in some embodiments, when the final calorie information exceeds the calorie requirement information, the recommended food portion ratio is adjusted and determined as dietary advice information. Specifically, this includes: determining whether the food is homogeneous or heterogeneous; the homogeneous food is a food with a single type of ingredients or whose ingredients are difficult to separate; the heterogeneous food is a food whose ingredients are separated. If the food is homogeneous, the ratio of the calorie requirement information to the final calorie information is calculated and determined as the first recommended portion ratio. If the food is heterogeneous, the excess calorie value of the food is calculated, and the consumption ratio of each ingredient in the heterogeneous food is determined according to the calorie value corresponding to the type of ingredient, to obtain the second recommended portion ratio. The first or second portion ratio is then determined as dietary advice information.
[0009] By employing the above technical solution, when the final calorie information exceeds the calorie requirement information, different portion control strategies are applied for homogeneous and heterogeneous foods. For homogeneous foods, the system directly provides a suggested first portion size by calculating the ratio of the calorie requirement information to the final calorie information. For heterogeneous foods, the system calculates the excess calorie value and gradually adjusts the weight of the ingredients based on their unit calorie value to ultimately obtain a suggested second portion size. This targeted adjustment strategy not only improves the accuracy of portion control but also enhances the personalization and reliability of dietary recommendations.
[0010] In conjunction with some embodiments of the first aspect, in some embodiments, if the food is a heterogeneous food, the excess calorie value of the food is calculated, and the consumption ratio of each ingredient of the heterogeneous food is determined according to the calorie value corresponding to the ingredient type, to obtain a recommended second serving ratio. Specifically, this includes: calculating the difference between the final calorie information and the calorie requirement information to obtain the excess calorie value of the food; obtaining the unit calorie value of each ingredient type according to the food database and the cooking method, and establishing a reduction priority sequence according to the unit calorie value, wherein the reduction priority of each ingredient in the reduction priority sequence is arranged in descending order according to the unit calorie value; iteratively reducing the weight of the ingredient from the ingredient with the highest reduction priority according to the reduction priority sequence and the ingredient weight, and calculating the reduction calorie value; when the reduction calorie value reaches the excess calorie value, determining the recommended second serving ratio according to the reduced ingredient weight.
[0011] By employing the above technical solution, when processing heterogeneous foods, the unit calorie value of each ingredient is obtained based on a food database and cooking methods, and a reduction priority sequence is constructed. This sequence sorts ingredients by unit calorie value from high to low, prioritizing the reduction of ingredients that contribute more calories, thereby preserving the maximum amount of other components of the food while meeting calorie requirements. When the reduction exceeds the recommended calorie value, a final portion ratio suggestion is calculated based on the reduced weight of each ingredient. This priority adjustment strategy effectively improves the precision of calorie control while minimizing the impact on the nutritional balance of the food and the user's feeling of fullness.
[0012] In conjunction with some embodiments of the first aspect, in some embodiments, the diet plan further includes meal times. After the step of acquiring the food image uploaded by the user after the user has cooked the required food according to the preset diet plan, the method further includes: constructing a meal time sequence for the user based on the meal times, wherein the center time point of adjacent meal times in the meal time sequence is a time boundary point; extracting the acquisition time of the food image and matching it with the meal time sequence to determine the target meal time corresponding to the food image; and determining the calorie requirement information corresponding to the diet plan based on the target meal time.
[0013] By employing the above technical solution, after acquiring food images, a meal time sequence is established, and the target meal time is matched based on the image acquisition time to determine the corresponding calorie requirements. Associating images with meal times ensures accurate matching of calorie requirements and avoids deviations in calorie requirement acquisition due to incorrect time correspondence.
[0014] In conjunction with some embodiments of the first aspect, in some embodiments, the acquisition time of the food image is extracted and matched with the dining time sequence to determine the target dining time corresponding to the acquisition time. Specifically, this includes: extracting the acquisition time of the food image and matching it with the dining time sequence to obtain an initial target dining time; feeding back the initial target dining time to the user and prompting the user to confirm whether the initial target dining time is correct; if the user reports that the initial target dining time is incorrect, providing the user with a list of adjacent dining times, which includes multiple dining times adjacent to the initial target dining time in the dining time sequence; feeding back the list of adjacent dining times to the user and prompting the user to select the correct target dining time; and determining the correct target dining time as the final target dining time corresponding to the food image.
[0015] By adopting the above technical solution, the initial target dining time is obtained and then sent back to the user for confirmation. If the initial target dining time is incorrect, an adjacent time is provided for the user to choose from. Introducing a user confirmation process corrects potential matching errors or avoids discrepancies between the user's uploaded time and the dining time, ensuring the accuracy of the target dining time and the determination of calorie requirements, thereby improving the overall reliability of the solution.
[0016] In conjunction with some embodiments of the first aspect, in some embodiments, after determining the corresponding calorie requirement information in the diet plan based on the target meal time, the method further includes: acquiring the user's exercise data, the exercise data including the user's current calorie consumption, exercise intensity, exercise duration, and exercise type; establishing a post-exercise calorie requirement curve based on the exercise data, the calorie requirement curve being used to dynamically describe the user's changes in calorie requirement at different times after exercise; adjusting the meal time and corresponding calorie requirement information of the next meal in the diet plan based on the calorie requirement curve, and feeding it back to the user.
[0017] By employing the aforementioned technical solution, after determining the target meal time, a post-exercise calorie requirement curve is established by combining the user's exercise data, and the meal time and calorie requirement information for the next meal are dynamically adjusted. This curve, by integrating multi-dimensional data such as exercise intensity, duration, and type, accurately describes the changes in the user's calorie requirement at different times after exercise, ensuring a high degree of match between the diet plan and the individual's dynamic needs. By adjusting the calorie requirement and meal time for the next meal, the diet plan can be rationalized and personalized.
[0018] In conjunction with some embodiments of the first aspect, in some embodiments, after the user has cooked the required food according to a preset diet plan and obtained the food image uploaded by the user, the method further includes: when there are multiple food images, extracting the image feature vector and image resolution of each food image, wherein the image feature vector includes color distribution features, texture features, and edge features; calculating the feature vector similarity between each food image based on the image feature vector; if the feature vector similarity is greater than a preset similarity threshold, determining that the food images contain the same food; marking the food image with the highest image resolution as the main image and marking the other food images as auxiliary images; and performing cross-validation between the main image and the auxiliary images to improve the reliability of the food recognition results.
[0019] By employing the above technical solution, features and resolution are extracted from multiple images uploaded by the user. When the image similarity exceeds a preset threshold, it is determined that the images contain the same food. The highest resolution image is used as the primary image, and the others are used as auxiliary images for cross-validation. This multi-image cross-validation reduces the recognition error of a single image and improves the accuracy of food identification results.
[0020] In a second aspect, embodiments of this application provide a food image processing system, which includes: one or more processors and a memory; the memory is coupled to the one or more processors and is used to store computer program code, which includes computer instructions, and the one or more processors call the computer instructions to cause the food image processing system to perform the method described in the first aspect and any possible implementation thereof.
[0021] Thirdly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on a food image processing system, cause the food image processing system to perform the method described in the first aspect and any possible implementation thereof.
[0022] Fourthly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a food image processing system, cause the food image processing system to perform the method described in the first aspect and any possible implementation thereof.
[0023] Understandably, the food image processing system provided in the second aspect, the computer program product provided in the third aspect, and the computer storage medium provided in the fourth aspect are all used to execute the methods provided in the embodiments of this application. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods, and will not be repeated here.
[0024] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. By adopting a technical solution that first acquires food images uploaded by users, obtains the cooking method of the food through a food cooking recognition model, determines the initial calorie information by combining it with the database, and adjusts the final calorie information according to the cooking method, and adjusts the portion size and provides feedback when it exceeds the requirements, a complete calorie control process based on image recognition and dynamic adjustment combined with cooking method can be formed. This effectively solves the problem that related technologies do not consider the impact of cooking method on calorie calculation, thereby improving the accuracy of food calorie calculation.
[0025] 2. Because it adopts a technical solution that distinguishes between homogeneous and heterogeneous foods when calorie intake exceeds requirements, and determines the recommended portion size and provides feedback by adjusting the proportion or prioritizing reduction based on unit calorie value, it can flexibly adjust for different food types. This effectively solves the problem of related technologies failing to make differentiated adjustments based on food characteristics, thereby achieving more scientific calorie control and more reasonable consumption recommendations, and improving the adaptability and practicality of users' diet management.
[0026] 3. By adopting a technical solution that acquires user exercise data, establishes a calorie demand curve after exercise, and dynamically adjusts the diet plan for the next meal accordingly, it can respond to changes in the user's exercise status and calorie consumption in real time. This effectively solves the problems of static diet plans and failure to adapt to the dynamic changes in individual user needs in related technologies, thereby achieving dynamic optimization of diet plans and precise matching of calorie needs. Attached Figure Description
[0027] Figure 1 This is a schematic diagram of a scene of an AI-based food image processing method according to an embodiment of this application; Figure 2 This is a flowchart illustrating an AI-based food image processing method in an embodiment of this application. Figure 3This is another flowchart illustrating an AI-based food image processing method in an embodiment of this application; Figure 4 This is a schematic diagram of the physical device structure of a food image processing system in an embodiment of this application. Detailed Implementation
[0028] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification of this application, the singular expressions “a,” “an,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to any or all possible combinations including one or more of the listed items.
[0029] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0030] Figure 1 This is a schematic diagram of a scene of an AI-based food image processing method according to an embodiment of this application. Figure 1 This includes a food image 101, ingredient types 102, and food calories 103. For ease of understanding, the following will be combined with... Figure 1 This application describes the application scenarios of the embodiments of this application.
[0031] In related technologies, only basic ingredient information and preliminary calorie values can typically be extracted through image recognition to determine the excess calories of the current food, which is insufficient for dynamic portion adjustment when the calorie content exceeds the planned amount. This application's embodiment addresses this issue by... Figure 2 The process shown combines a user-uploaded food image 101 with a recognition model that progressively analyzes the type of ingredients 102 and cooking method. After obtaining accurate food calorie information 103, the system can adjust the recommended serving size proportionally when the calorie requirement exceeds the planned needs. For example, for homogenous foods, the system directly adjusts the overall serving size based on the ratio of calorie requirements to the food's calorie content 103. Simultaneously, the system feeds back the final calorie information and dietary recommendations to the user, allowing them to intuitively understand the current food's calorie content and receive optimization suggestions.
[0032] By combining the solutions of this application with cooking methods, users can obtain relatively accurate food calories and personalized dietary advice, effectively solving the problem of insufficient consideration of differences in food processing methods in related technologies, thereby improving the accuracy of calculating food calorie information.
[0033] To facilitate understanding, the method provided in this implementation will be described in detail below, using the above scenario as an example. Please refer to [link / reference]. Figure 2 This is a flowchart illustrating an AI-based food image processing method in an embodiment of this application.
[0034] S201. After the user has cooked the required food according to the preset diet plan, obtain the food image uploaded by the user. The diet plan includes information on the calorie requirements of each meal and the types and weights of ingredients for each meal. Among them, "preset diet plan" refers to the diet arrangement formulated by the food image processing system according to the user's needs, which means a plan that includes the calorie requirement information, the types of ingredients and the weight of ingredients for each meal; "food image" refers to the picture used to present the appearance of food; "calorie requirement information" refers to the calorie intake standard set for each meal in the diet plan, which is used to indicate the appropriate calorie intake value for each meal, such as the calorie requirement for lunch being 600 kcal.
[0035] Specifically, after the user cooks the required food according to the preset diet plan, the food image processing system receives the food images uploaded by the user. First, the user prepares the necessary ingredients and cooks them into food according to the calorie requirements and types of ingredients in the diet plan. Then, the user takes a picture of the cooked food and uploads it to the food image processing system. During the upload process, the food image processing system records the upload time of the food image and associates the food image with the diet plan.
[0036] S202. Input the food image into a preset food cooking recognition model for matching to obtain the cooking method of the food; Among them, "food cooking recognition model" refers to an artificial intelligence model pre-trained in a food image processing system for recognizing the cooking methods of food; "cooking method" refers to the way ingredients are processed to prepare food, and refers to important parameters that affect the calories of food, such as frying, deep-frying, steaming, boiling, etc.
[0037] The training process for the food cooking recognition model includes the following steps: First, the food image processing system needs to collect diverse food image datasets to ensure the model can cover as many cooking methods and ingredient types as possible. Data sources include publicly available food image datasets, user-uploaded food images, and high-quality images taken with professional equipment. Each image is precisely labeled, including the type and weight of the ingredient and the specific cooking method (such as frying, deep-frying, steaming, boiling, grilling, etc.) to form a high-quality training dataset.
[0038] To enhance the model's adaptability, various data augmentation processes were applied to the dataset. These included geometric transformations such as rotation, flipping, scaling, and cropping of the images to simulate image characteristics under different shooting angles and distances; simultaneously, the brightness, contrast, and saturation of the images were adjusted to address image quality differences under varying lighting conditions and shooting devices. Furthermore, random noise was added to simulate image interference that might occur in real-world scenarios, further enhancing the model's robustness in complex environments.
[0039] After data preparation, a deep learning network structure for cooking method recognition was designed. The model typically employs a Convolutional Neural Network (CNN), whose structure includes a feature extraction module, a classification module, and an attention mechanism module. The feature extraction module captures low-level and high-level features in food images through multi-layer convolutional operations, such as color distribution, edge texture, and morphological features. The attention mechanism module helps the model focus on key areas in the image, such as cooking traces in the focal area. The classification module outputs the possible cooking method category based on the extracted features.
[0040] The model training process is divided into two stages: pre-training and fine-tuning. In the pre-training stage, the system uses a model pre-trained on a general image classification task as the initial weights for the feature extraction module to reduce the time and resources required for training. In the fine-tuning stage, the model is specifically trained on a food image dataset. The goal of the model is to simultaneously optimize the classification loss function (used to determine cooking methods) and the regression loss function (used to predict the weight and morphological features of ingredients) to achieve multi-task learning.
[0041] After training, the optimized model is deployed to the food image processing system for real-time processing of food images uploaded by users.
[0042] After a user uploads a food image, the food image processing system inputs it into a pre-defined food cooking recognition model for analysis. Specifically, the system first preprocesses the uploaded image. Next, it extracts key features of the food from the image, including color distribution, texture, and morphological features. These features are then converted into numerical values to obtain feature vectors, which are then input into the food cooking recognition model.
[0043] The food cooking recognition model matches the input feature vector with cooking method features in its internal training database. By calculating the similarity between the input image and the features of each cooking method, the model ultimately outputs the most suitable cooking method. For example, if the input image is a photo of sweet and sour pork ribs, the system analyzes the extracted features (such as the reddish-brown sheen, the shape of the ribs, and the viscous texture of the sweet and sour sauce) and matches it to the "fried and seasoned" cooking method in the database.
[0044] S203. Based on the type and weight of the ingredient, and in conjunction with a preset food database, determine the initial calorie information corresponding to the food. The “preset food database” refers to a collection of food-related data that is pre-established in the food image processing system. It includes at least the calories, types of ingredients, and cooking methods of various ingredients. For example, it stores that 100 grams of rice contains 116 calories. The “initial calorie information” refers to the calorie content of food calculated based only on the type and weight of the ingredients. It refers to the calorie value without considering the cooking method. After obtaining the cooking method of the food, the food image processing system calculates the food's calories based on the types and weights of the ingredients. Specifically, the system queries a pre-set food database based on the identified ingredient types and their corresponding weights. The database contains calorie data per unit weight of various ingredients, and the system calculates the initial calorie information of the food. If the food consists of multiple ingredients, the system calculates the calories of each ingredient separately and then adds them together. For example, if the system identifies 100 grams of rice and 150 grams of tomato, and the database shows that 100 grams of rice contains 116 kcal and 100 grams of tomato contains 20 kcal, then the initial calorie information is 116 + (150 ÷ 100 × 20) = 146 kcal.
[0045] Optionally, before calculating the initial calorie information for the food, the food image processing system can confirm with the user whether the weight of the ingredients used in this meal conforms to the preset diet plan. Specifically, the food image processing system will list the ingredients and their corresponding weight information based on the food image uploaded by the user and the preset ingredient types and weights in the diet plan. For example, if the diet plan includes 100 grams of chicken breast and 200 grams of broccoli for dinner, the food image processing system will display a prompt: "The preset ingredients for this meal are: 100 grams of chicken breast and 200 grams of broccoli. Please confirm whether this matches your actual usage." If the user confirms that the displayed types and weights of ingredients match the actual situation, the food image processing system will directly use the preset ingredient weights for subsequent calorie calculations. If the user reports that the ingredient weights used do not match the preset plan, the food image processing system will request the user to input the actual ingredient weights used in the meal. For example, if the user actually used 150 grams of chicken breast and 250 grams of broccoli, the user needs to manually enter the actual weights in the system interface. After receiving the user's input data, the food image processing system will perform calorie calculations for the meal based on the actual ingredient weights.
[0046] S204. Based on the cooking method and the initial calorie information, determine the final calorie information corresponding to the food; The “final calorie information” refers to the actual calorie value of food determined after considering the cooking method. It refers to the final result that reflects the impact of cooking on calories. For example, 200 grams of deep-fried beef has a final calorie value of 350 kcal. After determining the initial calorie information, the food image processing system adjusts the calorie data according to the cooking method. Specifically, the system first analyzes the impact of cooking methods on calories. For example, frying increases the extra calories from the oil, while steaming basically does not change the original calories of the ingredients. The system adjusts the initial calorie information based on preset cooking calorie influence rules (e.g., 90 kcal added for every 10 grams of oil). For instance, if a food has an initial calorie of 300 kcal, and the cooking method is frying with 20 grams of cooking oil detected, the system will calculate the added calories (20 ÷ 10 × 90 = 180 kcal) and add it to the initial calorie information to obtain a final calorie information of 480 kcal.
[0047] S205. When the final calorie information exceeds the calorie requirement information, adjust the recommended food portion ratio and determine it as dietary advice information, which includes the portion of the food to be consumed in this meal. "Dietary advice information" refers to the dietary guidance provided by the system to users, which includes suggestions such as serving sizes. After the food image processing system determines the final calorie information and finds that it exceeds the calorie requirement, it provides the user with suggestions for adjusting the current food portion size. Specifically, the system first compares the difference between the final calorie information and the calorie requirement. If the final calorie information is 600 kcal, while the calorie requirement is 500 kcal, exceeding the requirement by 100 kcal, the system calculates the percentage of calories that need to be reduced (100 ÷ 600 ≈ 16.7%) and adjusts the portion size accordingly (suggesting 83.3% of the prepared amount). Simultaneously, the system considers the divisibility of the food (e.g., rice can be scooped proportionally, a whole roasted chicken can be divided by weight) to convert the proportions into specific portion sizes (e.g., if the total amount of rice prepared is 300 grams, it is suggested to eat 250 grams), ultimately determining the dietary recommendation information.
[0048] S206. Feedback the final calorie information and dietary recommendations to the user.
[0049] After determining the dietary recommendations, the food image processing system informs the user of the final calorie information and dietary recommendations obtained earlier. Specifically, the system integrates the final calorie information (e.g., "This meal has a final calorie content of 550 kcal") and dietary recommendations (e.g., "It is recommended to consume 90% of the total prepared amount, i.e., 270 grams") and sends it to the user through a pre-defined feedback channel (e.g., push notifications from a mobile app). Simultaneously, the system ensures the information is presented clearly and understandably, for example, by using charts to compare calorie content (bar graphs showing the final calorie content versus the required calorie content) and portion control diagrams (using the bowl's capacity to indicate the serving size) to facilitate intuitive user understanding.
[0050] By adopting the above technical solution, the first step is to acquire images of food cooked according to the user's dietary plan, ensuring that the images are relevant to the user's actual dietary needs. The images are then input into a food cooking recognition model to obtain the cooking method, providing basic data for calorie calculation. An initial calorie count is derived from the ingredient information using a food database, and then adjusted according to the cooking method to obtain the final calorie count, making the calorie calculation more realistic. When the final calorie count exceeds the user's needs, the portion size is adjusted and feedback is provided, accurately determining the calorie content and adjusting the portion size. This effectively solves the problem of insufficient consideration of differences in food processing methods in related technologies, thereby improving the accuracy of calculating food calorie information.
[0051] In light of the above scenarios, the following is a more detailed description of the process provided in this implementation. Please refer to [link / reference]. Figure 3 This is another flowchart illustrating an AI-based food image processing method in an embodiment of this application.
[0052] S301. After the user has cooked the required food according to the preset diet plan, obtain the food image uploaded by the user. The diet plan includes information on the calorie requirements of each meal and the types and weights of ingredients for each meal. The diet plan also includes meal times.
[0053] Step S301 and Figure 2 The description of step S201 in the above embodiments is similar, and can be found in the description of the relevant steps. It will not be repeated here.
[0054] S302. Based on the meal time, construct the user's meal time sequence, where the center time point of adjacent meal times in the meal time sequence is the time boundary point; Extract the acquisition time of the food image and match it with the meal time series to obtain the initial target meal time; Among them, "meal time series" refers to the ordered time set constructed by the food image processing system based on meal times, such as [7:00, 12:00, 18:00]; "food image acquisition time" indicates the time when the food image processing system receives the food image uploaded by the user; "initial target meal time" refers to the meal time corresponding to the food image determined by the food image processing system through matching, such as the initial target meal time matched with the acquisition time of 8:15 being 7:00. After acquiring the food images and corresponding meal plans uploaded by the user, the food image processing system matches and determines the corresponding meal times. Specifically, the system first constructs a meal time sequence based on the meal times in the meal plan, arranged chronologically. For example, if the meal times in the plan are breakfast at 7:00, lunch at 12:00, and dinner at 18:00, the system will construct a meal time sequence of [7:00, 12:00, 18:00] and calculate the center time point between adjacent meal times as time boundaries, i.e., the center time point between 7:00 and 12:00 is 9:30, and the center time point between 12:00 and 18:00 is 15:00. Then, the system extracts the acquisition time of the food image. If the acquisition time is 10:00, it compares it with the time boundaries. Since 10:00 is after 9:30 and before 15:00, it matches 12:00 in the meal time sequence, resulting in an initial target meal time of 12:00.
[0055] S303. Feedback the initial target meal time to the user and prompt the user to confirm whether the initial target meal time is correct; After obtaining the initial target dining time, the food image processing system requires user confirmation of the accuracy of the initial matching result. Specifically, the system will clearly present the determined initial target dining time to the user, such as displaying "The currently matched dining time is 12:00 (lunch)" below the user's uploaded food image interface. Simultaneously, the system will guide the user to confirm through text prompts and button clicks, such as displaying "Please confirm if the dining time is correct. If correct, click 'Yes'; if incorrect, click 'No'," so that further processing can be performed based on user feedback.
[0056] S304. If the user reports that the initial target dining time is incorrect, then provide the user with a list of adjacent dining times, which includes multiple dining times that are adjacent to the initial target dining time in the dining time sequence. The list of adjacent dining times is sent to the user, prompting them to select the correct target dining time. When a food image processing system receives feedback from a user that the initial target dining time is incorrect, and the system needs to provide the user with alternative dining time options, the system first filters the dining time sequence to find dining times adjacent to the initial target dining time. For example, if the initial target dining time is 12:00, and the dining time sequence is [7:00, 10:00, 12:00, 15:00, 18:00], then the adjacent dining times are 10:00 and 15:00. The system will organize these times into a list of adjacent dining times [10:00, 15:00]. The system then presents this list to the user, prompting them to select the correct target dining time, for example, displaying "Please select your actual dining time: 1. 10:00; 2. 15:00; 3. Manual input."
[0057] S305. Determine the correct target meal time as the final target meal time corresponding to the food image; After the food image processing system obtains the correct target dining time selected by the user, it determines the final corresponding dining time. Specifically, the food image processing system will use the correct target dining time provided by the user as the final time corresponding to the food image, and all dining times related to the food image in subsequent steps will be based on this final target dining time.
[0058] S306. Based on the target meal time, determine the corresponding calorie requirement information in the diet plan; After determining the final target meal time, the food image processing system obtains the corresponding calorie requirements for that meal time. Specifically, the system searches for calorie requirement information that matches the target meal time from preset diet plans.
[0059] S307. Obtain the user's exercise data, which includes the user's current calorie consumption, exercise intensity, exercise duration, and exercise type; Based on the exercise data, a post-exercise calorie demand curve is established. This calorie demand curve is used to dynamically describe the changes in the user's calorie demand at different times after exercise. Among them, "exercise data" refers to various data reflecting the user's exercise status, including calorie consumption, exercise intensity, exercise duration and exercise type; "calorie demand curve after exercise" refers to a curve graph used to dynamically display the changes in calorie demand at different times after exercise. It is a chart that can intuitively reflect the pattern of calorie demand changes over time, such as a curve in which calorie demand rises within 1 hour after exercise and gradually falls back after 2 hours. After determining the calorie requirement for the target meal time, the food image processing system needs to adjust the subsequent diet plan based on the user's exercise data. Specifically, the system first acquires the user's exercise data through a connected motion monitoring device (such as a smart bracelet or fitness app), including the calories burned, the intensity of the exercise (moderate), the duration (50 minutes), and the type of exercise (jogging). Then, based on this data, the system calculates the user's changes in calorie requirement and generates a post-exercise calorie requirement curve.
[0060] S308. Based on the calorie requirement curve, adjust the meal time and corresponding calorie requirement information of the next meal in the diet plan, and provide feedback to the user. The "next meal time" refers to the time when the user needs to eat next. For example, if the current time is 15:00, the next meal time is 18:00. After establishing a post-exercise calorie requirement curve, the food image processing system adjusts the next meal plan based on changes in calorie requirement. Specifically, the system first determines the time of the next meal, then examines the percentage change in calorie requirement at that point in the calorie requirement curve. Based on the user's physiological needs, and considering factors such as weight loss, fat reduction, or blood sugar control, the system dynamically adjusts the calorie intake for the next meal. Finally, the system feeds back the adjusted meal time and calorie requirement information to the user's diet plan interface.
[0061] S309. When there are multiple food images, extract the image feature vector and image resolution of each food image. The image feature vector includes color distribution features, texture features, and edge features. Calculate the feature vector similarity between the food images based on the image feature vector. Among them, "image feature vector" refers to a numerical vector used to describe the features of a food image, which is a set of data formed by extracting image features, such as an array reflecting the features of image color and texture; "color distribution features" refers to the proportion and distribution of various colors in a food image, such as the distribution of green accounting for 60% and red accounting for 20% in a vegetable salad image; "texture features" refers to the texture characteristics of the surface of food ingredients in a food image, which refers to the visual features that can reflect the texture of food, such as the pore texture of bread surface or the texture of steak; "edge features" refers to the boundary line characteristics between different ingredients or background in a food image, which refers to the contour features that can distinguish different areas in the image; "feature vector similarity" refers to the degree of similarity between the image feature vectors of multiple food images, which is the vector matching degree obtained by calculation.
[0062] After receiving food images uploaded by users, the food image processing system needs to filter and correlate multiple images. Specifically, the system first extracts features from each image, obtaining image feature vectors that include color distribution (e.g., 30% red and 40% yellow in scrambled eggs with tomatoes), texture features (e.g., the fine texture of eggs and the smooth surface of tomatoes), and edge features (e.g., the clear boundary between the plate and the food). It also records the resolution of each image (e.g., one image is 2048×1536 pixels, and the other is 1280×960 pixels). Then, the system calculates the similarity between the feature vectors of each image using a vector distance algorithm (e.g., cosine similarity). For example, if the feature vector similarity of two scrambled eggs with tomatoes images is calculated to be 0.92, it indicates that the features of these two images are highly similar.
[0063] S310. Determine whether the similarity of the feature vectors is greater than the preset similarity threshold; After calculating the feature vector similarity between various food images, the food image processing system determines whether multiple images correspond to the same food. Specifically, the system compares the calculated feature vector similarity with a preset similarity threshold one by one. For example, if the preset threshold is 0.8, and two images have a similarity of 0.85, which is greater than the threshold, while another image has a similarity of 0.6 with these two, which is less than the threshold, the system will mark the image combinations with similarities greater than and less than the threshold based on the comparison results.
[0064] S311. If the similarity of the feature vector is greater than the preset similarity threshold, then it is determined that the food in each food image is the same food. After determining that the feature vector similarity is greater than a preset similarity threshold, the food image processing system determines whether multiple images correspond to the same food. Specifically, the system classifies all food images with feature vector similarity greater than the preset threshold as depicting the same food. For example, if a user uploads two images of Kung Pao Chicken taken from different angles, and the calculated similarity is 0.9, which is greater than the preset threshold of 0.75, the system will determine that these two images depict the same food. Subsequent food recognition can then leverage these images to extract features and improve accuracy.
[0065] Optionally, if the similarity of the feature vector is less than a preset similarity threshold, then it is determined that the food images are different foods, and the multiple food images are processed sequentially according to the order of receipt.
[0066] S312. Label the food image with the highest resolution as the main image, and label the other food images as auxiliary images; perform cross-validation between the main image and the auxiliary images to improve the reliability of the food recognition results; "Cross-validation" refers to the process of verifying the accuracy of recognition by recognizing and comparing the results of the main image and auxiliary images separately. It involves using the recognition results of multiple images to corroborate each other.
[0067] After identifying multiple food images as the same food, the food image processing system selects the primary object for recognition and performs cross-validation. Specifically, the system first compares the resolution of multiple images of the same food, selecting the image with the highest resolution (e.g., in three images, the 2048×1536 pixel image has a higher resolution than the 1280×960 and 1920×1080 pixel images) and marking it as the primary image. Simultaneously, the remaining images are marked as auxiliary images. In the subsequent food recognition process, the system first performs recognition using the primary image to obtain a preliminary result, then uses the auxiliary images for recognition. If the recognition results are consistent (e.g., both identify the food as scrambled eggs with tomatoes), the result is considered reliable. If there are discrepancies (the primary image identifies scrambled eggs with tomatoes, while the auxiliary image identifies tomato and egg soup), the system will re-analyze by combining the features of both images to improve recognition accuracy.
[0068] S313. Input the food image into a preset food cooking recognition model for matching to obtain the cooking method of the food; S314. Based on the type and weight of the food ingredient, and in conjunction with a preset food database, determine the initial calorie information corresponding to the food ingredient. S315. Based on the cooking method and the initial calorie information, determine the final calorie information corresponding to the food; Steps S313~S315 and Figure 2 The descriptions of steps S202 to S204 in the embodiments are similar, and can be found in the descriptions of the relevant steps; they will not be repeated here.
[0069] S316. When the final calorie information exceeds the calorie requirement information, determine whether the food is a homogeneous food or a heterogeneous food. The homogeneous food is a food with a single type of ingredients or whose ingredients are difficult to separate. The heterogeneous food is a food whose ingredients are separated. "Homogeneous food" refers to food in which the different ingredients cannot be easily separated and eaten, such as a bowl of white rice (single ingredient) or a serving of dumplings (mixed ingredients that are difficult to separate); "non-homogeneous food" refers to food in which the different ingredients can be taken out and eaten separately, such as fried chicken nuggets and French fries in a platter.
[0070] After determining that the final calorie information exceeds the calorie requirement, the food image processing system provides dietary recommendations based on the food type and portion size. Specifically, after confirming that the final calorie information of a food exceeds the calorie requirement, the system analyzes the composition of the food's ingredients to determine whether it is a homogeneous or heterogeneous food. Based on the type of ingredients, the system further combines color distribution features and texture features to analyze the overall distribution of the food. Color distribution is determined by calculating the proportion and shape of different color regions in the image to determine whether the food has clear boundaries. For example, fried rice usually has a relatively uniform color distribution, with different ingredients' colors mixed together, making it difficult to distinguish individual components; while a vegetable salad shows an uneven color distribution, with clearer areas for different ingredients. Texture feature analysis is mainly used to determine the texture and structure of the food's surface. The system uses a convolutional neural network to extract features representing the surface morphology of ingredients in the image, such as the smooth surface of a tomato or the texture of a steak.
[0071] Then, the food image processing system analyzes the difficulty of separating ingredients using edge feature extraction technology. Edge features refer to the clarity of the boundaries between different ingredients in a food. For example, for a cream cake, the system may extract a blurry boundary between the cake body and the cream layer, indicating that the ingredients are difficult to separate, so the system tends to classify it as a homogeneous food. However, for a hot pot, the system can clearly extract the boundary lines between ingredients such as meat slices, tofu, and vegetables, indicating that the ingredients are easier to separate, so it is classified as a heterogeneous food.
[0072] After feature extraction, the food image processing system matches the results with a pre-set food database. This database stores a large amount of classification information for common foods, including typical ingredient composition, color distribution patterns, and common shapes for each food. For example, the database labels fried rice, milkshakes, and soups as homogeneous foods, while labeling hot pot, pizza, and barbecue platters as heterogeneous foods. During the matching process, if a feature identified by the system highly matches a certain food feature in the database, the classification result from the database is directly used for the determination. For example, if the system identifies an image of a pizza whose color distribution and edge features highly match the features of a pizza template in the database, it is therefore determined to be a heterogeneous food.
[0073] However, considering the possibility of non-standard foods or complex food combinations customized by users in real-world scenarios, the system also incorporates a user feedback mechanism. When the system cannot reach a clear conclusion through feature analysis or database matching, it will send a confirmation request to the user. For example, when recognizing an image containing chicken, vegetables, and rice, the system may prompt the user, "The system has detected that this food may be a non-homogeneous food, containing chicken, vegetables, and rice. Please confirm if this is correct." The user can choose to confirm or make modifications, and the system will optimize subsequent judgments based on user feedback.
[0074] S317. If the food is a homogeneous food, calculate the ratio of the calorie requirement information to the final calorie information, and determine it as the recommended first serving size ratio. After determining that the food is homogenized, the food image processing system provides serving size recommendations. Specifically, based on the characteristic that the calories in homogenized food cannot be adjusted by separating ingredients, the system calculates the ratio of calorie requirement information to the final calorie information. For example, if the calorie requirement is 400 kcal and the final calorie amount is 500 kcal, the ratio is 400 ÷ 500 = 0.8, or 80%. The system will determine this ratio as the recommended first serving size, meaning that the user only needs to consume 80% of the total prepared amount of the homogenized food to achieve a calorie intake close to their calorie requirement.
[0075] S318. If the food is a non-homogeneous food, calculate the difference between the final calorie information and the calorie requirement information to obtain the excess calorie value of the food. After identifying a food as heterogeneous, the food image processing system determines the excess calorie amount to formulate a reduction plan. Specifically, based on the characteristics of heterogeneous foods, the system first obtains the final calorie information and the corresponding calorie requirement information. For example, a heterogeneous food (a serving of fried chicken, a vegetable salad, and rice) might have a final calorie content of 750 kcal and a calorie requirement of 550 kcal. Then, the system calculates the difference between the two to determine that the food exceeds the required calorie limit by 200 kcal.
[0076] S319. Based on the food database and the cooking method, obtain the unit calorie value of each ingredient type, and establish a reduction priority sequence based on the unit calorie value. The reduction priority of each ingredient in the reduction priority sequence is arranged in descending order of the unit calorie value. Among them, "calorie value per unit" refers to the calories contained in each unit weight (usually 100 grams) of food, which is a numerical value that measures the calorie content of food. For example, the calorie value per unit of 100 grams of fried chicken is 279 kcal. "Reduction priority sequence" refers to the list of food reduction order determined by the food image processing system based on the calorie value of the food, which is a sequence used to guide which food to reduce first. "Reduction priority" refers to the level that determines the order of food reduction, with foods with higher calorie values having higher reduction priority.
[0077] After obtaining the excess calorie value of a heterogeneous food, the food image processing system needs to determine which ingredient to start reducing calories from. Specifically, the system first retrieves the calorie values per unit for each ingredient of the heterogeneous food from its food database under the current cooking method. For example, for a heterogeneous food consisting of fried chicken nuggets, stir-fried broccoli, and rice, the system obtains the calorie values per 100 grams for fried chicken nuggets (279 kcal), stir-fried broccoli (34 kcal), and rice (116 kcal). Then, the system ranks these ingredients according to their calorie values from highest to lowest, forming a reduction priority sequence: fried chicken nuggets (highest), rice, and stir-fried broccoli (lowest).
[0078] S320. Based on the reduction priority sequence and the weight of the ingredient, iteratively reduce the weight of the ingredient starting from the ingredient with the highest reduction priority, and calculate the reduced calorie value. After establishing a weight reduction priority sequence, the food image processing system needs to reduce the weight of ingredients according to the sequence to lower calories. Specifically, the system first determines the highest priority ingredient from the priority sequence, such as fried chicken nuggets (highest), rice, and stir-fried broccoli (lowest). It then starts by reducing the weight of the fried chicken nuggets. Assuming the initial weight of the fried chicken leg is 150 grams, the system will first reduce a certain weight, for example, 20 grams. Based on its calorie value (279 kcal per 100 grams), this reduces the calorie value by 55.8 kcal. If this reduction is insufficient, the system continues reducing the weight of the ingredient, for example, another 30 grams, resulting in an additional 83.7 kcal reduction, for a total reduction of 139.5 kcal. If this is still insufficient, the system continues reducing the weight of the next priority ingredient according to the sequence, and so on.
[0079] S321. When the reduced calorie value reaches the excess calorie value, determine the recommended second serving size ratio based on the weight of the reduced ingredient. When a food image processing system reduces the weight of ingredients and the calorie reduction exceeds the recommended serving size for heterogeneous foods, it determines the appropriate serving size. Specifically, the system accumulates the calorie reduction value in real time after each weight reduction and compares it to the value exceeding the recommended calorie limit. Then, based on the ratio of the reduced weight to the original weight, the system determines a recommended second serving size. For example, if the original total weight is 500 grams and the reduced total weight is 428.3 grams, the second serving size is approximately 85.7%, which also includes the remaining proportion of the reduced ingredients.
[0080] S322. Determine the proportion of the first or second serving as dietary advice information, and feed back the final calorie information and the dietary advice information to the user.
[0081] After the food image processing system determines the first or second serving ratio, it informs the user of the relevant information. Specifically, the system uses the determined first serving ratio (for homogeneous foods) or second serving ratio (for heterogeneous foods) as dietary recommendations, depending on the food type. For example, the dietary recommendation for a homogeneous meal might be "It is recommended to consume 80% of the original food weight." The system then integrates the final calorie information (e.g., "This meal has a final calorie content of 600 kcal") with the dietary recommendations and sends this information to the user via app push notifications or other means, allowing the user to understand the food's calorie content and recommended consumption.
[0082] By employing the above technical solution, food images uploaded by the user are first acquired. A meal time series is then constructed based on the user's diet plan and matched with the target meal time. The user confirmation process further ensures the accuracy of the time matching, providing a correct benchmark for determining subsequent calorie needs. When multiple images are uploaded, primary and secondary images are cross-validated using feature vectors and resolution to improve the reliability of food recognition results. After obtaining the calorie information corresponding to the ingredients, the portion sizes are adjusted separately for homogeneous and heterogeneous foods. For heterogeneous foods, the portion sizes are reduced based on calorie priority, making the adjustments more reasonable. Simultaneously, the next meal plan is dynamically adjusted based on exercise data, making diet management more aligned with the user's condition. By adopting this technical solution, the accuracy and reliability of calculating food calorie information are improved, as are the accuracy and flexibility of adjusting food portion sizes according to the user's calorie needs.
[0083] The food image processing system in the embodiments of this invention is described below from the perspective of hardware processing. Please refer to [link / reference needed]. Figure 4 This is a schematic diagram of the physical device structure of a food image processing system in an embodiment of this application.
[0084] It should be noted that, Figure 4 The structure of the food image processing system shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0085] like Figure 4 As shown, the food image processing system includes a CPU 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory ROM 402 or a program loaded from a storage section 408 into a random access memory RAM 403, such as performing the methods described in the above embodiments. The RAM 403 also stores various programs and data required for system operation. The CPU 401, ROM 402, and RAM 403 are interconnected via a bus 404. An I / O interface 405 is also connected to the bus 404.
[0086] The following components are connected to I / O interface 405: input section 406 including audio input devices, push-button switches, etc.; output section 407 including a liquid crystal display (LCD) and audio output devices, indicator lights, etc.; storage section 408 including a hard disk, etc.; and communication section 409 including a network interface card such as a LAN (Local Area Network) card, modem, etc. Communication section 409 performs communication processing via a network such as the Internet. Drive 410 is also connected to I / O interface 405 as needed. Removable media 411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 410 as needed so that computer programs read from them can be installed into storage section 408 as needed.
[0087] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer programs for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 409, and / or installed from removable medium 411. When the computer program is executed by CPU 401, it performs the various functions defined in the present invention.
[0088] It should be noted that specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0089] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, program segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings.
[0090] Specifically, the food image processing system of this embodiment includes a processor and a memory. The memory stores a computer program. When the computer program is executed by the processor, it implements an AI-based food image processing method provided in the above embodiment.
[0091] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the food image processing system described in the above embodiments; or it may exist independently and not assembled into the food image processing system. The storage medium carries one or more computer programs that, when executed by a processor of the food image processing system, cause the food image processing system to implement an AI-based food image processing method provided in the above embodiments.
[0092] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0093] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as meaning "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as meaning "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".
[0094] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A food image processing method based on AI, characterized in that, Applied to a food image processing system, the method includes: After the user has cooked the required food according to the preset diet plan, the food image uploaded by the user is obtained. The diet plan includes information on the calorie requirements of each meal and the types and weights of ingredients for each meal. The food image is input into a preset food cooking recognition model for matching to obtain the cooking method of the food; Based on the type and weight of the ingredients, and in conjunction with a preset food database, the initial calorie information corresponding to the food is determined; Based on the cooking method and the initial calorie information, determine the final calorie information corresponding to the food; When the final calorie information exceeds the calorie requirement information, the recommended food portion ratio is adjusted and determined as dietary advice information, which includes the portion of the food to be consumed in this meal. The final calorie information and dietary recommendations are then fed back to the user.
2. The method according to claim 1, characterized in that, When the final calorie information exceeds the calorie requirement information, the recommended food portion ratio is adjusted and determined as dietary advice, specifically including: The food is determined to be either homogeneous or heterogeneous. Homogeneous food is food with a single type of ingredients or whose ingredients are difficult to separate. Heterogeneous food is food whose ingredients can be separated. If the food is a homogeneous food, calculate the ratio of the calorie requirement information to the final calorie information, and determine it as the recommended first serving size ratio; If the food is a heterogeneous food, calculate the excess calorie value of the food, and determine the consumption ratio of each ingredient of the heterogeneous food according to the calorie value corresponding to the type of ingredient, to obtain the recommended second serving ratio. The first or second serving ratio is determined as dietary advice information.
3. The method according to claim 2, characterized in that, If the food is heterogeneous, the excess calorie value of the food is calculated, and based on the calorie values corresponding to the types of ingredients, the consumption ratio of each ingredient in the heterogeneous food is determined to obtain a recommended second serving size, specifically including: The difference between the final calorie information and the calorie requirement information is calculated to obtain the excess calorie value of the food; Based on the food database and the cooking method, the unit calorie value of each of the ingredients is obtained, and a reduction priority sequence is established based on the unit calorie value. The reduction priority of each ingredient in the reduction priority sequence is arranged in descending order of the unit calorie value. Based on the reduction priority sequence and the weight of the ingredients, the weight of the ingredients is iteratively reduced starting from the ingredient with the highest reduction priority, and the calorie reduction value is calculated. When the reduced calorie value reaches the excess calorie value, a recommended second serving size is determined based on the weight of the reduced ingredients.
4. The method according to claim 1, characterized in that, The diet plan also includes meal times; After the step of acquiring the food image uploaded by the user after the user has cooked the required food according to a preset diet plan, the method further includes: Based on the meal times, a meal time sequence for the user is constructed, and the center time point of adjacent meal times in the meal time sequence is the time boundary point; Extract the acquisition time of the food image and match it with the meal time series to determine the target meal time corresponding to the food image; Based on the target meal time, determine the corresponding calorie requirement information in the diet plan.
5. The method according to claim 4, characterized in that, The step of extracting the acquisition time of the food image and matching it with the meal time series to determine the target meal time corresponding to the acquisition time specifically includes: Extract the acquisition time of the food image and match it with the meal time series to obtain the initial target meal time; The initial target dining time is fed back to the user, and the user is prompted to confirm whether the initial target dining time is correct; If the user reports that the initial target dining time is incorrect, then the user is provided with a list of adjacent dining times, which includes multiple dining times that are adjacent to the initial target dining time in the dining time sequence. The list of adjacent dining times is sent back to the user, prompting the user to select the correct target dining time; The correct target dining time is determined as the final target dining time corresponding to the food image.
6. The method according to claim 4, characterized in that, After the step of determining the corresponding calorie requirement information in the diet plan based on the target meal time, the method further includes: The user's exercise data is obtained, including the user's current calorie consumption, exercise intensity, exercise duration, and exercise type. Based on the exercise data, a post-exercise calorie demand curve is established, which is used to dynamically describe the changes in the user's calorie demand at different time periods after exercise. Based on the calorie requirement curve, the meal time and corresponding calorie requirement information for the next meal in the diet plan are adjusted and fed back to the user.
7. The method according to claim 1, characterized in that, After the step of obtaining the food image uploaded by the user after the user has cooked the required food according to the preset diet plan, the method further includes: When there are multiple food images, the image feature vector and image resolution of each food image are extracted. The image feature vector includes color distribution features, texture features, and edge features. Calculate the feature vector similarity between the food images based on the image feature vectors; If the similarity of the feature vectors is greater than a preset similarity threshold, then the food images are determined to contain the same food. The food image with the highest resolution is designated as the main image, and the other food images are designated as auxiliary images. The main image and the auxiliary image are cross-validated to improve the reliability of food recognition results.
8. A food image processing system, characterized in that, The food image processing system includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the food image processing system to perform the method as described in any one of claims 1-7.
9. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on the food image processing system, the food image processing system performs the method as described in any one of claims 1-7.
10. A computer program product, characterized in that, When the computer program product is run on the food image processing system, the food image processing system performs the method as described in any one of claims 1-7.
Citation Information
Cited By
Food calorie identification method and system based on combination of large model and database
CN121305551A
A food calorie recognition method and system based on a large model combined with a database
CN121305551B