A deep learning image classifier that identifies whether an elephant in a photo is African or Asian, built with transfer learning (MobileNetV2) and deployed as an interactive Streamlit web app.
# π Elephant Classifier β African vs Asian
A deep learning image classifier that identifies whether an elephant in a photo is **African** or **Asian**, built with transfer learning (MobileNetV2) and deployed as an interactive **Streamlit** web app.
---
## π Table of Contents
- Overview
- Demo
- Dataset
- Modeling Approach
- Results
- Project Structure
- Installation
- Usage
- Tech Stack
- Key Learnings
- Limitations
- Future Improvements
- License
---
## π― Overview
**Problem Statement:** Build an image classification model that distinguishes between African and Asian elephants β two species with visually distinct features (ear size and shape, tusks, back profile, and body size) β and package it into a usable app for image-based prediction.
**Approach:** Rather than training a convolutional neural network from scratch, the project uses **transfer learning** with a MobileNetV2 backbone pretrained on ImageNet, fine-tuned with a custom classification head and optimized via automated hyperparameter search.
---
## π₯ Demo
Upload any elephant image and the app returns a prediction with a confidence score.
| African Elephant | Asian Elephant |
|---|---|
| **Prediction: African** β Confidence: 79.72% | **Prediction: Asian** β Confidence: 53.82% |
*(See `/screenshots` for full app captures β landing page, upload flow, and prediction results.)*
---
## π Dataset
- **Classes:** `African` (label 0), `Asian` (label 1)
- **Training set:** 840 images across both classes
- **Validation/test set:** 188 images across both classes
- **Input size:** 224Γ224 RGB (299Γ299 for the Xception experiment)
- **Augmentation (training only):** rescaling (1/255), rotation (Β±20Β°), zoom (Β±20%), horizontal flip
> Dataset directory structure follows Keras' `flow_from_directory` convention:
> ```
> data/
> βββ train/
> β βββ African/
> β βββ Asian/
> βββ test/
> βββ African/
> βββ Asian/
> ```
---
## π Modeling Approach
Several architectures were evaluated before selecting β¦