AI4Food-NutritionFW: A Novel Framework for the Automatic Synthesis and Analysis of Eating Behaviours

Sergio Romero-Tapiador, Ruben Tolosana, Aythami Morales, Isabel Espinosa-Salinas, Gala Freixer, Julian Fierrez, Ruben Vera-Rodriguez, Enrique Carrillo de Santa Pau, Ana Ramírez de Molina, Javier Ortega-GarciaarXiv 2023 · DOI

TL;DR

The authors present AI4Food-NutritionFW, an open-source framework designed to automatically synthesize and analyze longitudinal food image datasets based on highly configurable eating behaviors. By pairing synthetic dataset generation with a deep learning-based dietary analysis pipeline, the framework can evaluate a user's "Healthy Score" with an impressive 99.53% accuracy against international nutritional guidelines.

What Problem Does This Paper Address?

While computer vision has made massive strides in recognizing individual food items, personalized nutrition requires understanding a person's eating behavior over time (longitudinal data).

Gathering real-world, long-term datasets of everything a person eats is incredibly difficult. It relies on tedious manual logging, suffers from high user dropout rates, and introduces significant privacy concerns. To train machine learning models capable of providing automated dietary feedback, researchers need large-scale, diverse, and precisely labeled longitudinal datasets. This paper bridges the gap by providing a tunable framework to simulate realistic, multi-day smartphone-based food photography diaries across various lifestyle profiles.

Methods

The AI4Food-NutritionFW framework operates in two main phases: Synthesis and Analysis.

1. Dataset Synthesis

The framework models eating behaviors using 81 distinct parameters divided into two categories:

  • General Parameters: Structure of the diet (e.g., number of meals per day, regional culinary styles, and dietary regularity).
  • Food Group Parameters: 75 parameters mapped across 6 distinct nutritional levels, defining the daily or weekly consumption frequencies of specific food types.
Fig. 1: AI4Food-NutritionFW framework. First, we define the general and food group parameters of our framework to model eating behaviour configurations. Then, by modifying previous parameters, we can define different profiles. Finally, with the help of the AI4Food-NutritionDB [2], we can generate food image datasets with different eating behaviours, selecting the number of subjects and profiles as desired, or creating new ones.

Using these parameters, the system defines distinct lifestyle profiles (e.g., healthy, sedentary, vacationing). It then samples actual food images from an underlying database to construct a realistic 7-day photographic food diary for simulated subjects.

2. Automatic Analysis Pipeline

To evaluate these simulated diaries, the authors developed an automated pipeline:

  • Food Recognition Module: A state-of-the-art Xception Deep Learning model, pre-trained on ImageNet and fine-tuned on a nutritional taxonomy, classifies the main food group of each image.
  • Healthy Score Calculation: The system aggregates the recognized food groups over a week into a 9-dimensional vector (representing 3 daily and 6 weekly food groups). It then calculates a Healthy Score using the Normalised Mahalanobis Distance (NMD), measuring how closely the subject's intake vector aligns with the optimal ranges recommended by international health organizations like the WHO.

Datasets

The paper introduces a new benchmark dataset generated by the framework:

  • The AI4Food-NutritionFW Dataset: Contains 4,800 weekly eating behaviors from 1,200 subjects across 15 different profiles (ranging from strict adherence to healthy guidelines to high-fast-food or highly variable diets).
  • Base Database: The framework utilizes images from the AI4Food-NutritionDB, a balanced database categorized into 6 nutritional levels, 19 main categories, 73 subcategories, and 893 final food products.
Fig. 2: Visual examples from 2 different subjects’ eating behaviour. First, subject 0113 (top) has a healthy profile where food products such as rice, fish, or vegetables enrich the diet. The second subject (subject 0574 - bottom), on the contrary, has an unhealthy profile with an abundance of food products from the first nutritional levels such as sweets or fast food.

Key Insights and Ideas

  • The Power of Synthetic Lifestyles: Instead of just generating random food sequences, the framework successfully models complex, realistic behavioral patterns—like a subject who eats healthily 75% of the time but indulges in fast food during a "holiday" week.
  • Moving Beyond Rigid Thresholds: Using the Mahalanobis distance to calculate the Healthy Score allows the system to evaluate diets multi-dimensionally. It accounts for the variance and covariance of different food groups rather than penalizing a diet based on a single strict threshold.
Dietary analysis comparing a healthy profile vs an unhealthy profile against optimal ranges

Key Results

  • Food Recognition: The fine-tuned Xception model achieved approximately 98% Top-5 accuracy in identifying the primary food groups from images.
  • Dietary Classification: By applying a decision boundary threshold of 0.36 to the computed Healthy Score, the framework distinguished healthy diets from unhealthy/medium diets with 99.53% accuracy and 99.60% sensitivity.

