Big language model-based diet data analysis method and device

By using large language models and deep learning technology, combined with natural language interaction and automatic database updates, the problems of data lag and lack of personalization in existing diet management have been solved, realizing personalized and dynamic diet management and improving the health and eating effects of users.

CN121460076APending Publication Date: 2026-02-03PEOPLES HOSPITAL PEKING UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511354254.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-22
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

Existing dietary management technologies rely on manual consultation or static plans, which cannot respond to user needs in real time, have lagging data updates, cannot understand users' unstructured preferences, and lack personalization and dynamic adjustment. This results in a large deviation between dietary plans and actual needs, making it difficult to maintain a healthy diet in the long term.

Method used

The system employs a large language model for user data collection, health diet database construction and maintenance, combined with nutritional goal generation and personalized feedback. It obtains user information through natural language interaction, dynamically adjusts diet plans, regularly updates the database using a web crawler module, and uses a deep learning model to identify dietary records, providing personalized feedback and suggestions.

Benefits of technology

It enables automatic updates and personalized feedback of the healthy eating database, dynamically adjusts diet plans, improves the personalization and intelligence of diet management, enhances user acceptance and willingness to implement, and helps users optimize their diet in a timely manner to achieve their health goals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121460076A_ABST
    Figure CN121460076A_ABST
Patent Text Reader

Abstract

The invention discloses a diet data analysis method and device based on a large language model, and belongs to the technical field of diet data analys.The method comprises the steps that user basic information and taste preferences described by natural languages are collected through a user interface; unstructured data of food is captured regularly, and a healthy diet database is constructed after large language model cleaning and tagging processing; basic metabolic rate and daily total energy consumption are calculated in combination with the basic information of the user, and a nutrient intake target is determined; the big language model application layer generates a daily diet plan containing cooking suggestions; and receiving the diet recorded by the user photographing or natural language, analyzing the diet, comparing the analyzed diet with the nutrition target, and generating personalized feedback containing problems, reasons and adjustment suggestions. The device correspondingly comprises five functional modules. According to the invention, automatic maintenance and personalized analysis of diet data are realized, and intelligence and practicability of diet management are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of dietary data analysis technology, specifically relating to a dietary data analysis method and apparatus based on a large language model. Background Technology

[0002] With the fast pace of life, people are paying increasing attention to healthy eating. However, existing dietary management techniques have significant limitations and are unable to meet actual needs. Specific problems are as follows:

[0003] Traditional dietary management relies on human consultations with nutritionists or static diet plans. The former is costly and cannot respond in real time, while the latter only provides preset, general plans, lacking personalization and flexibility, and cannot dynamically adjust based on the user's real-time dietary records, taste preferences, and health status. Existing technologies largely depend on manually maintained fixed databases or knowledge graphs, with food information updates relying on manual operation, resulting in poor timeliness, incomplete coverage, and difficulty in incorporating new foods and the latest nutritional data, affecting the accuracy of the plans. Current technologies rely on rule matching or graph reasoning based on structured data, failing to understand unstructured natural language preferences such as "wanting to eat light but not too bland," leading to dietary plans that deviate significantly from the user's actual needs. Most systems only provide static diet plans; after the user records their diet, the system's feedback is mechanical, unable to analyze the reasons for discrepancies or dynamically adjust subsequent plans, making it difficult to help users maintain a healthy diet long-term. Summary of the Invention

[0004] In view of this, the purpose of this invention is to propose a method and apparatus for dietary data analysis based on a large language model, so as to solve or partially solve the problems mentioned in the background art.

[0005] To achieve the above objectives, in a first aspect, the present invention provides a method for analyzing dietary data based on a large language model, comprising the following steps:

[0006] User data collection: Collect basic user information and taste preferences through the user interface. The basic information includes age, gender, height, weight, health status, exercise level and health goals. The taste preferences are obtained through natural language dialogue.

[0007] Healthy Eating Database Construction and Maintenance: Regularly scrape unstructured data, including food names, pictures, nutritional components, calories, and cooking methods, from designated websites. Input the unstructured data into a large language model. The large language model cleans and formats the unstructured data according to preset data cleaning and tagging prompts. Tag each food item with information including flavor, energy, protein, fat, and carbohydrates. Store the processed data in the healthy eating database.

[0008] Nutritional Goal Generation: The nutritional goal generation algorithm is called weekly. Combined with the collected user basic information, the user's basal metabolic rate and daily total energy consumption are calculated. Based on the daily total energy consumption, the intake targets for protein, fat, and carbohydrates are determined to form the user's daily nutritional goals for the week.

[0009] Weekly meal plan generation: The obtained nutritional goals, taste preferences and data from the healthy diet database are input into the big language model application layer. The big language model application layer generates prompt words according to the preset meal plan and generates a meal plan including breakfast, lunch, dinner and snacks. The meal plan includes specific cooking suggestions.

[0010] Personalized Feedback and Suggestions: The system receives daily dietary records from users via photo recognition or natural language description. For photo recognition, the food photos are input into a trained deep learning model, which outputs the food name, weight, and nutritional information. For natural language description, the system uses a large language model to extract nutritional information from the dietary records. The dietary records are compared with the daily nutritional goals to obtain discrepancy data. This discrepancy data, the daily nutritional goals, and taste preferences are input into the large language model application layer. The large language model application layer generates personalized feedback, including problem identification, explanations of causes, and specific adjustment suggestions, based on preset personalized feedback prompts.

[0011] As a preferred approach for dietary data analysis based on large language models, the process involves periodically scraping unstructured data, including food names, images, nutritional information, calories, and cooking methods, from designated websites:

[0012] The unstructured data is crawled from mainstream food websites and nutrition websites according to the crawling cycle using a web crawling module. The mainstream food websites include comprehensive food sharing platforms, local specialty food recommendation websites, and food recipe sharing websites. The nutrition websites include nutrition science popularization platforms operated by institutions and professional nutrition database websites.

[0013] The unstructured data crawled by the crawler module includes the standard name of the food, actual pictures, nutritional components per 100 grams of edible portion, calorie value per 100 grams of edible portion, weight distribution of each ingredient in each dish, and amount of seasonings. When the food information update frequency of the target crawling website is detected to be more than once a week, the crawling cycle will be adjusted to once every 3 days. When the food information update frequency of the target crawling website is detected to be less than 5 items per month, the crawling cycle will be adjusted to once every two weeks.

[0014] As a preferred approach for dietary data analysis based on large language models, the nutritional target generation algorithm is invoked weekly. Combined with the collected basic user information, the user's basal metabolic rate and daily total energy expenditure are calculated. The formula for calculating the male basal metabolic rate is as follows:

[0015] BMR=(10×W)+(6.25×H)-(5×A)+5

[0016] The formula for calculating a woman's basal metabolic rate is:

[0017] BMR=(10×W)+(6.25×H)-(5×A)-161

[0018] The formula for calculating total daily energy expenditure is:

[0019] TDEE = BMR × 1.375

[0020] In the formula, BMR represents basal metabolic rate, W represents user weight, H represents user height, A represents user age, and TDEE represents total daily energy expenditure.

[0021] As a preferred approach for dietary data analysis based on large language models, the formula used in determining the intake targets for protein, fat, and carbohydrates based on daily total energy expenditure is:

[0022] Nutrient = TDEE × K

