This protocol benchmarks six YOLO models for real-time cattle behavior detection to support welfare and farm management optimization.
Method Article
This protocol benchmarks six YOLO models for real-time cattle behavior detection to support welfare and farm management optimization.
Real-time and accurate cattle behavior detection is crucial for improving animal welfare and optimizing livestock management. To address this, this study comprehensively evaluates six community-developed lightweight YOLO (You Only Look Once) models-YOLOv8n, YOLOv9t, YOLOv10n, YOLOv11n, YOLOv12n, and YOLOv13n-for recognizing five key cattle behaviors (standing, lying, foraging, drinking, and rumination) using the custom CBVD-5 dataset. The dataset includes diverse lighting conditions and natural barn environments to reflect real-world monitoring scenarios. All models were assessed using standard object detection metrics (precision, recall, mAP@50, and mAP@50-95) and deployment-oriented indicators including inference time, frames per second (FPS), model size, and training duration to provide a balanced evaluation of accuracy and efficiency. YOLOv13n achieved the highest mAP@50-95 (0.712), while YOLOv11n reached the highest mAP@50 (0.967) and exhibited stable convergence with a good trade-off between detection accuracy and inference speed. YOLOv10n demonstrated the fastest inference speed (1.2 ms/frame, ~833 FPS), making it well-suited for latency-sensitive applications such as continuous barn surveillance. All models maintained compact sizes below 6 MB and real-time throughput exceeding ~300 FPS, confirming their practicality for edge deployment. The results establish a reproducible benchmarking framework for evaluating modern YOLO variants, offering insights into model selection for efficient, scalable, and welfare-oriented livestock monitoring systems.
The efficient monitoring of cattle behavior is essential in precision livestock farming, supporting welfare management, disease detection, and operational optimization. Non-invasive vision-based approaches are particularly promising due to their scalability and versatility. Standardized datasets such as CBVD-5 (Cow Behavior Video Dataset with 5 classes) offer diverse behavior annotations across varied lighting conditions, making them valuable benchmarks in this domain1. In most practical farm settings, cameras are fixed at a moderate height with relatively stable lighting, though occasional occlusion among cattle may affect detection performance. Behavior recognition in livestock continues to face challenges such as occlusion, motion variability, and sparse training data. To address these challenges, prior works have explored sensor-based approaches2, image pattern modeling3, and ensemble deep learning strategies4. Object detection frameworks like YOLO (You Only Look Once), first introduced by Redmon et al.5, and its more advanced version YOLOv76, stand out for their ability to balance detection accuracy, latency, and computational efficiency. In this study, real-time performance refers to achieving an inference speed above 30 frames per second (FPS), which ensures smooth and continuous video-based behavior tracking in practical farm settings. This study systematically evaluates the performance of YOLOv8n through YOLOv13n on the CBVD-5 dataset, emphasizing real-time behavior detection and deployment constraints. Recent advancements in YOLO architecture, including the open community releases YOLOv87, YOLOv98, YOLOv109, YOLOv1110, YOLOv1211, and YOLOv1312, have introduced improvements in detection precision and computational efficiency. These models leverage innovations like multi-task learning, anchor-free heads, and optimized transfer learning, making them more suitable for resource-constrained environments typically encountered in large-scale livestock farms. However, to the best of our knowledge, there has been no comprehensive study evaluating these models specifically for cattle behavior recognition. To fill this gap, we conduct a comparative evaluation of recent YOLO models (v8n-v13n) for cattle behavior detection using a dataset designed to simulate real-world farm environments. The models are evaluated using standard detection metrics such as mean average precision (mAP), precision, recall, inference time, and FPS to determine which variant is best suited for real-time cattle monitoring applications in farming conditions. Rather than proposing a new architecture, this study establishes a systematic and reproducible benchmarking framework for recent YOLO variants in the context of livestock behavior monitoring, addressing a gap in the current literature where their comparative performance remains largely unexplored.
The YOLO family of object detectors has significantly advanced real-time computer vision, especially in applications requiring both speed and accuracy. In cattle behavior recognition, where real-time monitoring of livestock movements is essential, YOLO's balance of these attributes makes it highly effective. This review outlines the evolution of YOLO models, from early versions to the most recent, highlighting key innovations relevant to cattle behavior detection. Each iteration has introduced improvements in detection speed, accuracy, and robustness under farm conditions, making YOLO models increasingly suitable for monitoring cattle in dynamic environments.
The early generations of YOLO (v1-v3) established the foundation of one-stage object detection by unifying classification and localization into a single regression framework. These versions progressively improved inference speed, spatial precision, and multi-scale detection capability, laying the groundwork for applying YOLO in livestock behavior analysis and other real-time agricultural scenarios13,14,15,16. With YOLOv4's release in 2020, the architecture saw further refinements, including the adoption of the Cross Stage Partial (CSP) backbone, Mish activation, and advanced feature aggregation techniques17,18,19. These updates enhanced model performance on smaller datasets, a common scenario in livestock behavior detection due to limited annotated samples for rare events. The community-driven YOLOv5 project, launched by Ultralytics in 2020, gained widespread adoption for its modular design and ease of deployment via a PyTorch framework20. Although not accompanied by a peer-reviewed paper, YOLOv5 became a de facto baseline in real-time cattle detection tasks due to its strong balance between accuracy and deployment flexibility. YOLOv6, released in 2022, prioritized hardware-friendly design with the EfficientRep backbone and Rep-PAN neck21,22. By incorporating anchor-free detection, the model improved robustness in scenarios involving occlusion and partial visibility, conditions frequently encountered in crowded cattle environments. YOLOv7 further optimized computational efficiency through the E-ELAN architecture, enabling faster training and improved performance across multiple detection scales23. Concurrently, alternative models such as YOLOX24 and YOLOR25 advanced detection speed and generalization, both essential attributes for outdoor livestock monitoring systems. The 2023 release of YOLOv8 by Ultralytics introduced several architectural modifications, including anchor-free heads, structural reparameterization, and stronger augmentation strategies. These updates delivered significant gains in both detection precision and inference speed, making YOLOv8 a competitive option for real-time cattle behavior analysis. The evolution continued with the emergence of YOLOv9, YOLOv10, YOLOv11, YOLOv12, and YOLOv13. YOLOv9 integrated multi-task learning to jointly enhance classification, localization, and auxiliary tasks like keypoint detection. YOLOv10 was built upon this foundation by embedding domain adaptation modules and segmentation-aware attention mechanisms. YOLOv11 introduced self-supervised training protocols that reduced dependency on fully labeled data, offering advantages in data-sparse applications like cattle behavior monitoring. YOLOv12 emphasized improved feature fusion and dynamic reparameterization. Finally, YOLOv13 incorporated transformer-based modules and spatio-temporal attention, offering superior performance for high-speed, low-latency detection in complex, real-time agricultural scenarios.
In recent years, YOLO-based deep learning models have become widely used for automated and real-time cattle behavior monitoring because of their efficiency and accuracy. Before the adoption of YOLO-based detectors, several early vision-based systems had demonstrated the feasibility of image-driven livestock monitoring. For instance, Sumi et al. developed a cow monitoring system for calving detection using motion feature analysis26, while Zin et al. proposed a deep learning-based cow identification framework achieving 97% recognition accuracy27. These works established the groundwork for subsequent object detection approaches in precision livestock farming. Several studies have applied different YOLO variants for behavior classification, motion tracking, and posture recognition under varied conditions. For example, Mu et al. proposed an improved lightweight Cattle Behavior Recognition-YOLO28 (CBR-YOLO) model based on YOLOv8, optimized for multi-scene weather adaptation. The model achieved a mean accuracy of 90.2% while significantly reducing parameter count. Tong et al. introduced the YOLO-BoT model29, incorporating attention and transformer-based modules into YOLOv8 for cattle behavior detection and tracking in complex environments, achieving a detection mAP of 91.7% at 31.2 FPS. Hao et al. integrated an Efficient Multi-Scale Attention (EMA) mechanism into YOLOv530 (YOLOv5-EMA), which enhanced the detection performance for cattle body parts (e.g., head, legs), reaching mAP values between 94.8% and 95.5%. Guarnido-Lopez et al.31 evaluated YOLOv8 and YOLOv10 for the recognition of feeding-related behaviors (e.g., chewing, biting, approaching) in Charolais bulls, reporting that YOLOv10 slightly outperformed YOLOv8 in mAP@50, mAP@50-95, precision, and recall, while YOLOv8 exhibited faster convergence and lower overfitting. While YOLOv1 through YOLOv8 have been widely adopted and validated for livestock-related tasks, the applicability of YOLOv9 through YOLOv13 in this domain remains underexplored. To date, there has been no comprehensive evaluation of these newer models for cattle behavior detection, highlighting a critical gap in existing research and motivating further investigation into their real-world performance.
Access restricted. Please log in or start a trial to view this content.
1. Dataset preparation
NOTE: This study did not involve new animal experiments. All data were obtained from the publicly available CBVD-5 dataset, which was collected and released in compliance with institutional animal-care guidelines by its original authors. Therefore, no additional ethical approval was required for this work.
2. Model selection and setup
3. Model training
4. Model evaluation
Access restricted. Please log in or start a trial to view this content.
This section presents the evaluation results of YOLOv8 through YOLOv13 models on the CBVD-5 dataset for multi-behavior cattle recognition. The analysis focuses on detection accuracy, training convergence, behavioral distribution, and deployment suitability in resource-limited environments. Dataset quality and class balance follow the splits described in the protocol (70/20/10), ensuring consistent representation of all five behaviors across training, validation, and test sets. Figure 1 shows...
Access restricted. Please log in or start a trial to view this content.
The overall success of the proposed comparative framework depends critically on several protocol steps, including high-quality behavior annotation, diverse data augmentation, and stable convergence monitoring during training. These factors ensure that model performance differences reflect true architectural variation rather than data or training noise. This study systematically evaluated six lightweight YOLO variants (v8n to v13n) for multi-class cattle behavior detection using the CBVD-5 dataset. Among the models, YOLOv...
Access restricted. Please log in or start a trial to view this content.
The authors declare that they have no competing interests.
This work was funded by a Universiti Sains Malaysia Bridging Grant, Project No: R501-LR-RND003-0000001342-0000.
Access restricted. Please log in or start a trial to view this content.
| Name | Company | Catalog Number | Comments |
|---|---|---|---|
| Dahua DH-NVR2216-HDS3 Recorder | Dahua Technology | https://www.dahuasecurity.com/ | |
| Dahua DH-S3000C-16GT Gigabit Switch | Dahua Technology | https://www.dahuasecurity.com/ | |
| Dahua M/K Surveillance Camera (2.8 mm / 3.6 mm lens) | Dahua Technology | https://www.dahuasecurity.com/ | |
| Google Colab Pro | https://colab.research.google.com/ | ||
| Matplotlib | Matplotlib Community | https://matplotlib.org/ | |
| NVIDIA A100 GPU | NVIDIA | https://www.nvidia.com/en-us/data-center/a100/ | |
| NumPy | NumPy Community | https://numpy.org/ | |
| OpenCV | OpenCV.org | https://opencv.org/ | |
| Optuna (Hyperparameter Optimization) | Optuna.org | https://optuna.org/ | |
| Pandas | Pandas Community | https://pandas.pydata.org/ | |
| PyTorch (v2.0+) | PyTorch Foundation | https://pytorch.org/ | |
| Python (v3.10) | Python Software Foundation | https://www.python.org/ | |
| Roboflow TSL Dataset | Roboflow | https://roboflow.com/ | |
| Ubuntu 20.04 LTS | Canonical | https://ubuntu.com/ | |
| Visual Studio Code | Microsoft | https://code.visualstudio.com/ | |
| YOLOv13 | Ultralytics | https://github.com/ultralytics/YOLOv13 | |
| YOLOv9 | Ultralytics | https://github.com/ultralytics/YOLOv9 |
Access restricted. Please log in or start a trial to view this content.
Request permission to reuse the text or figures of this JoVE article
Request Permission