Skip to content

anvayborade/bovine-classifier-app

Repository files navigation

Project 67 — Bovine Image Classifier

Smart India Hackathon 2025 | Problem Statement ID 25004

Problem Statement: Image-based breed recognition for cattle and buffaloes of India
Theme: Agriculture, FoodTech & Rural Development
Category: Software


1. Overview

Bovine Image Classifier is an AI-powered, field-ready mobile system designed to improve breed identification of Indian cattle and buffaloes during on-ground data collection for the Bharat Pashudhan App (BPA) ecosystem.

The core problem is simple but high impact: Field Level Workers (FLWs) often misidentify animal breeds during registration, especially under real village conditions such as weak lighting, moving animals, multiple local breed names, look-alike breeds, and the presence of crossbreeds. Once a wrong breed is entered into BPA, that incorrect label affects all downstream use of the data: breeding analytics, nutrition planning, vaccination strategy, disease surveillance, and policy targeting.

This project addresses that failure point by making photo-assisted breed confirmation the default workflow. A user captures or selects an image of a cattle or buffalo, the AI model predicts the most likely breeds, and the app returns the result instantly in a simple, low-friction interface. The wider system then adds practical field utilities—crossbreed suggestion, vaccination reminders, vaccination log, nearby veterinarians, marketplace, and dairy marketplace—to make the app useful not only for registration but for continued farmer and FLW engagement.

The result is not just a classifier. It is an integrated bovine decision-support assistant built for real-world rural conditions.


2. Problem Statement and Why It Matters

2.1 Core problem

Breed identification in the field is still largely manual and depends on:

  • visual judgment,
  • breed familiarity,
  • local naming conventions,
  • field conditions,
  • and the confidence of the FLW.

This leads to breed misclassification, especially when:

  • two breeds have similar visual patterns,
  • lighting is poor,
  • only a partial animal view is available,
  • animals are dirty, moving, or occluded,
  • the animal is crossbred,
  • or the FLW is under time pressure.

2.2 Why the problem is serious

A wrong breed label may seem like a small error, but it creates systemic data corruption. That affects:

  • Genetic improvement programs — wrong breed populations distort breeding insights.
  • Nutrition planning — incorrect breed data weakens feed or productivity recommendations.
  • Disease control — surveillance and breed-linked management become less reliable.
  • Policy and scheme targeting — inaccurate registry data reduces the quality of dashboards and decisions.
  • Farmer trust — if an animal’s digital record does not reflect reality, the system loses credibility.

2.3 What the solution must do

A useful solution for this problem must:

  • work from animal images,
  • handle real field conditions,
  • support common Indian breeds and crosses,
  • be simple enough for minimally trained users,
  • integrate into the BPA workflow,
  • and run on ordinary Android devices with weak connectivity.

This project was designed exactly around those constraints.


3. Solution Summary

The project contains one core intelligence layer and multiple field utility layers.

3.1 Core: AI Breed Classifier

The main engine of the system is an image-based breed classifier.
A user captures a photo of a cattle or buffalo, and the model returns:

  • the most likely breed prediction,
  • multiple top suggestions,
  • and a confidence-guided confirmation flow.

This reduces guesswork and makes breed entry more consistent.

3.2 Field utility modules

To make the product useful beyond just classification, the system also includes:

Crossbreed Suggester

When the model identifies ambiguity between likely breeds, the system can surface possible crossbreed suggestions and explain them in simpler language.

Vaccinations and Vaccination Log

The app tracks due vaccines, stores vaccine history, and provides reminders and multilingual explainers.

Nearby Vets

Users can discover nearby vets/clinics through OpenStreetMap (OSM) + GPS with quick actions like directions and one-tap calling.

Marketplace

A marketplace for bovine-related trade helps users browse or post animal listings.

Dairy Marketplace

A focused marketplace for dairy inputs such as feed and related supplies.

3.3 Why this broader design matters

The classifier solves the entry-quality problem.
The utility modules solve the adoption problem.

If the app only classifies breeds, users may open it once and leave. By adding vaccines, vets, and marketplaces, the platform creates repeated day-to-day value, which:

  • increases usage,
  • improves data consistency,
  • improves feedback collection,
  • and makes the solution more sustainable in the field.