[0023] In the formula, Nutrient represents the intake of a single nutrient, TDEE represents the total daily energy expenditure, and K represents the percentage coefficient of the corresponding nutrient.

[0024] When the nutrient is protein, the default value of K is 0.18, and the protein intake is Protein = TDEE × 0.18.

[0025] When the nutrient is fat, the default value of K is 0.27, and the fat intake Fat = TDEE × 0.27;

[0026] When the nutrient is carbohydrate, the default value of K is 0.55, and the carbohydrate intake is: Carbohydrate = TDEE × 0.55;

[0027] The proportion coefficient K is adaptively adjusted according to the user's health goals, and the sum of the proportion coefficients of protein, fat and carbohydrates after adjustment is 1.

[0028] As a preferred solution for dietary data analysis based on a large language model, the large language model application layer generates prompt words according to a preset dietary plan. During the process of generating a dietary plan including breakfast, lunch, dinner and snacks, the dietary plan output by the large language model application layer adopts JSON format. The JSON format includes at least three independent meal segment data objects, each meal segment data object corresponds to a meal time period, and the meal time period is any one of breakfast, lunch, dinner and snacks.

[0029] Each meal segment data object includes three required fields: "Time Segment", "Food Name", and "Serving Size". The "Time Segment" field is labeled with the corresponding meal time in text form. The "Food Name" field is listed as an array of all food names within that time segment. The "Serving Size" field is listed as an array corresponding to the food in the "Food Name" field, indicating the specific weight of each food item. The number of elements in the "Serving Size" array is consistent with the number of elements in the "Food Name" array.

[0030] The weight unit in the "Quantity" field is in grams by default. Users can switch to milligrams, kilograms, or ounces according to their usage habits. After the unit is switched, the value of the "Quantity" field will be converted to the new unit.

[0031] As a preferred approach for dietary data analysis based on a large language model, the process of extracting nutritional element information from dietary records using the large language model includes:

[0032] The large language model first receives the user's input of food records in natural language text. Following the preset instructions for extracting nutritional elements and labeling flavor tags, it extracts the name of each food, the corresponding serving size, and the energy, protein, fat, and carbohydrate content per 100 grams of edible portion from the natural language text, and labels the flavor attributes of each food.

[0033] Secondly, the present invention also provides a diet data analysis device based on a large language model, comprising:

[0034] The user data collection module is used to collect basic user information and taste preferences through the user interface. The basic information includes age, gender, height, weight, health status, exercise level and health goals. The taste preferences are obtained through natural language dialogue.

[0035] The healthy diet database construction and maintenance module is used to periodically crawl unstructured data including food names, pictures, nutritional components, calories and cooking methods from a set website. The unstructured data is input into a large language model. The large language model cleans and formats the unstructured data according to preset data cleaning and tagging prompts, and tags each food with information including flavor, energy, protein, fat and carbohydrates. The processed data is then stored in the healthy diet database.

[0036] The nutrition goal generation module is used to call the nutrition goal generation algorithm weekly, combine the collected user basic information, calculate the user's basal metabolic rate and daily total energy consumption, and then determine the intake goals of protein, fat and carbohydrates based on the daily total energy consumption to form the user's daily nutrition goals for the week.

[0037] The weekly diet plan generation module is used to input the obtained nutritional goals, taste preferences and data from the healthy diet database into the big language model application layer. The big language model application layer generates prompt words according to the preset diet plan and generates a diet plan including breakfast, lunch, dinner and snacks. The diet plan includes specific cooking suggestions.

[0038] The personalized feedback and suggestion module receives daily dietary records input by users through photo recognition or natural language description. For photo recognition, the food photo is input into a trained deep learning model, which outputs the food name, weight, and nutritional information. For natural language description, the large language model extracts nutritional information from the dietary record. The dietary record is compared with the daily nutritional goals to obtain discrepancy data. This discrepancy data, the daily nutritional goals, and taste preferences are input into the large language model application layer. The large language model application layer generates personalized feedback, including problem identification, explanation of reasons, and specific adjustment suggestions, based on preset personalized feedback prompts.

[0039] As a preferred embodiment of a diet data analysis device based on a large language model, the healthy diet database construction and maintenance module includes:

[0040] The unstructured data is crawled from mainstream food websites and nutrition websites according to the crawling cycle using a web crawling module. The mainstream food websites include comprehensive food sharing platforms, local specialty food recommendation websites, and food recipe sharing websites. The nutrition websites include nutrition science popularization platforms operated by institutions and professional nutrition database websites.

[0041] The unstructured data crawled by the crawler module includes the standard name of the food, actual pictures, nutritional components per 100 grams of edible portion, calorie value per 100 grams of edible portion, weight distribution of each ingredient in each dish, and amount of seasonings. When the food information update frequency of the target crawling website is detected to be more than once a week, the crawling cycle will be adjusted to once every 3 days. When the food information update frequency of the target crawling website is detected to be less than 5 items per month, the crawling cycle will be adjusted to once every two weeks.

[0042] As a preferred embodiment of a dietary data analysis device based on a large language model, the formula for calculating the male basal metabolic rate in the nutritional target generation module is as follows:

[0043] BMR=(10×W)+(6.25×H)-(5×A)+5

[0044] The formula for calculating a woman's basal metabolic rate is:

[0045] BMR=(10×W)+(6.25×H)-(5×A)-161

[0046] The formula for calculating total daily energy expenditure is:

[0047] TDEE = BMR × 1.375

[0048] In the formula, BMR represents basal metabolic rate, W represents user weight, H represents user height, A represents user age, and TDEE represents total daily energy expenditure.

[0049] As a preferred embodiment of a dietary data analysis device based on a large language model, the nutritional target generation module uses the following formula to determine the intake targets for protein, fat, and carbohydrates based on daily total energy consumption:

[0050] Nutrient = TDEE × K

[0051] In the formula, Nutrient represents the intake of a single nutrient, TDEE represents the total daily energy expenditure, and K represents the percentage coefficient of the corresponding nutrient.

[0052] When the nutrient is protein, the default value of K is 0.18, and the protein intake is Protein = TDEE × 0.18.

[0053] When the nutrient is fat, the default value of K is 0.27, and the fat intake Fat = TDEE × 0.27;

[0054] When the nutrient is carbohydrate, the default value of K is 0.55, and the carbohydrate intake is: Carbohydrate = TDEE × 0.55;

[0055] The proportion coefficient K is adaptively adjusted according to the user's health goals, and the sum of the proportion coefficients of protein, fat and carbohydrates after adjustment is 1.

[0056] As a preferred embodiment of the diet data analysis device based on the large language model, in the weekly diet plan generation module, the diet plan output by the large language model application layer adopts JSON format. The JSON format includes at least three independent meal segment data objects, each meal segment data object corresponds to a meal time period, and the meal time period is any one of breakfast, lunch, dinner and snack.

[0057] Each meal segment data object includes three required fields: "Time Segment", "Food Name", and "Serving Size". The "Time Segment" field is labeled with the corresponding meal time in text form. The "Food Name" field is listed as an array of all food names within that time segment. The "Serving Size" field is listed as an array corresponding to the food in the "Food Name" field, indicating the specific weight of each food item. The number of elements in the "Serving Size" array is consistent with the number of elements in the "Food Name" array.

