A method for detecting cattle in complex environments based on SWT-YOLOv5s

  • FANG Yihao ,
  • SHEN Lei ,
  • LAN Leibin ,
  • HUANG Anxiang
Expand
  • School of Communication Engineering, Hangzhou Dianzi University, Hangzhou Zhejiang 310018, China

Received date: 2023-05-04

  Online published: 2025-03-21

Abstract

The detection of cattle targets in complex environments is a key issue in precise counting of cattle numbers based on machine vision. Due to factors such as occlusion caused by overcrowding of cattle and incomplete cattle individuals caused by their position at the edge of the camera, existing cattle target detection methods are not suitable for complex environments in breeding farms. This paper proposes a cattle detection algorithm in complex environments based on Swin-Transformer(SWT)-YOLOV5s network: first, we propose a backbone network SWT Backbone for cattle feature extraction, which is cascaded by double-layer shortcut(SC)-SWT and multi-layer convolution. Using the characteristics of SC-SWT module that focuses on global features, combined with the residual multi-layer convolution module that focuses on local features, we increase the depth and receptive field of the network, so that the model can fully extract both global and local features of cattle. Then, the feature fusion target detection head SWT Head, which is cascaded by not shortcut(NSC)-SWT and pyramid network, is proposed. Through the pyramid network, the feature pyramid of multi-scale fusion of global features and local features extracted from the SWT Backbone backbone network is constructed. Combined with the global receptive field of the NSC-SWT module Transformer and the CNN local receptive field of the C3 module, it enables the model to more accurately detect and filter the global features of cattle at high semantic levels and local features that represent the details of cattle in the feature pyramid, while efficiently removes feature interference from the background environment, and improves the detection accuracy of cattle targets in complex environments. Simulation experiments were conducted on the COWYCTC-1480 dataset collected in the laboratory. Compared with the widely used YOLOV5s and SSD algorithms, the accuracy, recall, and mAP of our method on the test set were 7.0%, 2.0%, and 11.1% points higher than the YOLOV5s algorithm,20.0%,8.0%,32.0%, and 29.3 points higher than the SSD algorithm, respectively.

Cite this article

FANG Yihao , SHEN Lei , LAN Leibin , HUANG Anxiang . A method for detecting cattle in complex environments based on SWT-YOLOv5s[J]. Journal of Hangzhou Dianzi University, 2025 , 45(1) : 1 -10 . DOI: 10.13954/j.cnki.hdu.2025.01.001

References

[1] GUO X, ZHANG S H, YANG H, et al. Bovine TMEM95 gene: Polymorphisms detecting in five Chinese indigenous cattle breeds and their association with growth traits[J]. Electronic Journal of Biotechnology, 2021,51:58-66.
[2] 黄文雨.基于数据畜牧的奶牛精细化养殖管理系统的研究与设计[J].宜春学院学报, 2017,39(3):46-49.
[3] 舒宝盛.基于精准畜牧业的高效智能发展探析[J].机电信息, 2019(26):145-146.
[4] 刘忠超,翟天嵩,何东健.精准养殖中奶牛个体信息监测研究现状及进展[J].黑龙江畜牧兽医, 2019(13):30-33,38.
[5] ZHAO K X, HE D J. Target detection method for moving cows based on background subtraction[J]. International Journal of Agricultural & Biological Engineering, 2015,8(1):42-49.
[6] 秦立峰,张晓茜,董明星,等.基于多特征融合相关滤波的运动奶牛目标提取[J].农业机械学报, 2021,52(11):244-252.
[7] 王红君,施楠,赵辉,等.基于视觉定位的牧场奶牛自动跟踪定位系统研究[J].黑龙江畜牧兽医, 2015(21):43-47.
[8] 邢永鑫,孙游东,王天一.基于改进SSD算法对奶牛的个体识别[J].计算机工程与应用, 2022,58(2):208-214.
[9] 李琦.基于深度学习的牛群目标检测算法及其轻量化研究[D].杭州:杭州电子科技大学, 2022.
[10] 张宏鸣,汪润,董佩杰,等.基于DeepSORT算法的肉牛多目标跟踪方法[J].农业机械学报, 2021,52(4):248-256.
[11] VASWANI A, SHAZEER N, PARMAR N, et al. Attention is all you need[C].//Proceedings of the 31st International Conference on Neural Information Processing Systems. Long Beach, California, USA: Curran Associates Inc., 2017: 6000-6010.
[12] LIU Z, LIN Y, CAO Y, et al. Swin transformer: hierarchical vision transformer using shifted windows[C].//Proceedings of the IEEE International Conference on Computer Vision. Washington D.C., USA. IEEE, 2021:10012-10022.
[13] JOCHER G. YOLOv5 by Ultralytics (Version 7.0)[CP].[2023-05-04].https://doi.org/10.5281/zenodo.3908559.
[14] LIU W,ANGUELOV D, ERHAN D, et al. SSD: single shot multibox detector[J].Computer Vision-ECCV 2016. Lecture Notes in Computer Science, Part I, vol 9905. Cham: Springer, 2016:21-37.
Outlines

/

〈 〉