File size: 2,230 Bytes
dd2015c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a85b37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1813a2
9a85b37
 
 
 
dd2015c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
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