Related Experiment Videos
Pig Passage Counting Based on Improved YOLO and HMTC Strategy
Lu Yang1,2, Saisai Wu3, Shuqing Han1,2
1Agricultural Information Institute, Chinese Academy of Agricultural Sciences, Beijing 100081, China.
Animals : an Open Access Journal From MDPI
|July 15, 2026
Summary
Accurate pig counting is crucial for livestock management. This study introduces an improved YOLO model and a Hysteresis-based Multi-frame Temporal Confirmation Counting Strategy (HMTC) for precise, real-time pig passage counting in swine production.
Area of Science:
- Agricultural Engineering
- Computer Vision
- Animal Science
Background:
- Accurate pig counting is essential for efficient large-scale swine production and livestock management.
- Existing automated counting methods face challenges with bidirectional passages, boundary oscillations, and occlusion in real-world corridor environments.
Purpose of the Study:
- To develop and validate an integrated system for accurate pig passage counting in swine production.
- To enhance object detection models for improved accuracy and efficiency in livestock environments.
- To implement a robust counting strategy that overcomes limitations of existing methods in complex scenarios.
Main Methods:
- An improved YOLOv11s detection model was developed using RepViT blocks, dynamic upsampling (DySample), and shape-aware bounding box regression (Shape-IoU).
- A Hysteresis-based Multi-frame Temporal Confirmation Counting Strategy (HMTC) was integrated to handle bidirectional passages and reduce counting errors.
- The system was evaluated on nine videos from a single transfer corridor, assessing detection accuracy, parameter efficiency, and real-time performance.
Main Results:
- The enhanced YOLO model achieved a mean Average Precision (mAP50) of 0.982 with 8.28M parameters, a 12.3% reduction from the baseline, while improving detection.
- The integrated HMTC system demonstrated an overall counting accuracy of 99.21% on the test set.
- The system achieved real-time performance exceeding 30 FPS on an embedded edge device without compromising counting accuracy.
Conclusions:
- The proposed integrated system, combining an enhanced YOLO model and HMTC strategy, provides a cohesive and accurate solution for pig passage counting.
- The system effectively addresses challenges like bidirectional flow and boundary oscillations, offering a promising foundation for automated animal inventory management.
- Further validation across diverse farm environments is recommended to broaden the applicability of this automated livestock management technology.