[0058] The weight unit in the "Quantity" field is in grams by default. Users can switch to milligrams, kilograms, or ounces according to their usage habits. After the unit is switched, the value of the "Quantity" field will be converted to the new unit.

[0059] As a preferred embodiment of a diet data analysis device based on a large language model, the personalized feedback and suggestion module includes:

[0060] The large language model first receives the user's input of food records in natural language text. Following the preset instructions for extracting nutritional elements and labeling flavor tags, it extracts the name of each food, the corresponding serving size, and the energy, protein, fat, and carbohydrate content per 100 grams of edible portion from the natural language text, and labels the flavor attributes of each food.

[0061] Thirdly, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the dietary data analysis method based on a large language model, as described in the first aspect or any possible implementation thereof.

[0062] Fourthly, the present invention provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform steps in the dietary data analysis method based on a large language model, as described in the first aspect or any possible implementation thereof.

[0063] The beneficial effects of the technical solution provided by this invention are as follows:

[0064] First, this invention combines a large language model to complete data cleaning, formatting, and tagging, constructing and automatically maintaining a healthy diet database without relying on manual updates. This effectively solves the problems of outdated and incomplete database coverage in existing technologies, ensuring that information such as the nutritional components, calories, and cooking methods of food remains timely and comprehensive, providing accurate data support for the generation of subsequent diet plans.

[0065] Secondly, this invention obtains users' complex taste preferences through natural language dialogue and captures users' unstructured needs; at the same time, it generates nutritional goals by combining basic information such as users' age, gender, and health goals. The final generated diet plan not only meets nutritional needs but also deeply matches users' taste preferences, overcoming the shortcomings of existing technologies that are based solely on structured data and lack personalization, thereby improving users' acceptance and willingness to implement the diet plan.

[0066] Third, after users record their daily diet through photo recognition or natural language description, the system analyzes the difference between their actual diet and their daily nutritional goals. This not only identifies problems but also explains the reasons and provides specific adjustment suggestions. At the same time, it dynamically adjusts subsequent diet plans, breaking the limitations of existing static plans and forming a dynamic cycle of plan generation, diet recording, difference analysis, and feedback adjustment. This helps users optimize their diet in a timely manner and more easily achieve their health goals.

[0067] Fourth, this invention achieves full-process coverage from user data collection and healthy diet database maintenance to nutritional goal setting, diet plan generation, and diet record analysis and personalized feedback, forming a complete closed-loop system. Compared with existing technologies that solely use machine learning or knowledge graphs, this invention has stronger overall technical synergy, providing users with a one-stop, full-chain intelligent diet management service, improving the efficiency and effectiveness of diet management.

[0068] Fifth, it interacts with users using natural and friendly language, avoiding the mechanical command-style interaction of traditional systems; at the same time, the feedback content includes explanations related to nutritional knowledge, which not only helps users adjust their diet, but also improves their health awareness and cultivates long-term healthy eating habits, making it both practical and educational. Attached Figure Description

[0069] To more clearly illustrate the technical solutions in this invention or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0070] Figure 1A schematic diagram illustrating the technical route of the dietary data analysis method based on a large language model provided in an embodiment of the present invention;

[0071] Figure 2 A schematic diagram of the process for a dietary data analysis method based on a large language model provided in an embodiment of the present invention;

[0072] Figure 3 A schematic diagram of the architecture of a diet data analysis device based on a large language model provided in an embodiment of the present invention;

[0073] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0074] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to specific embodiments and accompanying drawings.

[0075] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this invention should have the ordinary meaning understood by those skilled in the art to which this invention pertains. The terms "comprising" or "including," or similar words used in the embodiments of this invention, mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects.

[0076] With the ever-accelerating pace of modern life, the public is paying increasing attention to healthy eating, and diet management is gradually becoming an important means of maintaining physical health and achieving personalized health goals such as weight loss and muscle gain. However, existing diet management technologies and related systems still have many limitations, making it difficult to meet users' needs for personalized, dynamic, and intelligent diet services. Specific problems are as follows:

[0077] Traditional dietary management primarily relies on two methods: consulting nutritionists or using static diet plan apps. While nutritionist services can offer some personalized advice, they suffer from high service costs, low response rates, and an inability to respond in real time to users' daily dietary adjustment needs. Furthermore, their service coverage is limited, making it difficult to meet the needs of large-scale users. On the other hand, most static diet plan apps only provide preset, general dietary plans with fixed content. These plans cannot be dynamically adjusted based on users' real-time dietary records, changes in taste preferences, and fluctuations in health status, resulting in a severe lack of flexibility.

[0078] Current mainstream dietary recommendation technologies largely rely on fixed, manually maintained databases or knowledge graphs for their data. Under this data storage model, updates to information such as food nutritional components, calorie values, and cooking methods depend entirely on manual input and review. This not only results in long update cycles and difficulty in incorporating newly emerging food categories or nutritional data from the latest nutritional research, but also suffers from incomplete data coverage. Consequently, it fails to meet users' needs for diverse and timely food information, thus impacting the accuracy and practicality of dietary recommendations.

[0079] Existing dietary management technologies, when addressing personalized user needs, largely rely on rule matching or graph reasoning based on structured data. This makes it difficult to understand the complex dietary preferences expressed by users through natural language. For example, when users express unstructured needs such as "I want to eat light food but not too bland" or "I want spicy food but avoid overly oily food," existing technologies cannot accurately capture the details of these needs. This results in dietary plans that deviate from the user's actual preferences, leading to low personalization and poor user acceptance and experience.

[0080] Most existing diet systems only provide users with a one-time, static diet plan. After users record their actual food intake, the system can only simply compare the difference between the plan and the actual intake. The feedback is mechanical and cannot deeply analyze the reasons for the difference, nor can it dynamically adjust subsequent diet plans based on the difference data. This one-way process of plan generation, recording, and feedback lacks a complete closed-loop management mechanism, making it difficult to help users maintain healthy eating habits in the long term, and the effect of diet management is limited.

[0081] It is evident that existing dietary management technologies have significant shortcomings in data updates, demand understanding, dynamic adjustments, and closed-loop management. There is an urgent need for an intelligent dietary data analysis technology capable of automatic database updates, deep understanding of complex user needs, and provision of dynamic feedback and closed-loop services to address these technical pain points and improve the personalization and intelligence of dietary management. The following are the specific details of the invention's embodiments.

[0082] See Figure 1 and Figure 2 This invention provides a method for analyzing dietary data based on a large language model, comprising the following steps:

[0083] S1. User Data Collection: Collect basic user information and taste preferences through the user interface. The basic information includes age, gender, height, weight, health status, exercise level, and health goals. The taste preferences are obtained through natural language dialogue.

[0084] Specifically, from a data type perspective, basic information is structured data, such as age and height, which are explicit numerical data. Health status and exercise level can be quantified through preset options or gradations. This type of data is the core basis for calculating nutritional goals, directly related to the body's metabolic patterns and energy needs. Taste preferences are obtained through natural language dialogue because users' complex dietary needs, such as "wanting to eat light but with a hint of umami" or "avoiding spicy but accepting a slight numbing sensation," are difficult to fully express through structured tags. Natural language can preserve the details and flexibility of needs, and the semantic understanding capabilities of large language models can be used to analyze the implicit preferences, solving the problem of incomplete preference capture in traditional technologies. From an interaction logic perspective, the user interface adopts a lightweight design to lower the data input threshold and ensure the accuracy of basic information collection. Taste preference dialogue uses guided questions, such as "Do you have any food restrictions?" and "What kind of flavor of dishes do you prefer?" to reduce user input costs and improve data collection efficiency and completeness.

