Project Overview
This project is a real-time egg detection and counting system built with YOLO12 and OpenCV, designed for deployment in poultry farms and egg processing facilities. The system captures video input (live camera or pre-recorded footage), detects eggs, tracks them across frames, and counts each one as it crosses a virtual horizontal line on the screen.
By combining object detection, tracking with unique IDs, and directional movement analysis, the system ensures each egg is counted only once. The intuitive visual interface displays bounding boxes, centroids, labels, and the live count—making it ideal for monitoring productivity and automating manual counting processes.
Features
-
Real-Time Egg Detection using a YOLO12-trained model (
best.pt) -
Object Tracking with Unique IDs for non-redundant counting
-
Directional Line Crossing Logic (top-to-bottom / bottom-to-top detection)
-
Visual Feedback: bounding boxes, labels, object centroids
-
Accurate Counting with line-cross logic and memory of previous positions
-
Video File or Webcam Support (
egg.mp4or live feed) -
Modular Design: Easily extendable for size, weight, or quality-based analysis
-
Optimized for Egg Class Only to reduce unnecessary computation
Tech Stack
| Component | Description |
|---|---|
| YOLO12 (Ultralytics) | For object detection and tracking |
| OpenCV | For video processing, visualization, and GUI |
| Python | Core programming language |
| cvzone | Optional utilities for drawing and interface |
| PyTorch | Backend for YOLO12 model inference |
Conclusion
This project demonstrates a practical computer vision solution tailored for agricultural automation, particularly in egg production and processing lines. With the power of YOLO12’s detection and tracking and OpenCV’s video processing capabilities, the system reliably counts eggs in real-time, ensuring accuracy through object ID persistence and direction-based logic. Its modular, lightweight design enables easy customization for extended applications such as size grading, quality assessment, and integration with farm management software. It provides a cost-effective way to reduce manual labor and enhance productivity in poultry operations.


Reviews
There are no reviews yet.