Cattle-Go

CattleGo - Intelligent Livestock Breed Identification System

Overview - of Cattle Breed

CattleGo is a smart livestock management app that helps farmers and researchers identify Indian cattle breeds using AI-based image recognition. It combines machine learning, real-time detection, multilingual support, and a RAG-based chatbot to make livestock management more accessible and efficient.

Features

Breed Detection (AI Model)

Frontend

Backend

RAG-based Chatbot

Multilingual Support

Tech Stack

Layer Technologies Used
Frontend Flutter
Backend FastAPI, Python
Machine Learning TensorFlow / Keras (MobileNetV2)
Authentication Firebase
Deployment Hugging Face Spaces (breed detection API), separate server for chatbot
Database Firebase Firestore (optional for storing user data)

Architecture Workflow

  1. User Login -> Firebase Authentication
  2. Choose Detection Mode -> Upload photo or live camera feed
  3. Image Sent to FastAPI Server -> Hugging Face Spaces hosts the public inference API
  4. Model (MobileNetV2) -> Predicts cattle breed and returns response
  5. Result Displayed in App -> Breed name + confidence level
  6. Chatbot Interaction -> Users can ask breed-related queries
  7. Multilingual UI -> English, Tamil, Hindi toggle

Machine Learning Model Details

Training Evolution

Stage 1: Initial Fine-tuning (After Finetune1 -> Before Finetune2)

Stage 1 Results Analysis: Model begins learning but struggles with generalization, showing clear overfitting patterns.

Stage 2: Intermediate Fine-tuning (After Finetune2 -> Before Finetune3)

Stage 2 Results Analysis: Overfitting reduced; model generalizes better with stable loss and accuracy curves.

Stage 3: Enhanced Fine-tuning (After Finetune3 -> Before Finetune4)

Stage 3 Results Analysis: Excellent convergence with high accuracy and synchronized loss curves.

Stage 4: Final Optimization (After Finetune4 -> Before Finetune5)

Stage 4 Results Analysis: Model achieves its best performance; overfitting minimized and accuracy plateau achieved.

Confusion Matrix

Confusion Matrix Purpose: Displays model performance across all breed classes, highlighting correctly and incorrectly predicted breeds.

App Screenshots

Below are key screens of the CattleGo app demonstrating multilingual support, breed classification, chatbot, and user interface design.

Authentication

| Sign In | Sign Up | |———-|———-| | Sign In Page | Sign Up Page |

Home & Settings

| Home Page | Settings Page | Profile | |————|—————-|———-| | Home Page | Settings Page | Profile Page |

Breed Classification

| Classification Page | Breeds List | Breeds Info | |———————-|————-|————–| | Classify Page | Breeds Page | Breeds Page 2 |

RAG Chatbot & Info Pages

| Chatbot | How To Use | App Language | |———-|————-|————–| | Chatbot Page | How To Page | Language Page |

Privacy Policy

Privacy Policy Page

Try the App

You can try the CattleGo app on your Android device using our Release APK:

Download CattleGo APK

Make sure to enable “Install from unknown sources” on your Android device to install the APK.

Hugging Face Space API

The cattle breed detection backend is publicly deployed on Hugging Face Spaces.

Users can access the deployed API using their own Hugging Face access tokens.

Create a token

  1. Sign in to Hugging Face.
  2. Open Settings -> Access Tokens.
  3. Create a token with the permissions required to access the Space.
  4. Export it in your terminal as HF_TOKEN.

Test image upload prediction

Use the /predict endpoint for standard image classification:

export HF_TOKEN="your_huggingface_token"
export HF_SPACE="https://sanjay11kumar17s-cattle-go-model.hf.space"

curl -X POST \
  -H "Authorization: Bearer $HF_TOKEN" \
  -F "file=@path/to/cattle_image.jpg" \
  "$HF_SPACE/predict"

Expected response format:

{
  "class": "Gir",
  "confidence": 0.94,
  "description": "Indian dairy breed...",
  "message": "Prediction complete"
}

Test live frame prediction

Use the /predict-frame endpoint for real-time frame uploads:

curl -X POST \
  -H "Authorization: Bearer $HF_TOKEN" \
  -F "file=@path/to/frame.jpg" \
  "$HF_SPACE/predict-frame"

Access Space logs via API

Get container logs:

curl -N \
  -H "Authorization: Bearer $HF_TOKEN" \
  "https://huggingface.co/api/spaces/SANJAY11KUMAR17S/Cattle_Go_Model/logs/run"

Get build logs:

curl -N \
  -H "Authorization: Bearer $HF_TOKEN" \
  "https://huggingface.co/api/spaces/SANJAY11KUMAR17S/Cattle_Go_Model/logs/build"

GPU Resource

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.65.06              Driver Version: 580.65.06      CUDA Version: 13.0     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4070 ...    Off |   00000000:01:00.0  On |                  N/A |
|  0%   37C    P8              9W /  220W |   10369MiB /  12282MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A            1364      G   /usr/lib/xorg/Xorg                      150MiB |
|    0   N/A  N/A            1600      G   /usr/bin/gnome-shell                     20MiB |
|    0   N/A  N/A            4666      G   /usr/share/code/code                     44MiB |
|    0   N/A  N/A            5360      C   python                                10052MiB |
|    0   N/A  N/A            6189      G   rustdesk                                 31MiB |
+-----------------------------------------------------------------------------------------+

Future Enhancements

Setup & Installation

Prerequisites

Installation Steps

  1. Clone the repository
  2. Install Flutter dependencies: flutter pub get
  3. Set up Python backend: pip install -r requirements.txt
  4. Configure Firebase authentication
  5. Deploy the FastAPI model backend to Hugging Face Spaces or use the public deployed Space
  6. Run the Flutter app: flutter run

Usage

  1. Login: Users authenticate via Firebase
  2. Detection Mode Selection:
    • Live Camera: Real-time breed detection
    • Photo Upload: Detect from existing images
  3. Results: View predicted breed with confidence score
  4. Chat Assistance: Ask breed-related questions via chatbot
  5. Language Toggle: Switch between English, Tamil, or Hindi

Contributing

We welcome contributions to improve CattleGo. Areas of interest:


Note: This documentation reflects the model training progress up to Finetune4, with Finetune5 representing ongoing optimization efforts.

Disclaimer: Developed by Team VeriSimilar. All Rights Reserved 2025