[0085] S2. Construction and maintenance of a healthy diet database: Regularly scrape unstructured data, including food names, pictures, nutritional components, calories, and cooking methods, from a designated website. Input the unstructured data into a large language model. The large language model cleans and formats the unstructured data according to preset data cleaning and tagging prompts. Tag each food item with information including flavor, energy, protein, fat, and carbohydrates. Store the processed data in the healthy diet database.

[0086] Specifically, websites such as mainstream food websites and nutrition websites are chosen because these platforms offer timely, comprehensive, and detailed data. Food websites contain information on dishes actually consumed by users, while nutrition websites provide authoritative nutritional data. Combining the two ensures that the database covers both "daily dietary scenarios" and "professional nutritional standards." From a data processing perspective, the large language model's role is to achieve "structured transformation of unstructured data": unstructured data lacks a unified format, requiring pre-set prompts to guide the model in information extraction. Simultaneously, the model can also perform data cleaning and tagging, ultimately forming standardized data entries stored in the database, providing a high-quality, "searchable and matchable" data foundation for subsequent diet plan generation.

[0087] S3. Nutrition Goal Generation: The nutrition goal generation algorithm is called weekly. Combined with the collected user basic information, the user's basal metabolic rate and daily total energy consumption are calculated. Based on the daily total energy consumption, the intake targets for protein, fat, and carbohydrates are determined to form the user's daily nutrition goals for the week.

[0088] Specifically, the Basal Metabolic Rate (BMR) calculation essentially estimates the minimum energy required for the human body to maintain life in a state of wakefulness and extreme rest, based on physiological parameters such as gender, age, height, and weight. This forms the basis for subsequent calculations of total energy expenditure. Since metabolic rates differ between genders and ages, different calculation formulas are needed for each gender to ensure accuracy. Total Daily Energy Expenditure (TDEE) is calculated by multiplying the user's activity level by a corresponding coefficient based on the BMR, reflecting the total energy required for daily activities. This step avoids the problem of mismatch between energy intake and actual expenditure caused by setting targets solely based on basal metabolic rate. Nutrient intake target calculation allocates TDEE proportionally to protein, fat, and carbohydrates. This proportion references generally accepted nutritional standards and allows for adjustments based on health goals, ensuring that the target aligns with nutritional balance principles while helping users achieve specific health objectives.

[0089] S4. Weekly meal plan generation: Input the obtained nutritional goals, taste preferences and data from the healthy diet database into the big language model application layer. The big language model application layer generates prompt words according to the preset meal plan and generates a meal plan including breakfast, lunch, dinner and snacks. The meal plan includes specific cooking suggestions.

[0090] Specifically, nutritional goals are the "hard constraints," taste preferences, such as "liking Sichuan cuisine but not eating cilantro," are the "soft adaptation conditions," and the healthy eating database serves as the "candidate resource pool." Combining these three elements ensures that the plan meets both scientific nutritional standards and aligns with the user's dietary preferences. From the perspective of the large language model's working logic, the preset prompts guide the model through data matching, solution combination, and text generation: the prompts explicitly instruct the model to select ingredients / dishes from the database that match the nutritional goals and taste preferences, then combine them according to the time-segment logic of "breakfast-lunch-dinner-snack." For example, breakfast should be convenient and easily digestible, perhaps with oatmeal and eggs; dinner should be light and low-calorie, perhaps with steamed fish and vegetables, while generating specific cooking suggestions. This step utilizes the model's text generation capabilities to transform the "data matching results" into a natural language plan that is "understandable and executable by the user," avoiding the problem of overly abstract plans and difficult-to-operate plans in traditional technologies.

[0091] S5. Personalized Feedback and Suggestions: Receive daily dietary records input by users via photo recognition or natural language description; if photo recognition is used, input the food photo into the trained deep learning model, and output the food name, weight, and nutritional information; if natural language description is used, extract nutritional information from the dietary record using the large language model; compare the dietary record with the daily nutritional goals to obtain difference data, and input the difference data, daily nutritional goals, and taste preferences into the large language model application layer. The large language model application layer generates personalized feedback, including problem identification, explanation of reasons, and specific adjustment suggestions, according to preset personalized feedback prompts.

[0092] Specifically, the food record input supports both photo and natural language input methods, covering different user scenarios: Photo recognition relies on a trained deep learning model to identify food appearance features such as shape, color, and texture to determine the food name, then estimates the weight by combining the food volume in the image with reference objects, and finally retrieves nutritional information from a database, suitable for scenarios where "users find it inconvenient to input text"; Natural language description reuses the semantic understanding capabilities of a large language model to extract food names and portions from text, suitable for scenarios where "users can clearly describe their diet". Combining the two methods improves the convenience and coverage of recording. Discrepancy analysis compares actual nutrient intake with daily targets to identify "deficiencies" or "excesses," providing a basis for subsequent feedback. The large language model not only points out problems but also explains the reasons and provides specific adjustment suggestions based on taste preferences. This feedback model, combining problems, causes, and suggestions, helps users understand the essence of dietary issues, while increasing their willingness and ability to make adjustments, solving the problems of mechanical feedback and difficulty in user improvement in traditional technologies.

[0093] In one possible embodiment, during step S2, the process of periodically crawling unstructured data including food names, images, nutritional components, calories, and cooking methods from designated websites involves: using a crawler module to crawl the unstructured data from mainstream food websites and nutrition websites according to a crawling cycle. The mainstream food websites include comprehensive food sharing platforms, local specialty food recommendation websites, and food recipe sharing websites. The nutrition websites include institutionally operated nutrition science popularization platforms and professional nutrition database websites. The unstructured data crawled by the crawler module includes the standard name of the food, actual images, nutritional components per 100 grams of edible portion, calorie value per 100 grams of edible portion, weight distribution of each ingredient in each dish, and amount of seasonings. When the food information update frequency of the target crawling website is detected to be more than once a week, the crawling cycle is adjusted to once every 3 days; when the monthly update frequency of the food information of the target crawling website is detected to be less than 5 items, the crawling cycle is adjusted to once every two weeks.

[0094] Specifically, in terms of data source selection, the data is categorized into "mainstream food websites" and "nutrition websites" to ensure "scenario completeness" and "authoritative accuracy": comprehensive food sharing platforms cover various dishes nationwide and even globally, while local specialty food recommendation websites can supplement regional ingredients and dishes, avoiding "regional limitations" in the database; institutionally operated nutrition science popularization platforms and professional nutrition database websites provide verified authoritative data, which can correct potential nutritional data errors in food websites, ensuring the scientific validity of the database data. Regarding crawling strategies, the core of dynamically adjusting the cycle is balancing data timeliness and resource consumption: when a website updates frequently, such as more than once a week, it may be due to the launch of new products or updates to nutritional data; shortening the crawling cycle allows for timely inclusion of new data. When a website updates slowly, extending the crawling cycle reduces the number of server requests, lowers the resource consumption of the crawler module, avoids ineffective crawling, and achieves the goal of on-demand crawling and efficient maintenance.

