|
|
--- |
|
|
license: mit |
|
|
datasets: |
|
|
- Voxel51/Food101 |
|
|
language: |
|
|
- en |
|
|
metrics: |
|
|
- accuracy |
|
|
base_model: |
|
|
- timm/tf_efficientnetv2_s.in21k_ft_in1k |
|
|
new_version: timm/tf_efficientnetv2_s.in21k |
|
|
pipeline_tag: image-classification |
|
|
tags: |
|
|
- code |
|
|
--- |
|
|
# Food Classifier (Food-101) |
|
|
|
|
|
A deep learning–based food image classification project trained on the **Food-101** dataset using **PyTorch**. |
|
|
The model predicts food categories from images and is designed for real-world usage and future mobile deployment. |
|
|
|
|
|
--- |
|
|
|
|
|
## Project Overview |
|
|
|
|
|
This project focuses on building a high-accuracy food image classifier by fine-tuning a pretrained convolutional neural network (CNN). |
|
|
It serves as both a learning project and a foundation for future applications such as mobile food recognition apps. |
|
|
|
|
|
--- |
|
|
|
|
|
## 🧠 Model Architecture |
|
|
|
|
|
- **Base model:** EfficientNetV2-S (pretrained on ImageNet) |
|
|
- **Framework:** PyTorch |
|
|
- **Training strategy:** Transfer learning with fine-tuning |
|
|
- **Input size:** 224 × 224 RGB images |
|
|
- **Output:** Food category probabilities (Softmax) |
|
|
|
|
|
EfficientNetV2 was chosen for its strong balance between accuracy and computational efficiency. |
|
|
|
|
|
--- |
|
|
|
|
|
## Dataset |
|
|
|
|
|
- **Dataset:** Food-101 |
|
|
- **Number of classes:** 101 food categories |
|
|
- **Images per class:** ~1,000 |
|
|
- **Total images:** 101,000 |
|
|
|
|
|
The dataset contains diverse real-world food images with varying lighting, angles, and backgrounds. |
|
|
|
|
|
🔗 Dataset source: |
|
|
https://data.vision.ee.ethz.ch/cvl/datasets_extra/food-101/ |
|
|
|
|
|
--- |
|
|
|
|
|
## Training Details |
|
|
|
|
|
- **Optimizer:** Adam |
|
|
- **Loss function:** Cross-Entropy Loss |
|
|
- **Data augmentation:** |
|
|
- Random resize & crop |
|
|
- Horizontal flip |
|
|
- Normalization |
|
|
- **Validation split:** Used for model selection and checkpointing |
|
|
|
|
|
--- |
|
|
|
|
|
## Model Performance |
|
|
|
|
|
| Metric | Result | |
|
|
|------|------| |
|
|
| **Top-1 Accuracy** | **96%** (validation) | |
|
|
| **Loss** | Low and stable | |
|
|
|
|
|
The final model achieved strong generalization performance on unseen validation images. |
|
|
|
|
|
--- |
|
|
|
|
|
## Pretrained Weights |
|
|
|
|
|
Due to GitHub file size limits, the trained `.pth` model file is hosted externally. |
|
|
|
|
|
👉 **Download pretrained model:** |
|
|
https://huggingface.co/htetooyan/FoodClassifier/tree/main |
|
|
|
|
|
After downloading, place the file in: |
|
|
|
|
|
```bash |
|
|
checkpoints/best_model.pth |