๐ CalorieCLIP: Accurate Food Calorie Estimation
CalorieCLIP
is a fine-tuned CLIP model that estimates calories from food images with state-of-the-art accuracy. It outperforms all tested VLMs (including GPT-4o and Claude) while running entirely on-device.
๐ฏ Key Results
Metric
Value
Mean Absolute Error
51.4 calories
Within 50 calories
67.6%
Within 100 calories
90.5%
Inference Speed
<50ms on M1 Mac
๐ฝ๏ธ Example Predictions
Real predictions from our validation set across multiple datasets:
Image
Food
Dataset
Actual
Predicted
Error
Hamburger
Food-101
558
555
3
Ramen
Food-101
431
437
6
Greek Salad
Food-101
144
143
1
Sashimi
Food-101
156
156
0
Cafeteria Meal
Nutrition5k
88
88
0
Cafeteria Meal
Nutrition5k
138
138
0
Cafeteria Meal
Nutrition5k
330
334
3
Cafeteria Meal
Nutrition5k
214
217
4
๐ Quick Start
Installation
pip install open-clip-torch torch pillow
Python Usage
# Clone or download this repo first, then:from calorie_clip import CalorieCLIP
# Load model from local directory
model = CalorieCLIP.from_pretrained(".")
# Predict calories
calories = model.predict("food_photo.jpg")
print(f"Estimated: {calories:.0f} calories")
# Batch prediction
images = ["breakfast.jpg", "lunch.jpg", "dinner.jpg"]
results = model.predict_batch(images)
Fine-tuned Layers
: Last 2 transformer blocks + regression head
Trainable Parameters
: 9.4% (8.5M of 90M)
Input Size
: 224ร224 RGB
Output
: Single float (calories)
Comparison to VLMs
We tested multiple Vision-Language Models on the same test set:
Model
MAE
Notes
CalorieCLIP (Ours)
51.4
Local, fast, accurate
Claude 3.5 Sonnet
71.7
API required
GPT-4o
80.2
API required
Gemini 1.5 Pro
86.7
API required
GPT-4o-mini
88.7
API required
Qwen2-VL-7B (Local)
160.7
Mode collapse issues
Key Finding
: All tested local VLMs (Qwen, Pixtral) suffered from mode collapse, outputting the same calorie value for all images. CalorieCLIP's regression approach avoids this entirely.
CalorieCLIP huggingface.co is an AI model on huggingface.co that provides CalorieCLIP's model effect (), which can be used instantly with this jc-builds CalorieCLIP model. huggingface.co supports a free trial of the CalorieCLIP model, and also provides paid use of the CalorieCLIP. Support call CalorieCLIP model through api, including Node.js, Python, http.
CalorieCLIP huggingface.co is an online trial and call api platform, which integrates CalorieCLIP's modeling effects, including api services, and provides a free online trial of CalorieCLIP, you can try CalorieCLIP online for free by clicking the link below.
jc-builds CalorieCLIP online free url in huggingface.co:
CalorieCLIP is an open source model from GitHub that offers a free installation service, and any user can find CalorieCLIP on GitHub to install. At the same time, huggingface.co provides the effect of CalorieCLIP install, users can directly use CalorieCLIP installed effect in huggingface.co for debugging and trial. It also supports api for free installation.