[0095] In one possible embodiment, in step S3, the nutrition target generation algorithm is invoked weekly, and the user's basal metabolic rate and daily total energy consumption are calculated using the collected basic user information. The formula for calculating the male basal metabolic rate is as follows:

[0096] BMR=(10×W)+(6.25×H)-(5×A)+5

[0097] The formula for calculating a woman's basal metabolic rate is:

[0098] BMR=(10×W)+(6.25×H)-(5×A)-161

[0099] The formula for calculating total daily energy expenditure is:

[0100] TDEE = BMR × 1.375

[0101] In the formula, BMR represents basal metabolic rate, W represents user weight, H represents user height, A represents user age, and TDEE represents total daily energy expenditure.

[0102] Specifically, the basal metabolic rate (BMR) formula uses the Mifflin-StJeor formula, one of the commonly used BMR estimation formulas in nutrition. This formula has been validated by a large amount of clinical data, has a small estimation error, and is suitable for the general population. Different constants are set for men and women: +5 for men and -161 for women. This is because men and women have different body composition, resulting in different basal metabolic requirements. For example, men of the same height, weight, and age usually have more muscle mass than women, and therefore require more energy to maintain their basal metabolic rate. Clearly defined parameters avoid calculation errors caused by "unit confusion." For example, if the height unit is mistakenly written as "meters" without conversion to "centimeters," it will lead to a serious deviation in the BMR calculation result. The coefficient 1.375 in the TDEE formula corresponds to the "light activity" level. This coefficient is set with reference to the World Health Organization's (WHO) classification standard for human activity levels. Light activity usually refers to "exercising 1-3 times a week, with daily activities mainly sedentary," covering the activity scenarios of most ordinary users and ensuring that the TDEE calculation matches the user's actual lifestyle.

[0103] In one possible embodiment, in step S3, during the process of determining the intake targets for protein, fat, and carbohydrates based on total daily energy expenditure, the following formula is used:

[0104] Nutrient = TDEE × K

[0105] In the formula, Nutrient represents the intake of a single nutrient, TDEE represents the total daily energy expenditure, and K represents the percentage coefficient of the corresponding nutrient.

[0106] When the nutrient is protein, the default value of K is 0.18, and the protein intake is Protein = TDEE × 0.18.

[0107] When the nutrient is fat, the default value of K is 0.27, and the fat intake Fat = TDEE × 0.27;

[0108] When the nutrient is carbohydrate, the default value of K is 0.55, and the carbohydrate intake is: Carbohydrate = TDEE × 0.55;

[0109] The proportion coefficient K is adaptively adjusted according to the user's health goals, and the sum of the proportion coefficients of protein, fat and carbohydrates after adjustment is 1.

[0110] Specifically, the general formula Nutrient = TDEE × K proportionally allocates the "Total Energy Requirement" to the three macronutrients. This framework is simple, easy to understand, and convenient for calculation, while unifying the calculation logic for the three macronutrients and avoiding the increased complexity caused by using different formulas for each nutrient. A protein intake of 18% meets the needs of muscle repair and immunity in adults. For example, the recommended daily protein intake for an average adult is 0.8-1.2 grams per kilogram of body weight, which can be covered by TDEE × 0.18. A fat intake of 27% meets the healthy standard of "fat providing 20%-30% of energy" and ensures the intake of essential fatty acids. A carbohydrate intake of 55% is because carbohydrates are the body's main energy source, especially suitable for daily activities. Finally, the ratio adjustment mechanism is designed to suit different health goals: for example, users who are trying to lose weight can lower the carbohydrate ratio to 0.5 while increasing the protein ratio to 0.2 to increase satiety and reduce muscle loss; users who are trying to gain muscle can increase the protein ratio to 0.25 to ensure the raw materials needed for muscle synthesis; the sum of the adjusted ratios is 1, which can ensure that the total energy intake of the three macronutrients is equal to TDEE, avoid energy excess or deficiency, and ensure nutritional balance and consistency with the goals.

[0111] In one possible embodiment, in step S4, the large language model application layer generates prompts according to a preset diet plan. During the process of generating a diet plan including breakfast, lunch, dinner, and snacks, the diet plan output by the large language model application layer adopts JSON format. The JSON format includes at least three independent meal segment data objects, each meal segment data object corresponding to a meal time period, which can be any one of breakfast, lunch, dinner, and snacks. Each meal segment data object includes three required fields: "Time Period", "Food Name", and "Serving Size". The "Time Period" field marks the corresponding meal time period in text form, the "Food Name" field lists all food names in the time period in array form, and the "Serving Size" field corresponds to the food in the "Food Name" field in array form, indicating the specific consumption weight of each food. The number of elements in the "Serving Size" array is consistent with the number of elements in the "Food Name" array. The weight unit of the "Serving Size" field is in grams by default, and can be switched to milligrams, kilograms, or ounces according to the user's usage habits. After the unit is switched, the value of the "Serving Size" field is converted to the unit synchronously.

[0112] Specifically, JSON was chosen as the output format because it is lightweight, easy to parse, and cross-platform compatible. If the meal plan is subsequently synchronized to different terminals such as mobile apps and web pages, the JSON format can be quickly parsed by various programming languages, facilitating terminal display and data storage. Simultaneously, JSON's key-value pair structure clearly defines meal segment data objects (e.g., "Time Slot" corresponds to "Breakfast," and "Food Name" corresponds to ["Milk," "Egg"]), avoiding data confusion. The design of required fields and array formats ensures data integrity and relevance: the "Time Slot" field clearly specifies the meal time, allowing users to execute according to the time; the "Food Name" field lists multiple foods in array format, conforming to the common scenario of "multiple foods in one meal"; the "Serving Size" array has the same number of elements as the "Food Name" array, establishing a one-to-one correspondence between "food" and "serving size," avoiding the problem of "users not knowing how much of each food to eat." Finally, the unit switching and conversion mechanism is adapted to the usage habits of different users: for example, Chinese users are used to using "gram" as the weight unit, while some overseas users are used to using "ounce". After supporting unit switching, the numerical conversion will be completed automatically to ensure that the weight data seen by users is consistent with their own cognition and reduce the understanding cost.

[0113] In one possible embodiment, in step S5, during the process of extracting nutritional information from the diet record using the large language model: the large language model first receives the natural language text of the diet record input by the user, and extracts the name of each food, the corresponding serving size, and the energy, protein, fat, and carbohydrate content per 100 grams of edible portion from the natural language text according to the preset nutritional element extraction and flavor labeling prompts, and labels the flavor attributes of each food.

[0114] Specifically, the role of prompts is to "clarify the task boundaries and output requirements for the model": natural language text may contain redundant information, and prompts guide the model to ignore irrelevant information and focus on core elements. Simultaneously, the model is required to correlate data with a healthy diet database to ensure the accuracy and authority of the extracted nutritional information. Secondly, the core of multi-dimensional information extraction is to "provide complete data for subsequent difference analysis and feedback generation": extracting "food name" and "portion" is for calculating the actual total energy and nutrients ingested; extracting "nutrient content per 100 grams" addresses situations where "portion is unclear"; and labeling "taste attributes" is to recommend adjustment schemes "suitable to user tastes" in feedback suggestions. The entire process utilizes the contextual understanding and information extraction capabilities of the large language model to transform "vague natural language descriptions" into "precise structured nutritional data," providing reliable input for the feedback and adjustment phase of dietary management.

