SimpleFood45 / README.md
gvinod's picture
Add SimpleFood45 images, annotations, YOLOv8 weights and dataset card
5e588da verified
|
Raw History Blame Contribute Delete
5.87 kB
---
license: cc-by-nc-nd-4.0
pretty_name: SimpleFood45
language:
- en
task_categories:
- image-classification
- object-detection
- image-to-3d
tags:
- food
- nutrition
- dietary-assessment
- portion-estimation
- volume-estimation
- energy-estimation
- 3d
size_categories:
- n<1K
configs:
- config_name: default
data_files:
- split: train
path:
- data/*.jpg
- data/metadata.csv
---
# SimpleFood45
![SimpleFood45 sample images](assets/samples.jpg)
**SimpleFood45** is a dataset for **image-based food portion estimation**. It contains 513 smartphone photos of 45 real food items from 12 food types. Each item was photographed from several camera poses. Annotations give the ground-truth **weight (g)**, **volume (mL)** and **energy (kcal)**.
The dataset was introduced with the paper [*Food Portion Estimation via 3D Object Scaling*](https://arxiv.org/abs/2404.12257) (Vinod, He, Shao & Zhu, CVPR Workshops 2024) from the Video and Image Processing Laboratory (VIPER), Purdue University.
## Dataset summary
| | |
|---|---|
| Images | 513 (JPEG, 4000 × 2252, about 2 MB each) |
| Food items | 45 |
| Food types | 12 |
| Annotations | Weight (g), volume (mL), energy (kcal) |
| Capture device | Samsung Galaxy S22 Ultra |
| Capture dates | September to December 2023 |
Most foods are photographed on a black calibration board with a white dot grid, next to a printed checkerboard that serves as a reference object of known size. Pizza is photographed on a white plate with the checkerboard beside it.
## Repository layout
```
data/
├── 20230927_102352.jpg # 513 images, named by capture timestamp
├── ...
└── metadata.csv # per-image annotations
weights/
└── yolo_vfn_filtered.pt # YOLOv8 food detector used in the paper
assets/
└── samples.jpg # preview image for this card
```
### `metadata.csv`
| Column | Type | Description |
|---|---|---|
| `file_name` | string | Image file name in `data/` |
| `label` | string | Food type (e.g. `bagel`, `apple`) |
| `weight_g` | float | Ground-truth weight in grams |
| `volume_ml` | float | Ground-truth volume in millilitres |
| `energy_kcal` | float | Ground-truth energy in kilocalories |
All images of the same physical item share the same weight, volume and energy values.
### Annotated food types
| Food type | Items | Images | Weight (g) | Volume (mL) | Energy (kcal) |
|---|---:|---:|---|---|---|
| apple | 4 | 40 | 186 – 196 | 240.9 – 253.9 | 109.7 – 115.6 |
| avocado | 4 | 40 | 190 – 243 | 196.7 – 251.6 | 304.0 – 388.8 |
| bagel | 4 | 40 | 92 – 100 | 281.1 – 308.2 | 242.9 – 264.0 |
| biscuit | 2 | 30 | 45 – 46 | 112.4 – 114.9 | 166.5 – 170.2 |
| blueberry_muffin | 4 | 40 | 98 – 102 | 218.4 – 232.7 | 367.5 – 382.5 |
| broccoli | 4 | 40 | 13 – 26 | 23.6 – 47.1 | 4.4 – 8.8 |
| chicken_nugget | 2 | 40 | 14 – 15 | 21.0 – 22.5 | 43.0 – 46.1 |
| cinnamon_roll | 4 | 40 | 65 – 96 | 189.8 – 280.4 | 293.8 – 433.9 |
| corn | 3 | 30 | 210 – 245 | 263.1 – 307.0 | 232.6 – 367.5 |
| croissant | 4 | 40 | 41 – 46 | 157.1 – 181.7 | 166.5 – 186.8 |
| strawberry | 3 | 40 | 16 – 23 | 18.0 – 25.9 | 5.8 – 8.3 |
### Images without annotations
93 images have empty annotation fields in `metadata.csv`:
- **53 images** (captured 2023-10-03) show **two foods together** on the calibration board, for example an avocado with a chicken nugget, or corn with a croissant.
- **40 images** (captured 2023-12-04) show a **slice of pizza** on a plate.
The current release does not include ground-truth values for these images.
## Usage
### Load with 🤗 Datasets
```python
from datasets import load_dataset
ds = load_dataset("purdueviperlab/SimpleFood45", split="train")
sample = ds[0]
sample["image"] # PIL.Image
sample["label"], sample["weight_g"], sample["volume_ml"], sample["energy_kcal"]
# Keep only annotated images
annotated = ds.filter(lambda x: x["label"] is not None)
```
### Download the raw files
```python
from huggingface_hub import snapshot_download
path = snapshot_download("purdueviperlab/SimpleFood45", repo_type="dataset")
```
Or with the CLI:
```bash
hf download purdueviperlab/SimpleFood45 --repo-type dataset --local-dir SimpleFood45
```
### Food detector weights
`weights/yolo_vfn_filtered.pt` is the [Ultralytics](https://github.com/ultralytics/ultralytics) YOLOv8 detection model used in the paper's pipeline. It was trained on a filtered subset of the VIPER-FoodNet (VFN) dataset and saved with `ultralytics==8.0.188`.
```python
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
ckpt = hf_hub_download("purdueviperlab/SimpleFood45", "weights/yolo_vfn_filtered.pt", repo_type="dataset")
model = YOLO(ckpt)
results = model("data/20230927_102352.jpg")
```
## Intended use
SimpleFood45 is intended for research on:
- Estimating food portion size, volume and energy from a single image or from multiple views
- 3D food reconstruction and object scaling
- Image-based dietary assessment
The dataset is small and was captured in a controlled lab setting, with single items or pairs of items on a uniform background. Results on SimpleFood45 may not carry over to real-world meal images with mixed dishes, clutter or different lighting.
## License
Released under [CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/). You may use it for non-commercial research with attribution. You may not distribute modified versions.
## Citation
If you use SimpleFood45, please cite:
```bibtex
@article{vinod2024food,
title={Food Portion Estimation via 3D Object Scaling},
author={Vinod, Gautham and He, Jiangpeng and Shao, Zeman and Zhu, Fengqing},
journal={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={3741--3749},
year={2024}
}
```