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
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