Inspiration

India is home to an extraordinary diversity of indigenous cattle and buffalo breeds—such as Jaffarabadi, Murrah, Bargur, Toda, Banni, and Nili-Ravi—each uniquely adapted to local climates and vital to rural dairy livelihoods. However, misidentification of breeds in the field often leads to improper crossbreeding, suboptimal nutrition, and missed preventive healthcare schedules. Inspired by the need to protect native genetic heritage and give farmers and veterinarians a fast, accessible diagnostic tool, we created AgriBreed Guard—an automated livestock recognition and health guidance platform built to bridge computer vision with everyday rural animal husbandry.

What it does

AgriBreed Guard is an end-to-end web application that identifies 17 indigenous Indian cattle and buffalo breeds from a single uploaded photograph and pairs that prediction with actionable veterinary intelligence: Instant Breed Classification: Analyzes an animal's image in seconds and predicts the breed along with a model confidence score. Comprehensive Breed Profiles: Retrieves detailed records on geographic origin, physical characteristics, milk yield potential, and adaptability. Preventive Healthcare & Vaccination Schedules: Surfaces tailored immunization timelines and disease-prevention guidelines linked to the identified livestock category.

How we built it

We designed AgriBreed Guard as a lightweight, CPU-friendly machine learning and full-stack web pipeline so it can run reliably without expensive GPU infrastructure:Image Standardization (OpenCV): Every uploaded photograph is resized to $128 \times 128$ pixels using area interpolation for dimensional consistency. We split the image into an RGB representation (for coat coloration) and a Grayscale representation smoothed with a $3 \times 3$ Gaussian blur filter (for structural edges and skin texture).Multi-Modal Feature Engineering (scikit-image & OpenCV): We extracted a 2,286-dimensional feature vector combining three complementary visual descriptors:Histogram of Oriented Gradients (HOG): Captures horn curvature, facial profile, and body silhouette using local gradient magnitudes and orientations:$$G = \sqrt{G_x^2 + G_y^2}, \quad \theta = \arctan\left(\frac{G_y}{G_x}\right)$$Local Binary Patterns (LBP): Quantifies coat texture and hide patterns by comparing each pixel against its circular neighborhood $P$ at radius $R$:$$\text{LBP}{P,R} = \sum{p=0}^{P-1} s(g_p - g_c) 2^p, \quad s(x) = \begin{cases} 1, & x \ge 0 \ 0, & x < 0 \end{cases}$$3D RGB Color Histograms: Captures coat pigmentation differences across color channels.

Challenges we ran into

Inter-Breed Visual Overlap & Class Imbalance: Several native breeds share similar dark coats and body frames, while dataset sizes varied significantly across classes (from ~67 images in Kalahandi to 357 in Jaffarabadi). Fusing structural (HOG), textural (LBP), and color features was essential to separate breeds that single-feature models misclassified. Cross-Machine Windows C-Extension Crashes: Deploying the repository onto teammates' Windows laptops initially triggered silent ERR_CONNECTION_REFUSED crashes during image uploads. We traced this to low-level thread conflicts between opencv-python desktop GUI bindings, Flask's auto-reloader, and relative Windows file paths. Switching to opencv-python-headless, enforcing absolute file paths, and running the app via Waitress resolved the instability. Database Setup Consistency: Standardizing local database initialization across multiple systems required building clean schema-seeding scripts (seed_db.py) to handle differing MySQL root credentials.

Accomplishments that we're proud of

Lightweight, GPU-Free Inference: Successfully engineered a fast 17-class computer vision pipeline capable of extracting 2,286 features and serving real-time predictions on standard laptops without deep learning hardware overhead. Actionable Utility Beyond Classification: Instead of stopping at a raw prediction label, we tied every classification directly to relational veterinary and vaccination records that farmers and field workers can immediately act upon. Reproducible Full-Stack Architecture: Built a clean, modular codebase (preprocess.py, features.py, train.py, seed_db.py, and app.py) that teammates can clone, train, seed, and deploy locally.

What we learned

Domain-Specific Feature Engineering Matters: Combining shape, micro-texture, and color descriptors taught us how classical computer vision captures rich morphological traits even on modest datasets. ML Engineering Goes Beyond Model Training: Packaging an inference pipeline inside a web application demands careful attention to deterministic preprocessing, serialized scalers/encoders (joblib), thread-safe WSGI servers, and OS-independent path handling. Designing for End-User Impact: Integrating machine learning with structured relational databases transforms a standalone model into a practical decision-support system.

What's next for AgriBreed Guard

Accuracy Boost with Transfer Learning & Data Augmentation: Expand smaller breed classes through targeted augmentation and benchmark lightweight CNN architectures (such as MobileNetV3 or EfficientNet-Lite) alongside our classical feature pipeline to push multi-class accuracy even higher. Regional Language & Voice Support: Add local language translations (such as Tamil and Hindi) and text-to-speech audio readouts so farmers can listen to breed details and vaccination reminders hands-free. Mobile-First Offline Field Mode: Package the inference engine into a lightweight progressive web app (PWA) or mobile application capable of capturing photos and running predictions directly in low-connectivity rural areas.

Built With

Share this project:

Updates

Submission history