An AI-powered cattle breed classification system for Indian indigenous breeds.
🧠 The Models
Four deep learning approaches were trained and rigorously compared:
- MLP Baseline — flatten + dense layers
- CNN from Scratch — 5 conv blocks + GAP
- ResNet50 Transfer Learning — ImageNet pretrained
- ViT-B/16 Transfer Learning — Vision Transformer
The best model is selected using a weighted composite score considering F1, accuracy,
inference speed, and model size.
📊 The Dataset
3,056 images across 26 indigenous Indian breeds (21 cow + 5 buffalo breeds).
Stratified 70/15/15 train/val/test split.
- Images resized to 224×224 pixels
- Augmentation: flip, rotation, jitter, crop
- ImageNet normalization applied
- Corrupt image validation at preprocessing
⚙️ Tech Stack
- PyTorch 2.x + torchvision + timm
- FastAPI backend with Pydantic schemas
- React + Vite frontend
- Docker containerized deployment
- Config-driven experiments with YAML
🎯 Best Model Selection
Weighted scoring ensures the production model balances performance and practicality:
Macro F150%
Top-1 Accuracy20%
Inference Latency15%
Model Size10%
Calibration5%
🌾 For Farmers
This tool is designed for real-world agricultural use. Features include:
- Camera capture for field use
- Low-confidence warnings for uncertain predictions
- Image quality tips for better results
- Breed details including milk yield and primary use
- Works offline after initial load (PWA-ready)
👤 Creator
Built by Ajaya and team.
Source code on{' '}
GitHub
.
- Backend: FastAPI with PyTorch inference
- Frontend: React + Vite
- Training: Jupyter notebooks with shared ML package