4. Key Features

4.1 AI Breed Classifier

  • Image input from camera or gallery
  • Returns breed suggestions on the spot
  • Designed for BPA-aligned confirmation workflow
  • Built to reduce errors and registration time

4.2 Crossbreed Suggester

  • Suggests possible crossbreeds for ambiguous cases
  • Converts technical prediction ambiguity into simple user-friendly guidance
  • Supports Hindi and multilingual explanation through Gemini

4.3 Vaccinations and Vaccination Log

  • Due list
  • Reminder flow
  • Timeline/history log
  • Plain-language vaccine explainers

4.4 Nearby Veterinarians

  • Uses OSM and device GPS
  • Helps users locate nearby vets/clinics
  • Supports one-tap contact and directions

4.5 Marketplace and Dairy Marketplace

  • Trusted listing concept for animals, feed, and dairy inputs
  • Supports multilingual guidance, location help, and quality-related assistance
  • Improves discoverability and field utility

4.6 Offline-first usability

  • Supports usage on low-end Android phones
  • Designed for intermittent connectivity
  • Critical operations can be completed and synced later

4.7 Local language support

  • Hindi and vernacular support via Gemini-assisted explanations and translations
  • Lower cognitive load for farmers and FLWs

4.8 Voice and assistive UX

  • Text-to-speech style guidance
  • Simple one-tap flows
  • Capture tips for better image quality

5. Technical Architecture

The project follows a practical, modular architecture with the following layers:

5.1 Frontend (Mobile App)

Technology: Flutter + Dart

Responsibilities:

  • Camera capture
  • Gallery input
  • Dashboard and quick actions
  • Offline mode
  • Text-to-speech / assisted guidance
  • Vaccination UI
  • Crossbreed suggestion UI
  • Marketplace screens
  • Vet discovery screens

Why Flutter:

  • Single codebase with fast UI iteration
  • Smooth mobile performance
  • Strong community packages
  • Good support for camera, maps, storage, and Firebase integration

5.2 Backend API

Technology: Python FastAPI

Responsibilities:

  • Receive image inference requests
  • Run / route prediction pipeline
  • Return model predictions to frontend
  • Handle token-secured endpoints
  • Logging and monitoring
  • Interface between frontend and model-serving logic

Why FastAPI:

  • Lightweight and fast
  • Easy async API development
  • Simple integration with Python ML stack
  • Good fit for inference services

5.3 AI / ML Layer

Core approach: Fine-tuned CNN-based image classification using pretrained backbones

Model family used:

  • EfficientNet-B0
  • EfficientNet-V2-S
  • MobileNet-V3-Large

Strategy:

  • Use pretrained models as strong visual feature extractors
  • Fine-tune them on the cattle/buffalo breed classification task
  • Combine predictions using ensemble averaging
  • Apply an additional logic layer for improved final result stability

Why this approach:

  • Pretrained CNNs learn strong image representations
  • EfficientNet and MobileNet families balance performance and efficiency
  • Ensemble prediction improves robustness over a single model
  • Suitable for field image variability

5.4 Generative Layer

Technology: Google Gemini API

Used for:

  • Crossbreed guidance text
  • Translation into Hindi / multilingual support
  • Vaccine explanations
  • Marketplace assistance
  • Vet-related simplified guidance

Why Gemini is used:

  • Converts technical outputs into plain language
  • Improves usability for non-technical users
  • Reduces language barrier
  • Enhances app uniqueness without changing the core AI classification logic

5.5 Database and Sync Layer

Technology: Firebase

Responsibilities:

  • Authentication and security integration
  • User-linked data storage
  • Sync workflows
  • App support state
  • Utility features and future analytics

Why Firebase:

  • Easy integration with Flutter
  • Fast cloud sync
  • Good for authentication, notifications, and lightweight data workflows
  • Suitable for rapid development and hackathon-to-product transition

5.6 Maps and Location Layer

Technology: OpenStreetMap + GPS

Used for:

  • Nearby vet discovery
  • Directions
  • Location-based support

6. AI Model Design

6.1 Classification goal

The model’s goal is to classify a cattle or buffalo image into the correct breed class and provide enough confidence information to support field confirmation.

6.2 Why CNNs

