Method Article

Benchmarking YOLOv8-v13 Architectures for Intelligent Real-Time Cattle Monitoring and Data-Driven Farm Management in Precision Livestock Farming

DOI:

10.3791/69490

⸱

November 14th, 2025

In This Article

Summary

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

This protocol benchmarks six YOLO models for real-time cattle behavior detection to support welfare and farm management optimization.

Abstract

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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.

Introduction

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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.

Protocol

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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.

  1. The dataset comprises continuous surveillance recordings captured by seven Dahua cameras (2.8 mm and 3.6 mm lenses, model M/K) connected through gigabit switches and network video recorders, covering 5 days of uninterrupted observation under standard barn lighting conditions.
  2. Extract representative frames to obtain 25,000 annotated keyframes, ensuring temporal diversity across behavior types. Annotate five behavior classes, standing, lying, foraging, drinking, and rumination, using VGG Image Annotator (VIA v3.0.11) following the AVA bounding-box format. Create a unified VIA project using the label schema {standing, lying, foraging, drinking, rumination}. Then export the annotations as JSON files and convert them to YOLO-compatible TXT format using Roboflow (set normalization = True and one class per line in the project settings).
  3. Resize all images to 640 Ă— 640 pixels and apply auto-orientation.
  4. Perform data augmentation in Roboflow, applying random horizontal flips (p = 0.5), rotations within ±10, and brightness/contrast variation within ±15% to enhance model generalization.
  5. Split the dataset into training, validation, and test subsets in a 70/20/10 ratio (2049/585/293 images).

2. Model selection and setup

  1. Select six lightweight YOLO architectures: YOLOv8n, YOLOv9t, YOLOv10n, YOLOv11n, YOLOv12n, and YOLOv13n.
  2. Record model specifications, including total number of layers, parameter count, and GFLOPs to compare computational requirements, as summarized in Table 1.
  3. The computing environment and hardware-software specifications used in this study are listed in the Table of Materials. Deterministic random seeds were fixed to 0, 42, 1337 for reproducibility.
  4. Initialize each model with official pretrained weights (e.g., yolov10n.pt, yolov13n.pt).

3. Model training

  1. Train all YOLO models under identical experimental settings using the Ultralytics YOLO (v8.3.63) framework.
  2. Fix the input resolution at 640 Ă— 640 pixels, with batch size = 128 and an initial learning rate of 0.01 (SGD optimizer, cosine scheduler).
  3. Representative training command for each model (example: YOLOv8n):
    results = model.train(
    data=f'{dataset.location}/data.yaml',
    epochs=800,
    patience=30,
    batch=128,
    imgsz=640,
    name='yolov8n_test_800_epoch',
    save_period=100,
    pretrained=True,
    amp=True,
    workers=16,
    seed=1337
    )
  4. Apply early stopping when the internal validation fitness metric (weighted composite of precision, recall, and mAP@50-95) plateaued for 30 consecutive epochs.
  5. Select the best checkpoint for each run based on the highest validation mAP@50-95, and average the final values across three seeds (0, 42, 1337) to ensure reproducibility.
  6. Exclude larger variants (e.g., YOLOv10m, YOLOv11l) due to high resource demands, to ensure feasibility on edge devices32.

4. Model evaluation

  1. Model performance was evaluated using the Ultralytics built-in validation function:
    metrics = model.val(data=f'{dataset.location}/data.yaml', split='test')
  2. Calculate mAP@50 and mAP@50-95.
  3. Generate confusion matrices to examine class-wise performance.
  4. Efficiency-related metrics, including latency (ms/frame), FPS, model size (MB), and training duration, were logged automatically. Here, FPS was calculated as the reciprocal of the total per-frame execution time, which included preprocessing, model inference, and postprocessing stages.

Access restricted. Please log in or start a trial to view this content.

Results

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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.

Discussion

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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.

Disclosures

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The authors declare that they have no competing interests.

Acknowledgements

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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.

Materials

