Research on Dynamic Pig Counting Method Based on Improved YOLOv7 Combined with DeepSORT

Author:

Shao Xiaobao1,Liu Chengcheng1,Zhou Zhixuan1,Xue Wenjing1,Zhang Guoye1,Liu Jianyu2,Yan Hongwen1

Affiliation:

1. College of Information Science and Engineering, Shanxi Agricultural University, Jinzhong 030801, China

2. Science & Technology Information and Strategy Research Center of Shanxi, Taiyuan 030024, China

Abstract

A pig inventory is a crucial component of achieving precise and large-scale farming. In complex pigsty environments, due to pigs’ stress reactions and frequent obstructions, it is challenging to count them accurately and automatically. This difficulty contrasts with most current deep learning studies, which rely on overhead views or static images for counting. This research proposes a video-based dynamic counting method, combining YOLOv7 with DeepSORT. By utilizing the YOLOv7 network structure and optimizing the second and third 3 × 3 convolution operations in the head network ELAN-W with PConv, the model reduces the computational demand and improves the inference speed without sacrificing accuracy. To ensure that the network acquires accurate position perception information at oblique angles and extracts rich semantic information, we introduce the coordinate attention (CA) mechanism before the three re-referentialization paths (REPConv) in the head network, enhancing robustness in complex scenarios. Experimental results show that, compared to the original model, the improved model increases the mAP by 3.24, 0.05, and 1.00 percentage points for oblique, overhead, and all pig counting datasets, respectively, while reducing the computational cost by 3.6 GFLOPS. The enhanced YOLOv7 outperforms YOLOv5, YOLOv4, YOLOv3, Faster RCNN, and SSD in target detection with mAP improvements of 2.07, 5.20, 2.16, 7.05, and 19.73 percentage points, respectively. In dynamic counting experiments, the improved YOLOv7 combined with DeepSORT was tested on videos with total pig counts of 144, 201, 285, and 295, yielding errors of -3, -3, -4, and -26, respectively, with an average accuracy of 96.58% and an FPS of 22. This demonstrates the model’s capability of performing the real-time counting of pigs in various scenes, providing valuable data and references for automated pig counting research.

Funder

Innovation and Entrepreneurship Training Project for College Students of Shanxi Province

Doctor Scientific Research Foundation of Shanxi Agricultural University

Publisher

MDPI AG

Reference43 articles.

1. Pork Production in China, Japan and South Korea;Oh;Asian-Australas. J. Anim. Sci.,2011

2. Yao, Y. (2024, April 05). Multi-Measures to Promote the High-Quality Development of the Hog Industry. Available online: http://guoqing.china.com.cn/2024-03/01/content_117030011.htm.

3. Applying image recognition and counting to reserved live pigs statistics;Zhang;Comput. Appl. Softw.,2016

4. Survey for smart farming technologies: Challenges and issues;Idoje;Comput. Electr. Eng.,2021

5. Method for wheat ear counting based on frequency domain decomposition of MSVF-ISCT;Bao;Inf. Process. Agric.,2023

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3