[0115] The application scenarios of this invention are as follows:

[0116] Scenario 1: Personal Health and Diet Self-Management

[0117] This scenario primarily targets ordinary individual users with needs such as weight loss, muscle gain, chronic disease management, and developing healthy eating habits. After users complete basic information entry and describe their taste preferences through the terminal, a weekly diet plan is automatically generated, including specific food combinations and cooking suggestions for breakfast, lunch, dinner, and snacks, solving the user's problem of "not knowing what to eat or how to eat healthily." In daily diet, users record their actual meals by taking photos or using natural language descriptions. The system quickly analyzes the nutritional components of the food, compares them with the daily nutritional goals, and generates feedback including problem identification, explanations, and adjustment suggestions to help users optimize their diet in real time and maintain healthy eating habits in the long term. At the same time, the system's healthy diet database is regularly updated with food information to ensure that the diet plan always matches the user's actual eating situation and avoids a disconnect between plan and reality.

[0118] Scenario 2: Family Diet Planning and Nutritional Balance

[0119] For multi-member families, this invention enables "one-person input, family-adapted" meal planning. After entering the basic information and taste preferences of each member, the system generates a weekly family meal plan based on multi-user data, balancing individual needs with shared food resources. For example, it designs low-GI (glycemic index) dishes for elderly people who need to control their blood sugar, and provides high-protein, high-calcium foods for growing children, while ensuring that family members share some ingredients to reduce waste. During daily recording, the system allows the family to record all meals together, analyze the nutritional intake of each member, and generate feedback suggestions for issues such as insufficient calcium intake in the elderly and vitamin C deficiency in children. This helps families achieve a combination of personalized and shared meal management, reducing the complexity and time cost of family meal planning.

[0120] Scenario 3: Professional Nutritionist Assistance Service

[0121] In professional service scenarios such as nutritionist studios and health management institutions, this invention can serve as a highly efficient auxiliary tool for nutritionists, improving service efficiency and personalization. In traditional services, nutritionists need to manually calculate the basal metabolic rate for each user, design diet plans, and analyze dietary records, which is time-consuming and prone to errors. With this invention, nutritionists only need to guide users to complete basic information and preference input, and the system automatically calls a nutrition goal generation algorithm to calculate the basal metabolic rate and daily total energy consumption based on parameters such as the user's gender and age, and proportionally determine the intake targets for protein, fat, and carbohydrates, quickly generating a preliminary diet plan. Nutritionists can then fine-tune the plan based on the system-generated plan and their professional experience, significantly reducing repetitive workload. Simultaneously, it can automatically collect users' daily dietary records and generate nutrition analysis reports. Nutritionists do not need to manually organize data; they only need to focus on core professional aspects such as report interpretation and plan optimization, significantly increasing the number of users served. Furthermore, the accurate understanding of natural language preferences helps nutritionists more accurately grasp user needs and avoid communication errors.

[0122] It should be noted that the method of this embodiment can be executed by a single device, such as a computer or server. The method of this embodiment can also be applied in a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method of this embodiment, and these multiple devices will interact with each other to complete the dietary data analysis method based on a large language model.

[0123] It should be noted that the above description describes some embodiments of the present invention. In some cases, the described actions or steps can be performed in a different order than that shown in the above embodiments and the desired result can still be achieved. Furthermore, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0124] See Figure 3 Based on the same inventive concept, and corresponding to the methods of any of the above embodiments, this embodiment of the invention also provides a diet data analysis device based on a large language model, comprising:

[0125] The user data collection module 100 is used to collect basic user information and taste preferences through a user interface. The basic information includes age, gender, height, weight, health status, exercise level and health goals. The taste preferences are obtained through natural language dialogue.

[0126] The healthy diet database construction and maintenance module 200 is used to periodically crawl unstructured data including food names, pictures, nutritional components, calories and cooking methods from a set website, input the unstructured data into a large language model, and clean and format the unstructured data according to preset data cleaning and tagging prompts. Each food is tagged with information including flavor, energy, protein, fat and carbohydrates, and the processed data is stored in the healthy diet database.

[0127] The nutrition goal generation module 300 is used to call the nutrition goal generation algorithm weekly, combine the collected user basic information, calculate the user's basal metabolic rate and daily total energy consumption, and then determine the intake goals of protein, fat and carbohydrates based on the daily total energy consumption to form the user's daily nutrition goals for the week.

[0128] The weekly diet plan generation module 400 is used to input the obtained nutritional goals, taste preferences and data from the healthy diet database into the big language model application layer. The big language model application layer generates prompt words according to the preset diet plan and generates a diet plan including breakfast, lunch, dinner and snacks. The diet plan includes specific cooking suggestions.

[0129] The personalized feedback and suggestion module 500 is used to receive daily dietary records input by users through photo recognition or natural language description. If it is photo recognition, the food photo is input into a trained deep learning model, which outputs the food name, weight, and nutritional information. If it is natural language description, the big language model is used to extract nutritional information from the dietary record. The dietary record is compared with the daily nutritional goals to obtain difference data. The difference data, the daily nutritional goals, and taste preferences are input into the big language model application layer. The big language model application layer generates personalized feedback, including problem identification, explanation of reasons, and specific adjustment suggestions, according to preset personalized feedback prompts.

[0130] In this embodiment, the healthy diet database construction and maintenance module 200 includes:

[0131] The unstructured data is crawled from mainstream food websites and nutrition websites according to the crawling cycle using a web crawling module. The mainstream food websites include comprehensive food sharing platforms, local specialty food recommendation websites, and food recipe sharing websites. The nutrition websites include nutrition science popularization platforms operated by institutions and professional nutrition database websites.

[0132] The unstructured data crawled by the crawler module includes the standard name of the food, actual pictures, nutritional components per 100 grams of edible portion, calorie value per 100 grams of edible portion, weight distribution of each ingredient in each dish, and amount of seasonings. When the food information update frequency of the target crawling website is detected to be more than once a week, the crawling cycle will be adjusted to once every 3 days. When the food information update frequency of the target crawling website is detected to be less than 5 items per month, the crawling cycle will be adjusted to once every two weeks.

[0133] In this embodiment, the formula for calculating the male basal metabolic rate in the nutritional target generation module 300 is as follows:

[0134] BMR=(10×W)+(6.25×H)-(5×A)+5

[0135] The formula for calculating a woman's basal metabolic rate is:

[0136] BMR=(10×W)+(6.25×H)-(5×A)-161

[0137] The formula for calculating total daily energy expenditure is:

[0138] TDEE = BMR × 1.375

[0139] In the formula, BMR represents basal metabolic rate, W represents user weight, H represents user height, A represents user age, and TDEE represents total daily energy expenditure.

[0140] In this embodiment, the nutrition target generation module 300 uses the following formula to determine the intake targets for protein, fat, and carbohydrates based on daily total energy consumption:

[0141] Nutrient = TDEE × K

[0142] In the formula, Nutrient represents the intake of a single nutrient, TDEE represents the total daily energy expenditure, and K represents the percentage coefficient of the corresponding nutrient.