List of materials used in this article
NameCompanyCatalog NumberComments
Dahua DH-NVR2216-HDS3 RecorderDahua Technologyhttps://www.dahuasecurity.com/
Dahua DH-S3000C-16GT Gigabit SwitchDahua Technologyhttps://www.dahuasecurity.com/
Dahua M/K Surveillance Camera (2.8 mm / 3.6 mm lens)Dahua Technologyhttps://www.dahuasecurity.com/
Google Colab ProGooglehttps://colab.research.google.com/
MatplotlibMatplotlib Communityhttps://matplotlib.org/
NVIDIA A100 GPUNVIDIAhttps://www.nvidia.com/en-us/data-center/a100/
NumPyNumPy Communityhttps://numpy.org/
OpenCVOpenCV.orghttps://opencv.org/
Optuna (Hyperparameter Optimization)Optuna.orghttps://optuna.org/
PandasPandas Communityhttps://pandas.pydata.org/
PyTorch (v2.0+)PyTorch Foundationhttps://pytorch.org/
Python (v3.10)Python Software Foundationhttps://www.python.org/
Roboflow TSL DatasetRoboflowhttps://roboflow.com/
Ubuntu 20.04 LTSCanonicalhttps://ubuntu.com/
Visual Studio CodeMicrosofthttps://code.visualstudio.com/
YOLOv13Ultralyticshttps://github.com/ultralytics/YOLOv13
YOLOv9Ultralyticshttps://github.com/ultralytics/YOLOv9

