YOLOv5-VF-W3: A novel cattle body detection approach for precision livestock farming - Hao, Wangli; Ren, Chao; Han, Meng; Li, Fuzhong; Liu, Zhenyu (International Journal of Agricultural and Biological Engineering, 2025)
Accurate cattle body detection can significantly enhance the efficiency and quality of animal husbandry production. Traditional manual observation approaches are not only inefficient but also lack objectivity, while computer vision-based methods demand prolonged training periods and present challenges in implementation. To address these issues, this paper develops a novel precise cattle body detection solution, namely YOLOv5-VF-W3. By introducing the Varifocal loss, the YOLOv5-VF-W3 model can handle imbalanced samples and focus more attention on difficult-to-recognize instances. Additionally, the introduction of the WIoUv3 loss function provides the model with a wise gradient gain allocation strategy. This strategy reduces the competitiveness of high-quality anchor boxes while mitigating harmful gradients produced by low-quality anchor boxes, thereby emphasizing anchor boxes of ordinary quality. Through these enhancements, the YOLOv5-VF-W3 model can accurately detect cattle bodies, improving the efficiency and quality of animal husbandry production. Numerous experimental results have demonstrated that the proposed YOLOv5-VF-W3 model achieves superior cattle body detection results in both quantitative and qualitative evaluation criteria. Specifically, the YOLOv5-VF-W3 model achieves an mAP of 95.2% in cattle body detection, with individual cattle detection, leg detection, and head detection reaching 95.3%, 94.8%, and 95.4%, respectively. Furthermore, in complex scenarios, especially when dealing with small targets and occlusions, the model can accurately and efficiently detect individual cattle and key body parts. This brings new opportunities for the development of precision livestock farming. Key words: cattle body detection; varifocal loss; key body parts; WIoUv3 lossDOI: 10.25165/j.ijabe.20251802.9107Citation: Hao W L, Ren C, Han M, Li F Z, Liu Z Y. YOLOv5-VF-W3: A novel cattle body detection approach for precision livestock farming. Int J Agric & Biol Eng, 2025; 18(2): 269–277.