Binary image classifier: food_or_drink vs not_food_or_drink.
Part of the Nutrify pipeline. Role: CoreML deployable.
v2 Improvement
v2 adds 560,836 human-labeled FoodVision images to the 2,952,644 DataComp
training set. FoodVision samples use hard cross-entropy loss; DataComp samples use
KL distillation from SigLIP2-so400m soft labels.
Version
FoodVision Acc
FoodVision F1
Training Data
v2
97.84%
0.9859
DataComp 2,952,644 + FoodVision 560,836
v1
0.00%
0.0000
DataComp only
Δ
+97.84%
+0.9859
Cross-Model Comparison (v2, FoodVision Test — 153K images)
Training data: DataComp 2,952,644 (soft KL labels) + FoodVision 560,836 (hard CE labels)
Epochs: 5 (best blended at epoch 2)
Peak inference throughput: 1155.6 img/s
Optimizer: AdamW (head LR=1e-4, backbone LR=1e-5 after 0.5 epoch warmup)
Loss: DataComp: 0.7×KL(T=3) + 0.3×CE | FoodVision: CE
Weight Variants
Three weight files are included, each optimized for a different metric:
File
Selects by
FV Acc
DC Acc
Blended
Epoch
Use case
model.safetensors (default)
Best blended (50/50)
97.84%
90.44%
94.14%
2
Balanced — good at everything
model_best_fv.safetensors
Best FoodVision test
97.95%
89.62%
93.78%
3
On-device Nutrify deployment
model_best_dc.safetensors
Best DataComp val
97.21%
90.76%
93.99%
5
Scale-up filtering (menus, panels, recipes)
To load a specific variant:
python
1# Default (blended)2weights_path = hf_hub_download("mrdbourke/food-not-food-classifier-nextvit-v2","model.safetensors")34# Best for Nutrify on-device5weights_path = hf_hub_download("mrdbourke/food-not-food-classifier-nextvit-v2","model_best_fv.safetensors")67# Best for scale-up filtering8weights_path = hf_hub_download("mrdbourke/food-not-food-classifier-nextvit-v2","model_best_dc.safetensors")