A Study on Multi-Scale Behavior Recognition of Dairy Cows in Complex Background Based on Improved YOLOv5

The daily behaviors of dairy cows, including standing, drinking, eating, and lying down, are closely associated with their physical health. Efficient and accurate recognition of dairy cow behaviors is crucial for timely monitoring of their health status and enhancing the economic efficiency of farms...

Full description

Saved in:
Bibliographic Details
Main Authors: Zheying Zong, Zeyu Ban, Chunguang Wang, Shuai Wang, Wenbo Yuan, Chunhui Zhang, Lide Su, Ze Yuan
Format: Article
Language:English
Published: MDPI AG 2025-01-01
Series:Agriculture
Subjects:
Online Access:https://www.mdpi.com/2077-0472/15/2/213
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1832589490485460992
author Zheying Zong
Zeyu Ban
Chunguang Wang
Shuai Wang
Wenbo Yuan
Chunhui Zhang
Lide Su
Ze Yuan
author_facet Zheying Zong
Zeyu Ban
Chunguang Wang
Shuai Wang
Wenbo Yuan
Chunhui Zhang
Lide Su
Ze Yuan
author_sort Zheying Zong
collection DOAJ
description The daily behaviors of dairy cows, including standing, drinking, eating, and lying down, are closely associated with their physical health. Efficient and accurate recognition of dairy cow behaviors is crucial for timely monitoring of their health status and enhancing the economic efficiency of farms. To address the challenges posed by complex scenarios and significant variations in target scales in dairy cow behavior recognition within group farming environments, this study proposes an enhanced recognition method based on YOLOv5. Four Shuffle Attention (SA) modules are integrated into the upsampling and downsampling processes of the YOLOv5 model’s neck network to enhance deep feature extraction of small-scale cow targets and focus on feature information, while maintaining network complexity and real-time performance. The C3 module of the model was enhanced by incorporating Deformable convolution (DCNv3), which improves the accuracy of cow behavior characteristic identification. Finally, the original detection head was replaced with a Dynamic Detection Head (DyHead) to improve the efficiency and accuracy of cow behavior detection across different scales in complex environments. An experimental dataset comprising complex backgrounds, multiple behavior categories, and multi-scale targets was constructed for comprehensive validation. The experimental results demonstrate that the improved YOLOv5 model achieved a mean Average Precision (mAP) of 97.7%, representing a 3.7% improvement over the original YOLOv5 model. Moreover, it outperformed comparison models, including YOLOv4, YOLOv3, and Faster R-CNN, in complex background scenarios, multi-scale behavior detection, and behavior type discrimination. Ablation experiments further validate the effectiveness of the SA, DCNv3, and DyHead modules. The research findings offer a valuable reference for real-time monitoring of cow behavior in complex environments throughout the day.
format Article
id doaj-art-a77cbca514564726a70007311ce5ddd2
institution Kabale University
issn 2077-0472
language English
publishDate 2025-01-01
publisher MDPI AG
record_format Article
series Agriculture
spelling doaj-art-a77cbca514564726a70007311ce5ddd22025-01-24T13:16:09ZengMDPI AGAgriculture2077-04722025-01-0115221310.3390/agriculture15020213A Study on Multi-Scale Behavior Recognition of Dairy Cows in Complex Background Based on Improved YOLOv5Zheying Zong0Zeyu Ban1Chunguang Wang2Shuai Wang3Wenbo Yuan4Chunhui Zhang5Lide Su6Ze Yuan7College of Electromechanical Engineering, Inner Mongolia Agricultural University, Hohhot 010018, ChinaCollege of Electromechanical Engineering, Inner Mongolia Agricultural University, Hohhot 010018, ChinaCollege of Electromechanical Engineering, Inner Mongolia Agricultural University, Hohhot 010018, ChinaCollege of Electromechanical Engineering, Inner Mongolia Agricultural University, Hohhot 010018, ChinaCollege of Electromechanical Engineering, Inner Mongolia Agricultural University, Hohhot 010018, ChinaCollege of Electromechanical Engineering, Inner Mongolia Agricultural University, Hohhot 010018, ChinaCollege of Electromechanical Engineering, Inner Mongolia Agricultural University, Hohhot 010018, ChinaCollege of Electromechanical Engineering, Inner Mongolia Agricultural University, Hohhot 010018, ChinaThe daily behaviors of dairy cows, including standing, drinking, eating, and lying down, are closely associated with their physical health. Efficient and accurate recognition of dairy cow behaviors is crucial for timely monitoring of their health status and enhancing the economic efficiency of farms. To address the challenges posed by complex scenarios and significant variations in target scales in dairy cow behavior recognition within group farming environments, this study proposes an enhanced recognition method based on YOLOv5. Four Shuffle Attention (SA) modules are integrated into the upsampling and downsampling processes of the YOLOv5 model’s neck network to enhance deep feature extraction of small-scale cow targets and focus on feature information, while maintaining network complexity and real-time performance. The C3 module of the model was enhanced by incorporating Deformable convolution (DCNv3), which improves the accuracy of cow behavior characteristic identification. Finally, the original detection head was replaced with a Dynamic Detection Head (DyHead) to improve the efficiency and accuracy of cow behavior detection across different scales in complex environments. An experimental dataset comprising complex backgrounds, multiple behavior categories, and multi-scale targets was constructed for comprehensive validation. The experimental results demonstrate that the improved YOLOv5 model achieved a mean Average Precision (mAP) of 97.7%, representing a 3.7% improvement over the original YOLOv5 model. Moreover, it outperformed comparison models, including YOLOv4, YOLOv3, and Faster R-CNN, in complex background scenarios, multi-scale behavior detection, and behavior type discrimination. Ablation experiments further validate the effectiveness of the SA, DCNv3, and DyHead modules. The research findings offer a valuable reference for real-time monitoring of cow behavior in complex environments throughout the day.https://www.mdpi.com/2077-0472/15/2/213dairy cowbehavior recognitionimproved YOLOv5Shuffle Attentiondeformable convolutionDynamic Detection Head
spellingShingle Zheying Zong
Zeyu Ban
Chunguang Wang
Shuai Wang
Wenbo Yuan
Chunhui Zhang
Lide Su
Ze Yuan
A Study on Multi-Scale Behavior Recognition of Dairy Cows in Complex Background Based on Improved YOLOv5
Agriculture
dairy cow
behavior recognition
improved YOLOv5
Shuffle Attention
deformable convolution
Dynamic Detection Head
title A Study on Multi-Scale Behavior Recognition of Dairy Cows in Complex Background Based on Improved YOLOv5
title_full A Study on Multi-Scale Behavior Recognition of Dairy Cows in Complex Background Based on Improved YOLOv5
title_fullStr A Study on Multi-Scale Behavior Recognition of Dairy Cows in Complex Background Based on Improved YOLOv5
title_full_unstemmed A Study on Multi-Scale Behavior Recognition of Dairy Cows in Complex Background Based on Improved YOLOv5
title_short A Study on Multi-Scale Behavior Recognition of Dairy Cows in Complex Background Based on Improved YOLOv5
title_sort study on multi scale behavior recognition of dairy cows in complex background based on improved yolov5
topic dairy cow
behavior recognition
improved YOLOv5
Shuffle Attention
deformable convolution
Dynamic Detection Head
url https://www.mdpi.com/2077-0472/15/2/213
work_keys_str_mv AT zheyingzong astudyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT zeyuban astudyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT chunguangwang astudyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT shuaiwang astudyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT wenboyuan astudyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT chunhuizhang astudyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT lidesu astudyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT zeyuan astudyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT zheyingzong studyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT zeyuban studyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT chunguangwang studyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT shuaiwang studyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT wenboyuan studyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT chunhuizhang studyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT lidesu studyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5
AT zeyuan studyonmultiscalebehaviorrecognitionofdairycowsincomplexbackgroundbasedonimprovedyolov5