Limitations and Future Work

  • Expert Dependency: Defining the initial parameter ranges for the eating profiles currently requires manual, time-consuming input from professional nutritionists. The authors suggest exploring Large Language Models (LLMs) like ChatGPT to automate profile generation in the future.
  • Controlled Image Capture: The current image recognition module assumes one distinct dish per photo. Future iterations will need to incorporate robust food segmentation algorithms to handle unconstrained, real-world photos containing multiple plates or side dishes simultaneously.
  • Holistic Health Integration: The authors plan to expand the framework to incorporate data from wearable devices (e.g., sleep patterns, heart rate, physical activity) to provide a more comprehensive health index.

Summary updated

Abstract

Nowadays millions of images are shared on social media and web platforms. In particular, many of them are food images taken from a smartphone over time, providing information related to the individual's diet. On the other hand, eating behaviours are directly related to some of the most prevalent diseases in the world. Exploiting recent advances in image processing and Artificial Intelligence (AI), this scenario represents an excellent opportunity to: i) create new methods that analyse the individuals' health from what they eat, and ii) develop personalised recommendations to improve nutrition and diet under specific circumstances (e.g., obesity or COVID). Having tunable tools for creating food image datasets that facilitate research in both lines is very much needed. This paper proposes AI4Food-NutritionFW, a framework for the creation of food image datasets according to configurable eating behaviours. AI4Food-NutritionFW simulates a user-friendly and widespread scenario where images are taken using a smartphone. In addition to the framework, we also provide and describe a unique food image dataset that includes 4,800 different weekly eating behaviours from 15 different profiles and 1,200 subjects. Specifically, we consider profiles that comply with actual lifestyles from healthy eating behaviours (according to established knowledge), variable profiles (e.g., eating out, holidays), to unhealthy ones (e.g., excess of fast food or sweets). Finally, we automatically evaluate a healthy index of the subject's eating behaviours using multidimensional metrics based on guidelines for healthy diets proposed by international organisations, achieving promising results (99.53% and 99.60% accuracy and sensitivity, respectively). We also release to the research community a software implementation of our proposed AI4Food-NutritionFW and the mentioned food image dataset created with it.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
AI4Food-NutritionFW proposed-dataset dietsAutomatic Healthy Score (NMD-based)accuracy99.53%Healthy Diet Classification
Source quote
L6: This paper proposes AI4Food-NutritionFW, a framework for the creation of food image datasets according to configurable eating behaviours. AI4Food-NutritionFW simulates a user-friendly and widespread scenario where images are taken using a smartphone. In addition to the framework, we also provide and describe a unique food image dataset that includes 4,800 different weekly eating behaviours from 15 different profiles and 1,200 subjects. Specifically, we consider profiles that comply with actual lifestyles from healthy eating behaviours (according to established knowledge), variable profiles (e.g., eating out, holidays), to unhealthy ones (e.g., excess of fast food or sweets). Finally, we automatically evaluate a healthy index of the subject's eating behaviours using multidimensional metrics based on guidelines for healthy diets proposed by international organisations, achieving promising results (99.53% and 99.60% accuracy and sensitivity, respectively). We also release to the research community a software implementation of our proposed AI4Food-NutritionFW and the mentioned food image dataset created with it.
AI4Food-NutritionFW proposed-dataset dietsAutomatic Healthy Score (NMD-based)sensitivity99.60%Healthy Diet Classification
Source quote
L6: This paper proposes AI4Food-NutritionFW, a framework for the creation of food image datasets according to configurable eating behaviours. AI4Food-NutritionFW simulates a user-friendly and widespread scenario where images are taken using a smartphone. In addition to the framework, we also provide and describe a unique food image dataset that includes 4,800 different weekly eating behaviours from 15 different profiles and 1,200 subjects. Specifically, we consider profiles that comply with actual lifestyles from healthy eating behaviours (according to established knowledge), variable profiles (e.g., eating out, holidays), to unhealthy ones (e.g., excess of fast food or sweets). Finally, we automatically evaluate a healthy index of the subject's eating behaviours using multidimensional metrics based on guidelines for healthy diets proposed by international organisations, achieving promising results (99.53% and 99.60% accuracy and sensitivity, respectively). We also release to the research community a software implementation of our proposed AI4Food-NutritionFW and the mentioned food image dataset created with it.
BibTeX
@misc{romerotapiador2023ai,
  author = {Sergio Romero-Tapiador and Ruben Tolosana and Aythami Morales and Isabel Espinosa-Salinas and Gala Freixer and Julian Fierrez and Ruben Vera-Rodriguez and Enrique Carrillo de Santa Pau and Ana Ramírez de Molina and Javier Ortega-Garcia},
  title = {{AI4Food-NutritionFW: A Novel Framework for the Automatic Synthesis and Analysis of Eating Behaviours}},
  year = {2023},
  eprint = {2309.06308},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.06308},
}

Loading related content...

Figure