Skip to content

01mayankk/Nandi-Vision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‚ NandiVision – AI-Powered Indian Cattle & Buffalo Breed Classification

Smart Vision for Smarter Livestock – Empowering Farmers with AI


πŸ“˜ Overview

NandiVision is an AI-driven system designed to classify Indian cow and buffalo breeds using deep learning. India's livestock diversity is vast, but identifying breeds manually is difficult and requires expert knowledge.

Key Components:

  • Stage 1 Model: Species classification β†’ EfficientNet-B0 (ONNX)
  • Stage 2 Model: Breed identification β†’ EfficientNet-B3 (ONNX)
  • Frontend: Next.js with modern UI
  • Backend: FastAPI with ONNX inference
  • Authentication: Supabase with role-based dashboard

🎯 Objectives

  • Classify 08 cow breeds and 07 buffalo breeds accurately
  • Build a two-stage inference pipeline to improve classification reliability
  • Provide a modern, responsive, animated frontend UI
  • Enable admin control panel for sending notifications
  • Enable users to raise queries directly from dashboard
  • Build a complete production-ready system using ONNX models for fast inference

πŸ„ Supported Breeds

Cow Breeds (8)

  • Deoni
  • Rathi
  • Red Sindhi
  • Sahiwal
  • Tharparkar
  • Gir
  • Hariana
  • Kankrej

Buffalo Breeds (7)

  • Banni
  • Jaffrabadi
  • Mehsana
  • Murrah
  • Nagpuri
  • Nili Ravi
  • Toda

🧠 Model Architecture

Stage Purpose Model Reason
Stage-1 Cow vs Buffalo vs None EfficientNet-B0 Lightweight, fast, accurate for coarse classification
Stage-2 Breed Prediction EfficientNet-B3 Higher depth β†’ best for fine-grain features distinguishing breeds

Note: Both models are optimized & exported to ONNX to reduce inference latency.


πŸ—οΈ System Architecture

                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚        User Browser        β”‚
                  β”‚   (Next.js Frontend UI)    β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                                 β–Ό
                   HTTP Request (Image Upload)
                                 β”‚
                                 β–Ό
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚        FastAPI Backend         β”‚
                β”‚ - Handles API routes           β”‚
                β”‚ - Preprocess image             β”‚
                β”‚ - Coordinates model inference  β”‚
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚                  ONNX Inference Engine                   β”‚
       β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
       β”‚  β”‚            Stage 1 Model (EffNet-B0)               β”‚  β”‚
       β”‚  β”‚    Determines: Cow / Buffalo / None                β”‚  β”‚
       β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
       β”‚                             β”‚                            β”‚
       β”‚                             β–Ό                            β”‚
       β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
       β”‚  β”‚            Stage 2 Model (EffNet-B2)               β”‚  β”‚
       β”‚  β”‚       Predicts Breed (if Cow/Buffalo)              β”‚  β”‚
       β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
                   JSON Prediction Response
                               β”‚
                               β–Ό
                  Rendered on Next.js UI Dashboard


                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚          Supabase DB           β”‚
                  β”‚  - Authentication              β”‚
                  β”‚  - Role-based Profiles         β”‚
                  β”‚  - Notifications               β”‚
                  β”‚  - User Queries                β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“š Literature Review

# Title Year Link
1 Identification of Cattle Breed using CNN 2021 ResearchGate
2 Computer Vision-Based Detection of Dairy Cow Breed 2022 MDPI Electronics
3 Cattle Breed Classification Techniques 2024 Propulsion Tech Journal
4 Ensemble Learning for Cattle Breed Identification 2023 EAI
5 Animal Breed Classification using Deep Learning 2021 IJARSCT
6 Attention-based Transfer Learning 2024 PubMed

Key Research Findings

  • Transfer Learning significantly improves performance on limited datasets
  • EfficientNet outperforms traditional CNN models
  • Data augmentation is crucial for breed variability
  • Real-world lighting/pose variance demands robust models (EffNet-B3 excels here)

πŸ“¦ Dataset

Dataset Source: Indian Bovine Breeds - Kaggle

Folder Structure

dataset/
β”œβ”€β”€ cows/
β”‚   β”œβ”€β”€ Banni/
β”‚   β”œβ”€β”€ Amritmahal/
β”‚   └── ...
└── buffaloes/
    β”œβ”€β”€ Murrah/
    β”œβ”€β”€ Surti/
    └── ...

Data Augmentation Techniques

  • Rotate
  • Flip
  • Brightness/Contrast
  • Zoom
  • Crop
  • CLAHE (Contrast Limited Adaptive Histogram Equalization)

🧩 Detailed System Features

πŸ” Authentication (Supabase)

  • Email + Password login/signup
  • Profiles table with role column (admin, user)
  • Auto-redirect dashboard based on role

πŸ›  Admin Dashboard Features

  • βœ… Send notifications (text, image, video, audio, links)
  • βœ… View all user queries
  • βœ… Respond to user queries

πŸ‘€ User Dashboard Features

  • βœ… Receive notifications
  • βœ… Raise queries to admin
  • βœ… See AI classification history (optional future upgrade)

🎨 UI/UX Features (Next.js Frontend)

  • Drag & Drop upload
  • Live preview of image
  • Animated transitions (Framer Motion)
  • Modern blue-shaded theme
  • Responsive layout for mobile, tablet, desktop
  • Loading animation while inferencing
  • Role-protected routes

πŸš€ Future Scope

  • Real-time breed detection via camera (mobile/web)
  • Disease classification model
  • Farm management dashboard
  • Offline mode via TF Lite
  • Large-scale Indian cattle dataset creation

πŸ‘¨β€πŸ’» Developed By

Mayank Kumar
AI/ML Engineer & Full-Stack Developer


πŸ“„ License

This project is licensed under the MIT License.


Last Updated: December 2025

About

Smart AI Cattle Classifier

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Β 
Β 
Β 

Contributors