Dairy cattle are essential for agricultural food systems, converting non-human-edible feedstuffs into nutrient-rich milk, while supporting global food security and rural livelihoods. Monitoring the behaviour and health status of animals is crucial for effective farm management and ensuring animal welfare. Continuous animal identification (ID) and tracking supports these goals. Computer vision (CV) has emerged as a promising approach for automated monitoring. However, most existing CV-based tracking methods focused on short-term tracking, where animals remained within the field of view (FOV). In commercial free-stall barns, cows frequently move in and out of the FOV due to environmental complexity and daily management activities, making continuous tracking more challenging. This study introduced a unique two-step Hungarian matching process for re-identifying Holstein cows when re-entering the FOV in a free-stall barn. The approach first employed a YOLOv8-based object detector to localise cows in each frame, followed by a feature-based classification step that assigns ID probabilities. A two-step Hungarian matching process then associated detections with identities by maximising classification probabilities. The method was trained and tested on video footages of 13 cows and evaluated against SORT, DeepSORT, ByteTrack and TrackFormer. It outperformed the compared methods in maintaining accurate and long-term identification, achieving average Identification F1 score, Higher Order Tracking Accuracy, Multiple Object Tracking Accuracy, Mostly Tracked, Mostly Lost, and Identification Switches of 0.946, 0.929, 0.894, 10, 0.5, and 221, respectively. These results support the integration of this technology into behaviour monitoring systems to enhance animal health and welfare. The code is available at: https://github.com/meiqing-wang/Cow-TrackingbyClassification . • Developed a CV-based tracking-by-classification method for reidentifying cows. • Achieved continuous, long-term tracking with consistent unique IDs. • Validated method on large dataset under varied environmental conditions.
Wang et al. (Sat,) studied this question.