Convolutional Neural Networks (CNNs) are well suited to this task because they automatically learn:

  • coat patterns,
  • horn structures,
  • facial and body cues,
  • color distribution,
  • and other visual characteristics relevant to breed recognition.

6.3 Why pretrained backbones

Training a deep CNN from scratch requires:

  • very large labeled datasets,
  • long training time,
  • and high compute cost.

Using pretrained models enables:

  • faster convergence,
  • stronger general visual understanding,
  • better performance with moderate dataset sizes,
  • and more stable experimental iteration.

6.4 Why these three models

EfficientNet-B0

  • Efficient baseline model
  • Good balance of accuracy and compute cost

EfficientNet-V2-S

  • Stronger improved architecture
  • Efficient training and good accuracy-speed tradeoff

MobileNet-V3-Large

  • Mobile-friendly architecture
  • Useful for performance-conscious deployment

6.5 Ensemble method

Instead of relying on only one model, this system combines the outputs of multiple models.

Benefits:

  • Reduces over-reliance on a single architecture
  • Smooths prediction instability
  • Improves robustness across difficult conditions
  • Helps in real field scenarios where image quality is inconsistent

6.6 Reported performance

Based on the project’s internal results and presentation material, the classifier achieved approximately 88% to 90.8% accuracy on common breed scenarios. This supports its use as a decision-support classifier for on-field confirmation rather than an uncontrolled black-box labeler.


7. Dataset Strategy

7.1 Dataset sources

The system architecture and project material indicate a combination of:

  • field images,
  • open sources,
  • curated breed image sets,
  • and project-specific data assembly.

7.2 Dataset goals

The dataset should reflect the reality of field deployment:

  • different lighting,
  • different backgrounds,
  • different poses,
  • partial views,
  • common Indian breeds,
  • and crossbreed ambiguity.

7.3 Practical dataset challenges

The dataset for this problem is inherently difficult because:

  • some breeds are underrepresented,
  • many animals are visually similar,
  • crossbreeds blur hard class boundaries,
  • and field images are not studio-quality.

7.4 Labeling principles

A high-quality dataset for this project depends on:

  • consistent breed naming,
  • mapped local names,
  • removal of obviously wrong labels,
  • and careful review of ambiguous cases.

8. Image Pre-processing and Training Pipeline

8.1 Pre-processing

The project presentation identifies image pre-processing as a formal stage before model building.

Typical operations in this pipeline include:

  • cleaning raw image collections,
  • resizing/cropping,
  • normalization,
  • and augmentation for model readiness.

8.2 Why pre-processing matters

Field images are noisy. Without pre-processing, the model can learn background bias or unstable features.

Pre-processing improves:

  • consistency,
  • training stability,
  • and real-world generalization.

8.3 Augmentation

Augmentation helps simulate field conditions such as:

  • brightness shifts,
  • pose variation,
  • crop variation,
  • and mild rotation or framing changes.

This improves model robustness when deployed outside the training set.

8.4 Training

The technical slide indicates:

  • cross-entropy loss
  • Adam optimizer
  • ensemble averaging + boosting

This suggests a supervised multi-class image classification workflow.

8.5 Evaluation

Evaluation focuses on model accuracy and deployment usefulness. For this project, the classifier is most useful when it:

  • predicts the right breed,
  • gives a useful top-k list,
  • and supports fast human confirmation.

9. App Workflow

9.1 End-to-end user flow

  1. User opens app dashboard
  2. User selects AI predictor / camera
  3. Image is captured or chosen from gallery
  4. App performs local validation / flow checks
  5. Image is sent to backend inference service
  6. Backend model returns predictions
  7. App shows prediction result and guidance
  8. User confirms / acts on result
  9. User may continue to related utility modules:
    • crossbreed guidance
    • vaccination reminder/log
    • nearby vets
    • marketplace
    • dairy marketplace

9.2 BPA-aligned logic

The main operational idea is:

  • make breed entry more reliable at the source,
  • reduce registration friction,
  • and assist field workers at the moment the decision is being made.

10. Why the Extra Modules Matter

This project is not adding extra features just for feature count.

10.1 Crossbreed Suggester solves ambiguity

