Automated detection and tracking of individual sheep are essential for precision livestock farming. However, existing approaches face significant challenges: (1) Limited dataset diversity with predominant aerial perspectives; (2) Detection failures under severe occlusions; (3) Frequent ID switches due to high appearance similarity. To address these challenges, our paper presents an integrated framework. Firstly, we construct a multi-scene indoor sheep dataset with diverse environmental conditions. Secondly, for detection, we propose an improved YOLOv8 incorporating SheepNMS and Flock-aware Localization Loss (FL-Loss) to handle crowded scenarios and occlusion. Finally, for tracking, we enhance BoT-SORT with a Flock Appearance Module (FAM) and Trajectory Correction Module (TCM) for robust association and drift mitigation. Extensive experiments demonstrate measurable improvements in detection accuracy, tracking consistency, and reductions in ID switches and fragmentations across diverse monitoring scenarios.
Feng et al. (Thu,) studied this question.