References

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,
  1. Li, K., Fan, D., Wu, H., Zhao, A. A new dataset for video-based cow behavior recognition. Sci Rep. 14 (1), 821-830 (2024).
  2. Tran, D. N., et al. Cows' behavior classification using acceleration data: a new, effective, and simple approach. J Comput Sci Cybern. 41 (1), 33-48 (2025).
  3. Bello, R. W., Talib, A., Mohamed, A. S. A. Deep learning-based architectures for recognition of cow using cow nose image pattern. Gazi Univ J Sci. 33 (2), 202-213 (2020).
  4. Ozella, L., et al. A computer vision approach for the automatic detection of social interactions of dairy cows in automatic milking systems. Acta IMEKO. 13 (3), 202-212 (2024).
  5. You only look once: unified, real-time object detection. Redmon, J., Divvala, S., Girshick, R., Farhadi, A. Proc IEEE Conf Comput Vis Pattern Recognit (CVPR), , (2016).
  6. Wang, C. Y., Bochkovskiy, A., Liao, H. Y. YOLOv7: trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. arXiv. , (2022).
  7. Reis, D., Kupec, J., Hong, J., Daoudi, A. Real-time flying object detection with YOLOv8. arXiv. , (2023).
  8. Wang, C. Y., Yeh, I. H., Liao, H. Y. YOLOv9: learning what you want to learn using programmable gradient information. Lect Notes Comput Sci. 14640 (1), 1-21 (2024).
  9. Wang, A., et al. YOLOv10: real-time end-to-end object detection. arXiv. , (2024).
  10. Khanam, R., Hussain, M. YOLOv11: an overview of the key architectural enhancements. arXiv. , (2024).
  11. Ye, Q., Doermann, D. YOLOv12: attention-centric real-time object detectors. arXiv. , (2025).
  12. Lei, M., et al. YOLOv13: real-time object detection with hypergraph-enhanced adaptive visual perception. arXiv. , (2025).
  13. Object detection using YOLO: a survey. Tripathi, P., Gupta, M., Srivastava, C., Dixit, P., Pandey, S. Int Conf Softw Eng Technol (ICSET), 12 (1), 747-752 (2022).
  14. YOLO9000better: better, faster, stronger. Redmon, J., Farhadi, A. Proc IEEE Conf Comput Vis Pattern Recognit (CVPR), , (2017).
  15. Batch normalization: accelerating deep network training by reducing internal covariate shift. Ioffe, S., Szegedy, C. Proc Int Conf Mach Learn (ICML), , (2015).
  16. Redmon, J., Farhadi, A. YOLOv3: an incremental improvement. arXiv. , (2018).
  17. Bochkovskiy, A., Wang, C. Y., Liao, H. Y. YOLOv4: optimal speed and accuracy of object detection. arXiv. , (2020).
  18. Misra, D. Mish: a self-regularized non-monotonic neural activation function. arXiv. , (2019).
  19. Zhang, Z., et al. Bag of freebies for training object detection neural networks. arXiv. , (2019).
  20. Khanam, R., Hussain, M. What is YOLOv5? a deep look into the internal features of the popular object detector. arXiv. , (2024).
  21. Li, C., et al. YOLOv6: a single-stage object detection framework for industrial applications. arXiv. , (2022).
  22. Ding, X., et al. RepVGG: making VGG-style ConvNets great again. arXiv. , (2021).
  23. Jiao, L., Abdullah, M. I. YOLO series algorithms in object detection of unmanned aerial vehicles: a survey. Serv Oriented Comput Appl. 18 (1), 269-298 (2024).
  24. Ge, Z., Liu, S., Wang, F., Li, Z., Sun, J. YOLOX: exceeding YOLO series in 2021. arXiv. , (2021).
  25. Wang, C. Y., Yeh, I. H., Liao, H. Y. You only learn one representation: unified network for multiple tasks. arXiv. , (2021).
  26. A study on cow monitoring system for calving process. Sumi, K., Zin, T. T., Kobayashi, I., Horii, Y. Proc IEEE Glob Conf Consum Electron (GCCE), , (2017).
  27. Image technology-based cow identification system using deep learning. Zin, T. T., Phyo, C. N., Tin, P., Hama, H., Kobayashi, I. Proc Int Multiconf Eng Comput Sci (IMECS), 1, 236-247 (2018).
  28. Mu, Y., et al. Research on the behavior recognition of beef cattle based on the improved lightweight CBR-YOLO model derived from YOLOv8 in multi-scene weather. Animals. 14 (19), 2800(2024).
  29. Tong, L., Fang, J., Wang, X., Zhao, Y. Research on cattle behavior recognition and multi-object tracking algorithm based on YOLO-BoT. Animals. 14 (20), 2993(2024).
  30. Hao, W., et al. Cattle body detection based on YOLOv5-EMA for precision livestock farming. Animals. 13 (23), 3535(2023).
  31. Guarnido, P., Ramirez-Agudelo, J. F., Denimal, E., Benaouda, M. Programming and setting up the object detection algorithm YOLO to determine feeding activities of beef cattle: a comparison between YOLOv8m and YOLOv10m. Animals. 14 (19), 2821(2024).
  32. Liang, S., et al. Edge YOLO: real-time intelligent object detection system based on edge-cloud cooperation in autonomous vehicles. IEEE Trans Intell Transp Syst. 22 (12), 1-16 (2022).
  33. Rey, L., et al. A performance analysis of You Only Look Once models for deployment on constrained computational edge devices in drone applications. Electronics. 14 (3), 638(2025).
  34. Sen, A., Mishra, T., Dash, R. Novel human-machine interface via robust hand gesture recognition system using channel-pruned YOLOv5s model. arXiv. , (2024).
  35. Chen, R., Tian, X. Gesture detection and recognition based on object detection in complex background. Appl Sci. 13 (7), 4480(2023).
  36. Raj, R. R., Turuk, M., Jagdale, J., Anish, M. Performance comparison of different versions of YOLO for Indian sign language captioning in real time of multiple signers. Procedia Comput Sci. , 991-1000 (2025).
  37. Binti Aziz, A., et al. YOLO-V4 based detection of varied hand gestures in heterogeneous settings. Adv Intell Syst Comput. , Springer. Cham. (2024).
  38. Zhuang, H., Xia, Y., Wang, N., Dong, L. High inclusiveness and accuracy motion blur real-time gesture recognition based on YOLOv4 model combined attention mechanism and DeblurGanv2. Appl Sci. 11 (21), 9982(2021).
  39. Li, G., et al. Design and development of a broiler mortality removal robot. Appl Eng Agric. 38 (3), 401-409 (2022).
  40. Hao, H., et al. A dead broiler inspection system for large-scale breeding farms based on deep learning. Agriculture. 12 (8), 1176(2022).
  41. Yang, J., et al. A detection method for dead caged hens based on improved YOLOv7. Comput Electron Agric. 226, 109388(2024).
  42. Bist, R., Subedi, S., Yang, X., Chai, L. Automatic detection of cage-free dead hens with deep learning methods. AgriEngineering. 5 (2), 1020-1038 (2023).

Access restricted. Please log in or start a trial to view this content.

Reprints and Permissions

Request permission to reuse the text or figures of this JoVE article

Request Permission

Tags

YOLO ArchitecturesReal Time Cattle MonitoringPrecision Livestock FarmingCattle Behavior DetectionObject Detection MetricsModel BenchmarkingEdge DeploymentFarm ManagementAnimal WelfareInference Speed

Related Articles