The core classifier may encounter images where multiple breeds are plausible.
Instead of forcing a wrong single label, the system can explain a likely crossbreed scenario.

This improves:

  • honesty in prediction flow,
  • field usability,
  • and data realism.

10.2 Vaccination tools solve continuity

Correct breed entry helps the registry, but farmers need day-to-day value.
Vaccination reminders and logs improve continued usage and real animal-care outcomes.

10.3 Nearby vets solve urgency

When a farmer has an animal issue, they need a simple next step.
This feature keeps the app relevant in time-sensitive cases.

10.4 Marketplaces solve adoption and sustainability

If the app also helps with discovery, transactions, and local dairy utility, it creates a real reason for repeated engagement.

That repeated engagement:

  • improves retention,
  • increases trust,
  • and indirectly strengthens the quality of registry data.

11. Feasibility and Viability

11.1 Technical feasibility

The system is feasible because it uses:

  • common Android devices,
  • standard mobile frameworks,
  • proven CNN architectures,
  • a lightweight backend API,
  • and practical deployment-ready components.

11.2 Operational feasibility

The app fits the BPA-style workflow:

  • photo,
  • prediction,
  • confirmation,
  • and related field actions.

It does not demand special hardware.

11.3 Government feasibility

The solution supports government priorities by improving:

  • breed data quality,
  • audit readiness,
  • scheme targeting,
  • and policy-level analytics.

11.4 Economic feasibility

The project aims to work with:

  • existing phones,
  • low recurring costs,
  • simple cloud-backed infrastructure,
  • and modular scaling.

11.5 Scalability

The deck positions the app as scalable from:

  • district pilot
  • to statewide expansion
  • to national rollout

This makes the architecture suitable for long-term extension.


12. Challenges and Solutions

12.1 Connectivity issues

Challenge: Rural connectivity can be weak, slowing confirmations and service access.
Response: Offline-first flows, queued sync, compression, and fallback behavior.

12.2 Device limitations

Challenge: Older low-RAM devices may lag with camera, maps, or media-heavy flows.
Response: Lite UX, optimized asset handling, efficient UI design, and future model optimization.

12.3 Data quality limitations

Challenge: Rare breeds and visually similar animals remain difficult.
Response: Top-k suggestions, capture guidance, iterative data improvement, and continued retraining.

12.4 Privacy and consent

Challenge: Photo capture and user trust require clear boundaries.
Response: Consent-first workflow, minimal storage, and government-aligned policies.


13. Impact and Benefits

13.1 Social impact

  • Builds trust through accurate and transparent records
  • Improves service access
  • Supports community resilience through timely health actions

13.2 Economic impact

  • Uses existing smartphones and lightweight connectivity
  • Reduces error-related rework
  • Helps farmers through marketplace utility and better margins

13.3 Educational impact

  • Local-language guidance lowers usage barriers
  • Capture tips improve compliance and photo quality
  • Voice prompts support minimally trained users

13.4 Governance impact

  • Better data for central dashboards
  • Easier analysis and audit-readiness
  • Better scheme targeting

13.5 Environmental / animal health impact

  • Better vaccination adherence
  • Reduced unnecessary antibiotic overuse
  • Improved feeding and management decisions through cleaner data

13.6 Audience-specific impact

Farmers

  • Better breed identification
  • Vaccine reminders
  • Market access
  • Faster vet discovery

FLWs

  • Time-saving breed prediction
  • Reduced rework
  • Streamlined app usage

Veterinarians

  • Better referral information
  • More informed farmer conversations
  • Stronger follow-up potential

Dairy Co-ops / Government

  • Better data
  • Better outreach planning
  • Better scale potential

14. Security, Privacy, and Responsible Use

Because the system handles real animal data and user-linked workflows, responsible use matters.

Recommended operational safeguards:

  • explicit consent before image use,
  • minimal data retention,
  • secure tokens for backend requests,
  • Firebase authentication and access control,
  • HTTPS-only network traffic,
  • audit logging where feasible,
  • and careful handling of multilingual generated content.

This project should be treated as a decision-support assistant, not a replacement for trained veterinary or administrative judgment in edge cases.


15. Suggested Repository Split

Based on the project structure discussed so far, a practical split is:

App repository