[0143] When the nutrient is protein, the default value of K is 0.18, and the protein intake is Protein = TDEE × 0.18.

[0144] When the nutrient is fat, the default value of K is 0.27, and the fat intake Fat = TDEE × 0.27;

[0145] When the nutrient is carbohydrate, the default value of K is 0.55, and the carbohydrate intake is: Carbohydrate = TDEE × 0.55;

[0146] The proportion coefficient K is adaptively adjusted according to the user's health goals, and the sum of the proportion coefficients of protein, fat and carbohydrates after adjustment is 1.

[0147] In this embodiment, the weekly diet plan generation module 400 outputs a diet plan in JSON format from the large language model application layer. The JSON format includes at least three independent meal segment data objects, each meal segment data object corresponding to a meal time period, which can be any one of breakfast, lunch, dinner, and snacks.

[0148] Each meal segment data object includes three required fields: "Time Segment", "Food Name", and "Serving Size". The "Time Segment" field is labeled with the corresponding meal time in text form. The "Food Name" field is listed as an array of all food names within that time segment. The "Serving Size" field is listed as an array corresponding to the food in the "Food Name" field, indicating the specific weight of each food item. The number of elements in the "Serving Size" array is consistent with the number of elements in the "Food Name" array.

[0149] The weight unit in the "Quantity" field is in grams by default. Users can switch to milligrams, kilograms, or ounces according to their usage habits. After the unit is switched, the value of the "Quantity" field will be converted to the new unit.

[0150] In this embodiment, the personalized feedback and suggestion module 500 includes:

[0151] The large language model first receives the user's input of food records in natural language text. Following the preset instructions for extracting nutritional elements and labeling flavor tags, it extracts the name of each food, the corresponding serving size, and the energy, protein, fat, and carbohydrate content per 100 grams of edible portion from the natural language text, and labels the flavor attributes of each food.

[0152] The apparatus described above is used to implement a dietary data analysis method based on a large language model in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0153] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a dietary data analysis method based on a large language model as described in any of the above embodiments.

[0154] Figure 4This embodiment illustrates a more specific hardware structure of an electronic device, which may include a processor 610, a memory 620, an input / output interface 630, a communication interface 640, and a bus 650. The processor 610, memory 620, input / output interface 630, and communication interface 640 are interconnected internally via the bus 650.

[0155] The processor 610 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0156] The memory 620 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 620 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 620 and is called and executed by the processor 610.

[0157] The input / output interface 630 is used to connect input / output modules to enable information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.

[0158] The communication interface 640 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (e.g., USB, Ethernet cable) or wireless means (e.g., mobile network, Wi-Fi, Bluetooth).

[0159] Bus 650 includes a pathway for transmitting information between various components of the device, such as processor 610, memory 620, input / output interface 630, and communication interface 640.

[0160] It should be noted that although the above-described device only shows the processor 610, memory 620, input / output interface 630, communication interface 640, and bus 650, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.

[0161] The electronic devices described above are used to implement a dietary data analysis method based on a large language model in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0162] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, the present invention also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute a dietary data analysis method based on a large language model as described in any of the above embodiments.

[0163] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0164] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute a dietary data analysis method based on a large language model as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0165] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention is limited to these examples; within the framework of the invention, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity.

[0166] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of the invention, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of the invention, and this also takes into account the fact that the details of implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of the invention will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of the invention, it will be apparent to those skilled in the art that the embodiments of the invention may be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0167] Although the invention has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAMDRAM) may be used with the embodiments discussed.

[0168] The embodiments of this invention are intended to cover all such substitutions, modifications, and variations falling within the scope of the claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this invention should be included within the scope of protection of this invention.

Claims

1. A dietary data analysis method based on a large language model, characterized in that, Includes the following steps: The user's basic information and taste preferences are collected through the user interface. The basic information includes age, gender, height, weight, health status, exercise level and health goals. The taste preferences are obtained through natural language dialogue. Unstructured data, including food names, pictures, nutritional components, calories, and cooking methods, is periodically scraped from a designated website. The unstructured data is then input into a large language model. The large language model cleans and formats the unstructured data according to preset data cleaning and tagging prompts. Each food is then tagged with information including flavor, energy, protein, fat, and carbohydrates. The processed data is then stored in a healthy diet database. The nutrition goal generation algorithm is called weekly, and combined with the collected user basic information, the user's basal metabolic rate and daily total energy consumption are calculated. Then, based on the daily total energy consumption, the intake targets for protein, fat and carbohydrates are determined to form the user's daily nutrition goals for the week. The obtained nutritional goals, taste preferences, and data from the healthy diet database are input into the big language model application layer. The big language model application layer generates prompt words according to the preset diet plan, generating a diet plan that includes breakfast, lunch, dinner, and snacks. The diet plan includes specific cooking suggestions. It receives daily food records from users via photo recognition or natural language description; if it is photo recognition, the food photos are input into the trained deep learning model, and the model outputs the food name, weight and nutritional information. If the description is in natural language, the large language model is used to extract nutritional information from the diet record; the diet record is compared with the daily nutritional goal to obtain the difference data; the difference data, the daily nutritional goal and taste preference are input into the application layer of the large language model; the application layer of the large language model generates personalized feedback including problem indication, explanation of cause and specific adjustment suggestions according to the preset personalized feedback prompt words.

2. The dietary data analysis method based on a large language model according to claim 1, characterized in that, During the process of periodically scraping unstructured data, including food names, images, nutritional information, calories, and cooking methods, from a designated website: The unstructured data is crawled from mainstream food websites and nutrition websites according to the crawling cycle using a web crawling module. The mainstream food websites include comprehensive food sharing platforms, local specialty food recommendation websites, and food recipe sharing websites. The nutrition websites include nutrition science popularization platforms operated by institutions and professional nutrition database websites. The unstructured data crawled by the crawler module includes the standard name of the food, actual pictures, nutritional components per 100 grams of edible portion, calorie value per 100 grams of edible portion, weight distribution of each ingredient in each dish, and amount of seasonings. When the food information update frequency of the target crawling website is detected to be more than once a week, the crawling cycle will be adjusted to once every 3 days. When the food information update frequency of the target crawling website is detected to be less than 5 items per month, the crawling cycle will be adjusted to once every two weeks.

3. The dietary data analysis method based on a large language model according to claim 1, characterized in that, The nutrition goal generation algorithm is invoked weekly, and combined with the collected basic user information, the user's basal metabolic rate and daily total energy consumption are calculated. The formula for calculating the basal metabolic rate for men is as follows: BMR=(10×W)+(6.25×H)-(5×A)+5 The formula for calculating a woman's basal metabolic rate is: BMR=(10×W)+(6.25×H)-(5×A)-161 The formula for calculating total daily energy expenditure is: TDEE = BMR × 1.375 In the formula, BMR represents basal metabolic rate, W represents user weight, H represents user height, A represents user age, and TDEE represents total daily energy expenditure.

4. The dietary data analysis method based on a large language model according to claim 1, characterized in that, The formula used to determine the intake targets for protein, fat, and carbohydrates based on daily total energy expenditure is: Nutrient = TDEE × K In the formula, Nutrient represents the intake of a single nutrient, TDEE represents the total daily energy expenditure, and K represents the percentage coefficient of the corresponding nutrient. When the nutrient is protein, the default value of K is 0.18, and the protein intake is Protein = TDEE × 0.

18. When the nutrient is fat, the default value of K is 0.27, and the fat intake Fat = TDEE × 0.27; When the nutrient is carbohydrate, the default value of K is 0.55, and the carbohydrate intake is: Carbohydrate = TDEE × 0.55; The proportion coefficient K is adaptively adjusted according to the user's health goals, and the sum of the proportion coefficients of protein, fat and carbohydrates after adjustment is 1.

5. The dietary data analysis method based on a large language model according to claim 1, characterized in that, The large language model application layer generates prompt words according to the preset diet plan. During the process of generating the diet plan including breakfast, lunch, dinner and snack, the diet plan output by the large language model application layer adopts JSON format. The JSON format includes at least three independent meal segment data objects. Each meal segment data object corresponds to a meal time period. The meal time period is any one of breakfast, lunch, dinner and snack. Each meal segment data object includes three required fields: "Time Segment", "Food Name", and "Serving Size". The "Time Segment" field is a text label indicating the corresponding meal time segment. The "Food Name" field is an array listing all food names within that time segment. The "Serving Size" field is an array corresponding to the food in the "Food Name" field, indicating the specific weight of each food item. The number of elements in the "Serving Size" array is consistent with the number of elements in the "Food Name" array. The weight unit in the "Quantity" field is in grams by default. Users can switch to milligrams, kilograms, or ounces according to their usage habits. After the unit is switched, the value of the "Quantity" field will be converted to the new unit.

6. The dietary data analysis method based on a large language model according to claim 1, characterized in that, During the process of extracting nutritional information from dietary records using the aforementioned large language model: The large language model first receives the user's input of food records in natural language text. Following the preset instructions for extracting nutritional elements and labeling flavor tags, it extracts the name of each food, the corresponding serving size, and the energy, protein, fat, and carbohydrate content per 100 grams of edible portion from the natural language text, and labels the flavor attributes of each food.

7. A dietary data analysis device based on a large language model, characterized in that, include: The user data collection module is used to collect basic user information and taste preferences through the user interface. The basic information includes age, gender, height, weight, health status, exercise level and health goals. The taste preferences are obtained through natural language dialogue. The healthy diet database construction and maintenance module is used to periodically crawl unstructured data including food names, pictures, nutritional components, calories and cooking methods from a set website. The unstructured data is input into a large language model. The large language model cleans and formats the unstructured data according to preset data cleaning and tagging prompts, and tags each food with information including flavor, energy, protein, fat and carbohydrates. The processed data is then stored in the healthy diet database. The nutrition goal generation module is used to call the nutrition goal generation algorithm weekly, combine the collected user basic information, calculate the user's basal metabolic rate and daily total energy consumption, and then determine the intake goals of protein, fat and carbohydrates based on the daily total energy consumption to form the user's daily nutrition goals for the week. The weekly diet plan generation module is used to input the obtained nutritional goals, taste preferences and data from the healthy diet database into the big language model application layer. The big language model application layer generates prompt words according to the preset diet plan and generates a diet plan including breakfast, lunch, dinner and snacks. The diet plan includes specific cooking suggestions. The personalized feedback and suggestion module is used to receive daily food records input by users through photo recognition or natural language description; if it is photo recognition, the food photo is input into the trained deep learning model, and the food name, weight and nutritional information are output. If the description is in natural language, the large language model is used to extract nutritional information from the diet record; the diet record is compared with the daily nutritional goal to obtain the difference data; the difference data, the daily nutritional goal and taste preference are input into the application layer of the large language model; the application layer of the large language model generates personalized feedback including problem indication, explanation of cause and specific adjustment suggestions according to the preset personalized feedback prompt words.

8. The dietary data analysis device based on a large language model according to claim 7, characterized in that, In the module for building and maintaining the healthy diet database: The unstructured data is crawled from mainstream food websites and nutrition websites according to the crawling cycle using a web crawling module. The mainstream food websites include comprehensive food sharing platforms, local specialty food recommendation websites, and food recipe sharing websites. The nutrition websites include nutrition science popularization platforms operated by institutions and professional nutrition database websites. The unstructured data crawled by the crawler module includes the standard name of the food, actual pictures, nutritional components per 100 grams of edible portion, calorie value per 100 grams of edible portion, weight distribution of each ingredient in each dish, and amount of seasonings. When the food information update frequency of the target crawling website is detected to be more than once a week, the crawling cycle will be adjusted to once every 3 days. When the food information update frequency of the target crawling website is detected to be less than 5 items per month, the crawling cycle will be adjusted to once every two weeks.

9. The dietary data analysis device based on a large language model according to claim 7, characterized in that, In the nutrition target generation module, the formula for calculating the male basal metabolic rate is: BMR=(10×W)+(6.25×H)-(5×A)+5 The formula for calculating a woman's basal metabolic rate is: BMR=(10×W)+(6.25×H)-(5×A)-161 The formula for calculating total daily energy expenditure is: TDEE = BMR × 1.375 In the formula, BMR represents basal metabolic rate, W represents user weight, H represents user height, A represents user age, and TDEE represents total daily energy expenditure. In the nutrition target generation module, the formula used to determine the intake targets for protein, fat, and carbohydrates based on daily total energy expenditure is as follows: Nutrient = TDEE × K In the formula, Nutrient represents the intake of a single nutrient, TDEE represents the total daily energy expenditure, and K represents the percentage coefficient of the corresponding nutrient. When the nutrient is protein, the default value of K is 0.18, and the protein intake is Protein = TDEE × 0.

18. When the nutrient is fat, the default value of K is 0.27, and the fat intake Fat = TDEE × 0.27; When the nutrient is carbohydrate, the default value of K is 0.55, and the carbohydrate intake is: Carbohydrate = TDEE × 0.55; The proportion coefficient K is adaptively adjusted according to the user's health goals, and the sum of the proportion coefficients of protein, fat and carbohydrates after adjustment is 1.

10. The dietary data analysis device based on a large language model according to claim 7, characterized in that, In the weekly meal plan generation module, the meal plan output by the application layer of the large language model is in JSON format. The JSON format includes at least three sets of independent meal segment data objects. Each set of meal segment data objects corresponds to a meal time period, which can be any one of breakfast, lunch, dinner and snack. Each meal segment data object includes three required fields: "Time Segment", "Food Name", and "Serving Size". The "Time Segment" field is a text label indicating the corresponding meal time segment. The "Food Name" field is an array listing all food names within that time segment. The "Serving Size" field is an array corresponding to the food in the "Food Name" field, indicating the specific weight of each food item. The number of elements in the "Serving Size" array is consistent with the number of elements in the "Food Name" array. The weight unit in the "Quantity" field is in grams by default. It can be switched to milligrams, kilograms, or ounces according to the user's usage habits. After the unit is switched, the value of the "Quantity" field will be converted to the new unit. In the personalized feedback and suggestion module: The large language model first receives the user's input of food records in natural language text. Following the preset instructions for extracting nutritional elements and labeling flavor tags, it extracts the name of each food, the corresponding serving size, and the energy, protein, fat, and carbohydrate content per 100 grams of edible portion from the natural language text, and labels the flavor attributes of each food.

Citation Information

Cited By

  • Diabetes diet management method, system and equipment based on multi-modal data fusion

    CN122091101A