Research on Enhanced Dynamic Pig Counting Based on YOLOv8n and Deep SORT

Pig counting is an essential activity in the administration of pig farming. Currently, manual counting is inefficient, costly, and unsuitable for systematic analysis. However, research on dynamic pig counting encounters challenges, including inadequate detection accuracy stemming from crowding, occl...

Full description

Saved in:
Bibliographic Details
Main Authors: Peng Shen, Keyu Mei, Haori Xue, Tenglong Li, Guoqing Zhang, Yongxiang Zhao, Wei Luo, Liang Mao
Format: Article
Language:English
Published: MDPI AG 2025-04-01
Series:Sensors
Subjects:
Online Access:https://www.mdpi.com/1424-8220/25/9/2680
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1850032053108604928
author Peng Shen
Keyu Mei
Haori Xue
Tenglong Li
Guoqing Zhang
Yongxiang Zhao
Wei Luo
Liang Mao
author_facet Peng Shen
Keyu Mei
Haori Xue
Tenglong Li
Guoqing Zhang
Yongxiang Zhao
Wei Luo
Liang Mao
author_sort Peng Shen
collection DOAJ
description Pig counting is an essential activity in the administration of pig farming. Currently, manual counting is inefficient, costly, and unsuitable for systematic analysis. However, research on dynamic pig counting encounters challenges, including inadequate detection accuracy stemming from crowding, occlusion, deformation, and low-light conditions. Target tracking issues characterized by poor accuracy, frequent identity confusion, and false positive trajectories ultimately lead to diminished accuracy in the final counting outcomes. Given these existing limitations, this paper proposes an enhanced algorithm based on the YOLOv8n+Deep SORT model. The ELA attention mechanism, GSConv, and VoVGSCSP lightweight convolution modules are introduced in YOLOv8n, which improve detection accuracy and speed for pig target recognition. Additionally, Deep SORT is enhanced by integrating the DenseNet feature extraction network and CIoU matching algorithm, improving the accuracy and stability of target tracking. Experimental results indicate that the improved Deep SORT-P pig tracking algorithm attains MOTA and MOTP values of 89.2% and 90.4%, respectively, reflecting improvements of 4.2% and 1.7%, while IDSW is diminished by 25.5%. Finally, counting experiments were performed on videos of pigs traversing the farm passage using both the original and improved algorithms. The improved YOLOv8n-EGV+Deep SORT-P algorithm achieved a counting accuracy of 92.1%, reflecting a 17.5% improvement over the original algorithm. Meanwhile, the improved algorithm presented in this study successfully attained stable dynamic pig counting in practical environments, offering valuable data and references for research on dynamic pig counting.
format Article
id doaj-art-598dd0edca2b4c408625ea4e8b2a57c9
institution DOAJ
issn 1424-8220
language English
publishDate 2025-04-01
publisher MDPI AG
record_format Article
series Sensors
spelling doaj-art-598dd0edca2b4c408625ea4e8b2a57c92025-08-20T02:58:47ZengMDPI AGSensors1424-82202025-04-01259268010.3390/s25092680Research on Enhanced Dynamic Pig Counting Based on YOLOv8n and Deep SORTPeng Shen0Keyu Mei1Haori Xue2Tenglong Li3Guoqing Zhang4Yongxiang Zhao5Wei Luo6Liang Mao7North China Institute of Aerospace Engineering, School of Aeronautics and Astronautics, Langfang 065000, ChinaNorth China Institute of Aerospace Engineering, School of Aeronautics and Astronautics, Langfang 065000, ChinaNorth China Institute of Aerospace Engineering, School of Aeronautics and Astronautics, Langfang 065000, ChinaNorth China Institute of Aerospace Engineering, School of Aeronautics and Astronautics, Langfang 065000, ChinaNorth China Institute of Aerospace Engineering, School of Remote Sensing and Information Engineering, Langfang 065000, ChinaNorth China Institute of Aerospace Engineering, School of Remote Sensing and Information Engineering, Langfang 065000, ChinaNorth China Institute of Aerospace Engineering, School of Remote Sensing and Information Engineering, Langfang 065000, ChinaGuangdong-Hong Kong-Macao Greater Bay Area Artificial Intelligence Application Technology Research Institute, Shenzhen Polytechnic University, Shenzhen 518055, ChinaPig counting is an essential activity in the administration of pig farming. Currently, manual counting is inefficient, costly, and unsuitable for systematic analysis. However, research on dynamic pig counting encounters challenges, including inadequate detection accuracy stemming from crowding, occlusion, deformation, and low-light conditions. Target tracking issues characterized by poor accuracy, frequent identity confusion, and false positive trajectories ultimately lead to diminished accuracy in the final counting outcomes. Given these existing limitations, this paper proposes an enhanced algorithm based on the YOLOv8n+Deep SORT model. The ELA attention mechanism, GSConv, and VoVGSCSP lightweight convolution modules are introduced in YOLOv8n, which improve detection accuracy and speed for pig target recognition. Additionally, Deep SORT is enhanced by integrating the DenseNet feature extraction network and CIoU matching algorithm, improving the accuracy and stability of target tracking. Experimental results indicate that the improved Deep SORT-P pig tracking algorithm attains MOTA and MOTP values of 89.2% and 90.4%, respectively, reflecting improvements of 4.2% and 1.7%, while IDSW is diminished by 25.5%. Finally, counting experiments were performed on videos of pigs traversing the farm passage using both the original and improved algorithms. The improved YOLOv8n-EGV+Deep SORT-P algorithm achieved a counting accuracy of 92.1%, reflecting a 17.5% improvement over the original algorithm. Meanwhile, the improved algorithm presented in this study successfully attained stable dynamic pig counting in practical environments, offering valuable data and references for research on dynamic pig counting.https://www.mdpi.com/1424-8220/25/9/2680pig countingobject detectionmulti-object trackingYOLOv8nDeep SORT
spellingShingle Peng Shen
Keyu Mei
Haori Xue
Tenglong Li
Guoqing Zhang
Yongxiang Zhao
Wei Luo
Liang Mao
Research on Enhanced Dynamic Pig Counting Based on YOLOv8n and Deep SORT
Sensors
pig counting
object detection
multi-object tracking
YOLOv8n
Deep SORT
title Research on Enhanced Dynamic Pig Counting Based on YOLOv8n and Deep SORT
title_full Research on Enhanced Dynamic Pig Counting Based on YOLOv8n and Deep SORT
title_fullStr Research on Enhanced Dynamic Pig Counting Based on YOLOv8n and Deep SORT
title_full_unstemmed Research on Enhanced Dynamic Pig Counting Based on YOLOv8n and Deep SORT
title_short Research on Enhanced Dynamic Pig Counting Based on YOLOv8n and Deep SORT
title_sort research on enhanced dynamic pig counting based on yolov8n and deep sort
topic pig counting
object detection
multi-object tracking
YOLOv8n
Deep SORT
url https://www.mdpi.com/1424-8220/25/9/2680
work_keys_str_mv AT pengshen researchonenhanceddynamicpigcountingbasedonyolov8nanddeepsort
AT keyumei researchonenhanceddynamicpigcountingbasedonyolov8nanddeepsort
AT haorixue researchonenhanceddynamicpigcountingbasedonyolov8nanddeepsort
AT tenglongli researchonenhanceddynamicpigcountingbasedonyolov8nanddeepsort
AT guoqingzhang researchonenhanceddynamicpigcountingbasedonyolov8nanddeepsort
AT yongxiangzhao researchonenhanceddynamicpigcountingbasedonyolov8nanddeepsort
AT weiluo researchonenhanceddynamicpigcountingbasedonyolov8nanddeepsort
AT liangmao researchonenhanceddynamicpigcountingbasedonyolov8nanddeepsort