santosh3110/Ecoclassify-Wildlife_Classifier
๐ฆ EcoClassify โ Wildlife Image Classifier
AI-powered wildlife conservation.
EcoClassify is an end-to-end computer vision project that classifies camera trap images into wildlife species using transfer learning (ResNet50). It includes model explainability (Grad-CAM), batch inference, fine-tuning via Streamlit UI, and MLflow/DagsHub integration for experiment tracking. It was born out of the need to help researchers, educators, and nature lovers quickly identify species without needing to be a machine learning wizard. This project was developed as part of my internship at Euron, with heartfelt thanks to Sudhanshu Kumar, Director of Euron, for his guidance and mentorship.
๐ Live Demo on Streamlit Cloud: 
๐ Live Demo on Hugging Face: 
๐ธ App Screenshots
๐ Table of Contents
- About
- Features
- Architecture
- Dataset
- Installation
- Usage
- Streamlit App
- Training & Evaluation
- Explainability
- Batch Inference
- Fine-Tuning
- Design Docs
- Results
- Future Work
- Acknowledgements
๐ About
Camera traps capture millions of images in wildlife conservation projects. Manual classification is slow, error-prone, and not scalable.
EcoClassify provides:
- ๐ฌ Automated species classification (7 classes + Blank).
- ๐ผ๏ธ Explainability dashboard (Grad-CAM heatmaps).
- โก Batch inference for CSV/ZIP datasets.
- ๐๏ธ Fine-tuning interface for custom datasets.
- ๐ MLflow/DagsHub experiment logging.
๐ Features
- โ Species classification: Antelope_Duiker, Bird, Civet_Genet, Hog, Leopard, Monkey_Prosimian, Rodent, Blank.
- โ Transfer learning with ResNet50 backbone.
- โ Grad-CAM explainability for predictions.
- โ Streamlit app with multiple tabs: Inference, Batch, Fine-tuning.
- โ Config-driven training (YAML params & config).
- โ Experiment tracking with MLflow + DagsHub.
๐๏ธ Architecture
System Architecture
flowchart TD
A[User Uploads Image] --> B[Preprocessing & Augmentation]
B --> C[Model Inference: ResNet50]
C --> D[Predictions: Species + Confidence ]
C --> E[Explainability Engine: Grad-CAM]
D & E --> F[Streamlit Dashboard: Results]
F --> G[Download CSV / Fine-tune Model]End-to-End Pipeline
graph LR
A[Data Ingestion] --> B[Data Loader]
B --> C[Training Pipeline with MLflow Logging]
C --> D[Evaluation of Models with MLflow Logging]
D --> E[Batch Inference]
E --> F[Streamlit App]
F --> G[Model Fine Tuning]Project Structure
.
EcoClassify---Wildlife-Image-Classifier/
โ
โโโ app.py # Streamlit app entry point
โโโ main.py # Orchestrates full training โ eval โ inference pipeline
โโโ setup.py # Package setup
โโโ requirements.txt # Dependencies
โโโ README.md # Documentation
โโโ LICENSE
โโโ colab_code.ipynb # Code for running the repo on Google Colab
โโโ params.yaml # Hyperparameters
โโโ init_project_structure.py # Script to bootstrap project tree
โ
โโโ artifacts/ # All experiment outputs
โ โโโ base_model/ # Initial CNN model
โ โโโ resnet50_model/ # ResNet50 base model
โ โโโ training/ # Trained model checkpoints
โ โโโ prepare_callbacks/ # Callback checkpoints
โ โโโ evaluation/ # Confusion matrices & reports
โ โโโ explanations/ # Grad-CAM heatmaps
โ โโโ batch_inference/ # Batch predictions
โ โโโ data_ingestion/ # Raw & processed datasets
โ โโโ streamlit_outputs/ # Models & mappings saved from app
โ
โโโ config/
โ โโโ config.yaml # Centralized config file
โ
โโโ docs/ # Project Documents
โ โโโ PRD.pdf # Product Requirements & Specification Document
โ โโโ HLD.pdf # High Level Design Document
โ โโโ LLD.pdf # Low Level Design Document
โ
โโโ logs/
โ โโโ running_logs.log # Pipeline logs
โ
โโโ research/ # Notebooks for experiments
โ โโโ experiment.ipynb
โ
โ
โโโ src/ecoclassify/ # Source code (modular package)
โโโ components/ # Core ML components
โ โโโ customcnn_base_model.py
โ โโโ resnet50_model.py
โ โโโ training.py
โ โโโ evaluation.py
โ โโโ explanation_generator.py
โ โโโ fine_tuning.py
โ โโโ batch_inference.py
โ โโโ data_ingestion.py
โ โโโ data_loader.py
โ
โโโ pipeline/ # Orchestrated stages
โ โโโ stage_01_data_ingestion.py
โ โโโ stage_02_customcnn_base_model.py
โ โโโ stage_03_resnet_50_model.py
โ โโโ stage_04_model_training.py
โ โโโ stage_05_model_evaluation.py
โ โโโ stage_06_generate_explanations.py
โ โโโ stage_07_batch_inference.py
โ
โโโ config/ # Config manager
โ โโโ configuration.py
โ
โโโ constants/ # File paths & constants
โ โโโ paths.py
โ
โโโ entity/ # Config/data entities
โ โโโ config_entity.py
โ
โโโ utils/ # Utility functions
โ โโโ common.py
โ โโโ logger.py
โ
โโโ __init__.py๐ Dataset
- Source: Conser-vision Practice Area: Image Classification by drivendata.org
- Provided by: The Pan African Programme: The Cultured Chimpanzee, Wild Chimpanzee Foundation, DrivenData. (2022). Conser-vision Practice Area: Image Classification. Retrieved [July 12 2025] from https://www.drivendata.org/competitions/87/competition-image-classification-wildlife-conservation/.
โ๏ธ Installation
git clone https://github.com/santosh3110/EcoClassify---Wildlife-Image-Classifier.git
cd EcoClassify---Wildlife-Image-Classifier
conda create -n ecoclassify python=3.10 -y
conda activate ecoclassify
pip install -r requirements.txt(Optional: install PyTorch with CUDA if using GPU).
โถ๏ธ Usage
Run Streamlit App
streamlit run app.pyApp opens at http://localhost:8501.
CLI Training
python ecoclassify/pipelines/main.py๐ฅ๏ธ Streamlit App
๐ Try EcoClassify directly without setup: Live Demo on Hugging Face ๐
Tabs available:
- About โ Project info, dataset, motivation.
- Inference โ Upload images โ classification + Grad-CAM heatmaps.
- Batch Inference โ Upload CSV + ZIP โ get predictions CSV.
- Fine-Tuning โ Upload dataset (train/val) โ retrain ResNet50 with custom hyperparameters.
๐ Model Training & Evaluation
- Models trained:
- CustomCNN (100 epochs)
- ResNet50 (transfer learning) (50 epochs)
- Evaluation scope:
- Confusion matrix
- Classification report
- Calibration metrics (temperature scaling)
- Artifacts stored under artifacts/
Results Summary
Macro & Weighted Averages
Per-class Metrics
CustomCNN
ResNet50
Training visuals:
- CustomCNN Training Chart:
- ResNet50 Training Chart:
- Results tracked via
Confusion matrices:
๐ Explainability
- Grad-CAM highlights model focus regions.
- Outputs side-by-side comparison:
- Original Image
- Heatmap Overlay
- Sample Grad-CAM heatmaps generated on Val dataset: ---
๐ฆ Batch Inference
- Upload CSV (image paths) + ZIP (images).
- Pipeline produces predictions.csv with class & confidence.
๐ ๏ธ Fine-Tuning
- Upload dataset in structure:
dataset.zip
โโโ train/
โ โโโ class1/
โ โโโ class2/
โโโ val/
โโโ class1/
โโโ class2/- Configure hyperparams (epochs, batch size, LR, early stopping).
- Retrains ResNet50 on uploaded data.
- Outputs: new model weights + mapping.
๐ Design Docs
๐ Included in /docs:
- PRD โ Product Requirements & Specs
- HLD โ High-Level Architecture Design
- LLD โ Low-Level Implementation Design
๐งฉ Future Work
- ๐ Deploy as FastAPI + Docker microservice.
- ๐ฑ Extend to mobile app for field researchers.
- ๐งช Add ensemble models (ResNet + ViT).
- ๐พ Multi-label support (detect multiple species in one frame).
โค๏ธ Acknowledgements
- The Pan African Programme: The Cultured Chimpanzee, Wild Chimpanzee Foundation, DrivenData. (2022). Conser-vision Practice Area: Image Classification. Retrieved [July 12 2025] from https://www.drivendata.org/competitions/87/competition-image-classification-wildlife-conservation/.
- Mentorship: Sudhanshu Kumar (Euron)
- Frameworks: PyTorch, Streamlit, MLflow, TorchCAM
๐ License
Apache 2.0 License ยฉ 2025 Santosh Kumar Guntupalli
โจ Made with love for Wildlife & AI ๐๐ฑ
