Algerian Dish Classifier that classifies 15 disctinct algerian dishes
# Algerian Dish Classifier 🇩🇿
A computer vision model that recognises 15 traditional Algerian dishes from a photo.
**Live demo:**
huggingface.co
**Validation accuracy:** **88.3%** (ResNet-50, transfer learning)
Built end-to-end as a shipped ML project: scraped and hand-cleaned a custom dataset, trained a ResNet-50 with two-phase transfer learning on a free Colab GPU, served it through a Gradio app, deployed publicly on Hugging Face Spaces — no paid APIs, no proprietary data.
---
## The 15 dishes
`couscous`, `chakhchoukha`, `rechta`, `mhadjeb`, `bourek`, `chorba_frik`, `harira`, `dolma`, `tajine_zitoune`, `karantika`, `mhalbi`, `makroud`, `baghrir`, `zlabia`, `kalb_el_louz`
Covers the full Algerian repertoire — soups (`harira`, `chorba_frik`), savoury mains (`couscous`, `tajine_zitoune`, `dolma`, `mhadjeb`), pastries and sweets (`bourek`, `makroud`, `zlabia`, `kalb_el_louz`), and street food (`karantika`, `baghrir`).
---
## Approach
1. **Data collection.** Scraped candidate images per class via DuckDuckGo's image search (`scrape_images.py`). Two scraper dead-ends along the way: `icrawler`'s Google parser is broken with current Google HTML, and Bing's async endpoint returns *trending filler* content for niche queries — both produced wildly off-topic results for obscure regional dishes. DuckDuckGo backed by Bing's real search API worked.
2. **Cleaning.** Manual cull of each class — wrong dish, Moroccan/Tunisian lookalikes, text and logos, duplicates, cartoons. Landed at ~100 images per class, balanced.
3. **Training.** ResNet-50 transfer learning on a free Colab GPU (`train_resnet50.ipynb`):
- **Phase 1:** freeze the backbone, train only the new 15-class head (Adam, lr 1e-3, 8 epochs).
- **Phase 2:** unfreeze and fine-tune the whole network (Adam, lr 1e-4, cosine schedule, 12 epochs).
- Heavy regularisation against overfit on a small dataset: RandAugment, RandomErasing, label smoothing, weight decay.
4. **Iteration.** Base …