Real-Time Livestock Detection, Tracking & Counting Platform
Built for Deonar Abattoir, Mumbai
DEONAR AI is a production-grade livestock counting platform developed to automate animal counting operations at Deonar Abattoir, Mumbai.
The platform combines computer vision, object tracking, counting intelligence, vendor session management, and real-time streaming to replace manual counting processes with an accurate, auditable, and scalable AI solution.
- Real-time livestock counting from CCTV feeds
- YOLOv11 & YOLOv12 object detection
- ByteTrack & BoT-SORT multi-object tracking
- Dual-line counting intelligence
- Vendor slot management system
- Browser-based WebRTC live monitoring
- Multi-threaded processing pipeline
- CSV audit trail and reporting
- Production-ready deployment architecture
End-to-end overview of the Deonar AI livestock counting platform.
Click the preview above to watch the complete end-to-end system demonstration.
-
Live CCTV ingestion
-
Real-time goat detection
-
Multi-object tracking
-
Dual-line counting intelligence
-
Vendor session management
-
Browser-based monitoring
-
Audit reporting and analytics
The annotated output video showcases:
-
YOLO detections
-
Tracking IDs
-
Counting line interactions
-
Live count updates
-
Real-time visual overlays
|
|
Monitor live counting sessions, track vendor operations, and access audit-ready reports through a centralized interface.
For readers interested in the technical implementation details, counting algorithms, deployment architecture, project journey, and system design decisions, see:
- 📘 DOCUMENTATION.md — Complete technical and project documentation
Complete architecture showing video ingestion, AI processing, counting intelligence, vendor management, and reporting.
CCTV Feed / Video
↓
YOLO Detection
↓
Multi-Object Tracking
↓
Counting Intelligence
↓
Vendor Slot Mapping
↓
Reports & Audit Trail
Motion-aware counting engine designed to ensure every animal is counted exactly once.
The counting engine combines:
- Object Detection
- Multi-Object Tracking
- Motion Validation
- Direction Analysis
- Count Confirmation Logic
- Dual-Line Verification
Counts animals crossing a single virtual counting line with anti-flicker validation and cooldown protection.
Uses Line A → Line B verification combined with motion validation and direction consistency checks to maximize counting accuracy.
Counts entries and exits within a configurable region of interest, suitable for pen monitoring and wider gate scenarios.
Production deployment architecture supporting local and remote monitoring.
-
The platform streams annotated video through WebRTC and can be deployed on a remote server for browser-based monitoring.
-
Operators can securely monitor live counting sessions from anywhere without requiring direct access to the processing machine.
- PyTorch
- Ultralytics
- YOLOv11
- YOLOv12
- ByteTrack
- BoT-SORT
- OpenCV
- NumPy
- WebRTC
- aiortc
- aiohttp
- FastAPI
- Uvicorn
- Pydantic
- Rich
- JSONL Logging
- CSV Reporting
- CVAT
- Vast.ai (RTX 5090)
- HuggingFace Hub
- Tailscale
Models were trained on a custom dataset of more than 20,000 annotated livestock images collected under real operational conditions at Deonar Abattoir.
| Model | mAP@50 | mAP@50-95 | Size |
|---|---|---|---|
| YOLOv11 Nano | 98.99% | 78.05% | ~5.4 MB |
| YOLOv11 Small | 99.05% | 79.00% | ~19 MB |
| YOLOv12 Nano | 99.04% | 78.12% | ~5.4 MB |
| YOLOv12 Small | 99.09% | 79.43% | ~19 MB |
Models are hosted on HuggingFace:
https://huggingface.co/ubada11/goat-detection-yolov11
Download the preferred model and place it inside:
models/
before starting the application.
| Metric | Value |
|---|---|
| Dataset Size | 20,000+ Images |
| Annotation Platform | CVAT |
| Training Infrastructure | Vast.ai RTX 5090 |
| Detection Models | YOLOv11 & YOLOv12 |
| Validation Accuracy | ~99% mAP@50 |
The dataset was collected and annotated directly from operational livestock counting environments under varying camera angles, lighting conditions, densities, and weather conditions.
The dataset used for training was collected from real-world livestock counting environments and is not publicly distributed.
For academic, research, or industry collaboration inquiries regarding dataset availability, please contact:
Ubada Ghawte 📧 ubadaghawte2005@gmail.com
| Metric | Performance |
|---|---|
| Detection Accuracy | ~99% mAP@50 |
| Miss Rate | < 5% |
| Processing Mode | Real-Time |
| Tracking | ByteTrack / BoT-SORT |
| Streaming | WebRTC |
| Reporting | CSV + Video + Audit Logs |
The platform was designed and tested for livestock counting operations at Deonar Abattoir, Mumbai.
Supported capabilities include:
- Automated livestock counting
- Vendor session management
- Browser-based live monitoring
- Remote deployment support
- Audit-ready reporting
- Operational analytics
├── assets/ # Project media and documentation assets
│ ├── architecture/ # System architecture diagrams and workflow visuals
│ ├── screenshots/ # Application UI screenshots
│ ├── demo/ # Demo videos and recordings
│
├── configs/ # Configuration files (models, streams, counting settings)
├── models/ # Downloaded and trained AI model weights
├── outputs/ # Generated reports, logs, videos, and run artifacts
├── src/ # Core application source code
│ ├── capture/ # Video capture and stream ingestion modules
│ ├── infer/ # YOLO inference and detection pipeline
│ ├── counting/ # Counting logic and event processing
│ ├── display/ # Visualization, overlays, and UI rendering
│ ├── slots/ # Vendor slot/session management system
│ ├── geometry/ # Lines, zones, ROIs, and spatial calculations
│ ├── runtime/ # Runtime orchestration and application services
│ └── utils/ # Shared helper functions and utilities
│
├── main.py # Application entry point
├── pyproject.toml # Project metadata and build configuration
├── requirements.txt # Python dependency list
└── README.md # Project documentation
- Python 3.10+ (enforced by the installer; earlier versions are rejected)
- NVIDIA GPU with CUDA recommended for real-time inference
- See
requirements.txtfor full dependency list
git clone https://github.com/Ubada12/Deonar-AI.git
cd Deonar-AI
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux / macOS
source .venv/bin/activate
pip install -e .pip install -e . registers a setup-installer command that does more than plain pip install -r requirements.txt. It:
- Detects your GPU/driver via
nvidia-smiand picks a matching PyTorch (CUDA) build automatically - Detects whether your machine has a display (headless server vs desktop) and installs the correct OpenCV variant —
opencv-python(GUI) oropencv-python-headless— without letting the two fight over thecv2module - Checks ffmpeg availability on PATH (Windows/macOS/Linux)
- Skips anything that's already correctly installed, and retries failed installs
- Writes an install log + metrics JSON to
./logs/
Requires Python 3.10+.
setup-installer \
--auto-detect-torch \
--force-reinstall \
--install-cuda-python \
--install-nvidia-ml \
--retries 3 \
--run-after python main.py --source rtsp://your-stream-urlThis will: detect your CUDA version → install/repair the matching PyTorch trio →
install cuda-python + nvidia-ml-py for GPU monitoring → install/repair OpenCV
for your machine → install all remaining project dependencies → and, only if
everything succeeded, immediately launch main.py with your stream.
setup-installer --auto-detect-torch --force-reinstall --dry-run| Flag | What it does |
|---|---|
--auto-detect-torch |
Detects CUDA and installs a matching PyTorch build (or CPU build if no GPU) |
--force-reinstall |
Uninstalls and reinstalls torch/torchvision/torchaudio if mismatched or broken |
--torch-version X --torchvision-version Y --torchaudio-version Z --cuda-tag cuXXX |
Pin exact versions instead of auto-detecting |
--install-cuda-python |
Installs cuda-python bindings |
--install-nvidia-ml |
Installs nvidia-ml-py (GPU monitoring) |
--no-deps |
Pass --no-deps to all pip installs |
--retries N |
Retry failed installs (default 3) |
--run-after <cmd...> |
Run a command (e.g. python main.py --source ...) after a successful install |
--dry-run |
Show the planned install queue without installing anything |
--verbose / --always-progress |
Show raw pip output |
-
Before running the application, download the required detection model from the HuggingFace repository and place the model file inside the
models/directory. The application does not automatically download model weights, so this step is required for successful inference. -
Ensure that the model path specified in
configs/config.yamlmatches the model file you placed in themodels/directory. Incorrect paths or model names will prevent the application from starting correctly. -
The default
config.yamlis configured for beginners and is suitable for getting started quickly with the project. However, if you plan to use Deonar AI for a different deployment environment, camera setup, counting scenario, custom model, RTSP stream, or any other use case, you should review and update the configuration values according to your requirements. -
Always verify settings such as model paths, video sources, counting lines, tracking parameters, output locations, and streaming options in
configs/config.yamlbefore deployment to ensure the system behaves as expected in your environment.
Configure your model and video source in:
configs/config.yaml
Run:
python main.pyThe application supports:
- RTSP streams
- CCTV cameras
- Local video files
Every run generates structured outputs including:
- Event Logs
- Count Time Series
- Decision Traces
- Performance Metrics
- Annotated Videos
- Vendor Session Reports
- Summary Reports
Output structure:
outputs/runs/<run_id>/
|
🧑💼 Project Lead Ubada Ghawte Lead ML Developer & Full Stack Developer |
👥 Team Members ➤ Adil ➤ Raafe |
🎓 Academic Guide Prof. Farhan Rizvi College of Engineering |
🏭 Industry Partner MI Tradings & General Suppliers |
Licensed under the Apache License 2.0.
See the LICENSE file for details.





