基于SWT-YOLOv5s的复杂环境牛只检测方法

  • 方一昊 ,
  • 沈雷 ,
  • 蓝雷斌 ,
  • 黄安祥
展开
  • 杭州电子科技大学通信工程学院, 浙江 杭州 310018
方一昊(1999-),男,硕士研究生,研究方向:计算机视觉,E-mail:635389515@qq.com。
沈雷(1979-),男,教授,研究方向:数字图像处理、模式识别,E-mail:shenlei@hdu.edu.cn。

收稿日期: 2023-05-04

  网络出版日期: 2025-03-21

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

摘要

复杂环境牛只目标检测是基于机器视觉的牛只数量精准盘点的关键问题,受牛只拥挤导致的遮挡以及牛只处于摄像头边缘位置导致的牛只个体不完整等因素的影响,现有的牛只目标检测方法无法适用于养殖场复杂环境。本文提出一种基于Swin-Transformer(SWT)-YOLOV5s网络的复杂环境牛只检测算法:首先提出双层shortcut(SC)-SWT与多层卷积级联的牛只特征提取骨干网络SWT-Backbone,利用SC-SWT模块关注全局特征的特点,结合关注局部特征的含残差多层卷积模块增加网络的深度和感受野,使模型充分提取牛只的全局特征与局部特征。然后提出not shortcut(NSC)-SWT与金字塔网络级联的特征融合目标检测头SWT-Head,通过金字塔网络构建SWT-Backbone骨干网络所提取的全局特征与局部特征多尺度融合的特征金字塔,结合NSC-SWT模块Transformer的全局感受野和C3模块的CNN局部感受野,使模型更准确地检测筛选特征金字塔中高语义层次的牛只全局特征及表征牛只细节的局部特征,同时高效去除背景环境的特征干扰,提升了复杂环境下牛只目标的检测精度。采用实验室采集的COWYCTC-1480数据集进行实验,与本文方法在测试集上的精确率、召回率和mAP分别高出YOLOV5s算法7%、2%、11.1%,高出SSD算法20.8%、32%、29.3%。

本文引用格式

方一昊 , 沈雷 , 蓝雷斌 , 黄安祥 . 基于SWT-YOLOv5s的复杂环境牛只检测方法[J]. 杭州电子科技大学学报, 2025 , 45(1) : 1 -10 . DOI: 10.13954/j.cnki.hdu.2025.01.001

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.

参考文献

[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.
文章导航

/

〈 〉