Example: bovine-classifier-app Contains:

  • Flutter mobile UI
  • dashboard
  • AI predictor screens
  • vaccination screens
  • marketplace screens
  • vet discovery flows
  • Firebase integration
  • local storage / sync logic

Server repository

Example: bovine-classifier-server Contains:

  • FastAPI backend
  • model-loading logic
  • prediction endpoints
  • preprocessing
  • Gemini integration layer
  • authentication hooks
  • logs / monitoring helpers

16. Recommended Environment Configuration

16.1 App-side

Typical requirements:

  • Flutter SDK
  • Dart SDK
  • Android Studio / VS Code
  • Firebase configuration
  • map/location permissions
  • camera permissions
  • internet/storage permissions

16.2 Server-side

Typical requirements:

  • Python 3.10+
  • FastAPI
  • Uvicorn
  • PyTorch / TorchVision
  • OpenCV
  • Gemini API access
  • environment-based secret management

16.3 Example environment variables

GEMINI_API_KEY=your_key_here
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_API_KEY=your_api_key
MODEL_PATH_EFFB0=path/to/model1
MODEL_PATH_EFFV2S=path/to/model2
MODEL_PATH_MOBILENETV3=path/to/model3
APP_ENV=development

17. Setup Guide (High-Level)

Note: This README is based on the project design and presentation material. Exact commands, package names, routes, and file paths should be aligned to the final code in the app and server repositories.

17.1 Mobile app setup

  1. Clone the Flutter app repository
  2. Install Flutter dependencies
  3. Add Firebase config files
  4. Configure API base URL
  5. Add required permissions
  6. Run on Android device/emulator

Typical commands:

flutter pub get
flutter run

17.2 Backend setup

  1. Clone the server repository
  2. Create virtual environment
  3. Install Python dependencies
  4. Configure model paths and API keys
  5. Start FastAPI server

Typical commands:

python -m venv .venv
source .venv/bin/activate   # Linux/macOS
# or .venv\\Scripts\\activate on Windows

pip install -r requirements.txt
uvicorn app.main:app --reload

17.3 Model serving notes

  • Load fine-tuned model checkpoints at startup
  • Preprocess incoming images consistently with training
  • Return structured prediction payloads
  • Keep inference logging lightweight but useful

18. Future Roadmap

18.1 Short-term

  • improve prediction calibration
  • better top-k result explanations
  • polish UI and multilingual flows
  • improve crossbreed experience
  • expand breed coverage

18.2 Medium-term

  • optimize model size for low-end phones
  • stronger offline inference support
  • smarter feedback loop for difficult cases
  • better vet and marketplace verification

18.3 Long-term

  • district and state deployment pilots
  • tighter BPA workflow integration
  • richer analytics dashboards
  • personalization for farmers/co-ops
  • safer and more accountable model monitoring

19. Limitations

This system is powerful, but it has real limitations:

  • difficult breeds can still confuse the model,
  • poor images can still reduce accuracy,
  • crossbreed boundaries are not always clean,
  • and generated guidance must be reviewed for safety and simplicity.

The system should therefore be positioned as:

  • a decision-support tool,
  • a field assistant,
  • and a data-quality improver, not an unquestionable automated authority.

20. References and Research Basis

The project presentation lists the following research and conceptual references:

  • Cattle Breed Classification Techniques: Framework and Algorithm Evaluation
  • DeepLearningCourse | edX
  • Bharat Pashudhan
  • EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks
  • EfficientNetV2: Smaller Models and Faster Training
  • Searching for MobileNetV3
  • Indian Bovine breeds

These references support:

  • the feasibility of image-based breed recognition,
  • the choice of CNN-based architectures,
  • and the practical importance of livestock digitization.

21. Final Summary

Bovine Image Classifier is an AI-assisted bovine registration and utility platform built around a simple but critical field problem: wrong breed entry at the time of data capture.

By combining:

  • an AI image classifier,
  • a crossbreed suggestion layer,
  • vaccination tools,
  • nearby vets,
  • and marketplaces,

the project turns a single technical solution into a field-usable ecosystem. It improves data quality at the source, reduces FLW effort, increases farmer value, and creates a realistic path from hackathon prototype to scalable government-aligned deployment.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors