An end-to-end computer vision project that classifies traditional Nepali dishes using transfer learning (ResNet18), compares augmentation strategies, and deploys predictions through Streamlit and FastAPI.
- Small dataset size
- Class imbalance
- Overfitting in baseline model
- Generalization issues
Solutions:
- Strong augmentation
- Transfer learning
- Fine tuning
Run the web app: View Project
POST /predict
This project trains two separate models using the same architecture (ResNet18) but different data preprocessing strategies:
| Model | Description |
|---|---|
| Model 0 | (Basic Augmentation) Minimal augmentation for baseline performance |
| Model 1 | (Strong Augmentation) Advanced augmentation for better generalization |
The goal is to analyze how augmentation impacts:
- Accuracy
- Overfitting
- Generalization
- Robustness
project/
│
├── dataset/
│ ├── train/
│ └── test/
│
├── src/
│ ├── dataset.py
│ ├── model.py
│ ├── engine.py
│ ├── predict.py
| ├── train.py
│ └── streamlit_app
│
├── models/
└── README.mdSource: Kaggle Food Dataset (custom Nepali food subset) Data Source
- momo
- dal_bhat
- sel_roti
- chowmein
- thukpa
- chatamari
- yomari
mage format: RGB
Input size: 224 x 224
ResNet18
Transfer learning used with frozen feature extractor and custom classifier head.
Model 0 — Basic Augmentation
Used for baseline training:
transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
])
Characteristics:
-
No heavy augmentation
-
Preserves original data distribution
-
Faster convergence
-
Higher risk of overfitting
Model B — Strong Augmentation
Used for better generalization:
transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.RandomRotation(20),
transforms.ColorJitter(brightness=0.2, contrast=0.2, saturation=0.2),
transforms.ToTensor(),
])
Characteristics: *More robust to real-world variation *Reduces overfitting *Slightly slower convergence *Better generalization
Loss Function: CrossEntropyLoss Optimizer: Adam Learning Rate: 1e-3 (fine-tuning) Epochs: 15 Batch Size: 32
Model 0
Model 1
Steps:
- Load image
- Resize to 224x224
- Normalize
- Forward pass through ResNet18
- Apply Softmax
- Get prediction (Argmax)



