{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,9,15]],"date-time":"2026-09-15T06:44:40Z","timestamp":1789454680288,"version":"build-2803163510"},"reference-count":39,"publisher":"MDPI AG","issue":"9","license":[{"start":{"date-parts":[[2025,4,24]],"date-time":"2025-04-24T00:00:00Z","timestamp":1745452800000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"funder":[{"name":"The Natural Science Foundation of China","award":["No. 52305002"],"award-info":[{"award-number":["No. 52305002"]}]}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Sensors"],"abstract":"<jats:p>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.<\/jats:p>","DOI":"10.3390\/s25092680","type":"journal-article","created":{"date-parts":[[2025,4,24]],"date-time":"2025-04-24T04:04:50Z","timestamp":1745467490000},"page":"2680","update-policy":"https:\/\/doi.org\/10.3390\/mdpi_crossmark_policy","source":"Crossref","is-referenced-by-count":7,"title":["Research on Enhanced Dynamic Pig Counting Based on YOLOv8n and Deep SORT"],"prefix":"10.3390","volume":"25","author":[{"given":"Peng","family":"Shen","sequence":"first","affiliation":[{"name":"North China Institute of Aerospace Engineering, School of Aeronautics and Astronautics, Langfang 065000, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Keyu","family":"Mei","sequence":"additional","affiliation":[{"name":"North China Institute of Aerospace Engineering, School of Aeronautics and Astronautics, Langfang 065000, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Haori","family":"Xue","sequence":"additional","affiliation":[{"name":"North China Institute of Aerospace Engineering, School of Aeronautics and Astronautics, Langfang 065000, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Tenglong","family":"Li","sequence":"additional","affiliation":[{"name":"North China Institute of Aerospace Engineering, School of Aeronautics and Astronautics, Langfang 065000, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-2169-9060","authenticated-orcid":false,"given":"Guoqing","family":"Zhang","sequence":"additional","affiliation":[{"name":"North China Institute of Aerospace Engineering, School of Remote Sensing and Information Engineering, Langfang 065000, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Yongxiang","family":"Zhao","sequence":"additional","affiliation":[{"name":"North China Institute of Aerospace Engineering, School of Remote Sensing and Information Engineering, Langfang 065000, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-8876-4958","authenticated-orcid":false,"given":"Wei","family":"Luo","sequence":"additional","affiliation":[{"name":"North China Institute of Aerospace Engineering, School of Remote Sensing and Information Engineering, Langfang 065000, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Liang","family":"Mao","sequence":"additional","affiliation":[{"name":"Guangdong-Hong Kong-Macao Greater Bay Area Artificial Intelligence Application Technology Research Institute, Shenzhen Polytechnic University, Shenzhen 518055, China"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"1968","published-online":{"date-parts":[[2025,4,24]]},"reference":[{"key":"ref_1","doi-asserted-by":"crossref","first-page":"104840","DOI":"10.1016\/j.compag.2019.05.049","article-title":"Automated pig counting using deep learning","volume":"163","author":"Tian","year":"2019","journal-title":"Comput. Electron. Agric."},{"key":"ref_2","doi-asserted-by":"crossref","unstructured":"Ma, C., Wang, Y., and Ying, G. (2011, January 25\u201327). The pig breeding management system based on RFID and WSN. Proceedings of the 2011 Fourth International Conference on Information and Computing, Phuket, Thailand.","DOI":"10.1109\/ICIC.2011.133"},{"key":"ref_3","doi-asserted-by":"crossref","first-page":"239","DOI":"10.1111\/mam.12046","article-title":"Are unmanned aircraft systems (UAS s) the future of wildlife monitoring? A review of accomplishments and challenges","volume":"45","author":"Linchant","year":"2015","journal-title":"Mammal Rev."},{"key":"ref_4","doi-asserted-by":"crossref","unstructured":"Khan, W., Raj, K., Kumar, T., Roy, A.M., and Luo, B. (2022). Introducing urdu digits dataset with demonstration of an efficient and robust noisy decoder-based pseudo example generator. Symmetry, 14.","DOI":"10.3390\/sym14101976"},{"key":"ref_5","doi-asserted-by":"crossref","first-page":"84","DOI":"10.1109\/MSP.2017.2749125","article-title":"Advanced deep-learning techniques for salient and category-specific object detection: A survey","volume":"35","author":"Han","year":"2018","journal-title":"IEEE Signal Process. Mag."},{"key":"ref_6","doi-asserted-by":"crossref","first-page":"139","DOI":"10.1016\/j.rse.2018.06.028","article-title":"Detecting mammals in UAV images: Best practices to address a substantially imbalanced dataset with deep learning","volume":"216","author":"Kellenberger","year":"2018","journal-title":"Remote Sens. Environ."},{"key":"ref_7","doi-asserted-by":"crossref","first-page":"779","DOI":"10.1111\/2041-210X.13165","article-title":"A comparison of deep learning and citizen science techniques for counting wildlife in aerial survey images","volume":"10","author":"Torney","year":"2019","journal-title":"Methods Ecol. Evol."},{"key":"ref_8","doi-asserted-by":"crossref","unstructured":"Girshick, R. (2015, January 7\u201313). Fast r-cnn. Proceedings of the IEEE International Conference on Computer Vision, Santiago, Chile.","DOI":"10.1109\/ICCV.2015.169"},{"key":"ref_9","unstructured":"Ren, S., He, K., Girshick, R., and Sun, J. (2015, January 7\u201312). Faster r-cnn: Towards real-time object detection with region proposal networks. Proceedings of the 29th Annual Conference on Neural Information Processing Systems, Montreal, QC, Canada."},{"key":"ref_10","doi-asserted-by":"crossref","unstructured":"He, K., Gkioxari, G., Doll\u00e1r, P., and Girshick, R. (2017, January 22\u201329). Mask r-cnn. Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy.","DOI":"10.1109\/ICCV.2017.322"},{"key":"ref_11","doi-asserted-by":"crossref","unstructured":"Liu, W., Anguelov, D., Erhan, D., Szegedy, C., Reed, S., Fu, C.Y., and Berg, A.C. (2016, January 11\u201314). Ssd: Single shot multibox detector. Proceedings of the Computer Vision\u2013ECCV 2016: 14th European Conference, Amsterdam, The Netherlands.","DOI":"10.1007\/978-3-319-46448-0_2"},{"key":"ref_12","doi-asserted-by":"crossref","first-page":"166","DOI":"10.1002\/rse2.234","article-title":"Multispecies detection and identification of African mammals in aerial imagery using convolutional neural networks","volume":"8","author":"Delplanque","year":"2022","journal-title":"Remote Sens. Ecol. Conserv."},{"key":"ref_13","doi-asserted-by":"crossref","first-page":"145","DOI":"10.1016\/j.compind.2018.02.016","article-title":"Towards on-farm pig face recognition using convolutional neural networks","volume":"98","author":"Hansen","year":"2018","journal-title":"Comput. Ind."},{"key":"ref_14","doi-asserted-by":"crossref","unstructured":"Song, S., Liu, T., Wang, H., Hasi, B., Yuan, C., Gao, F., and Shi, H. (2022). Using pruning-based YOLOv3 deep learning algorithm for accurate detection of sheep face. Animals, 12.","DOI":"10.3390\/ani12111465"},{"key":"ref_15","doi-asserted-by":"crossref","unstructured":"Yang, J., and Li, S. (2022, January 17\u201319). Research on lightweight sheep face detection model based on RetinaFace. Proceedings of the 2022 IEEE 10th Joint International Information Technology and Artificial Intelligence Conference (ITAIC), Chongqing, China.","DOI":"10.1109\/ITAIC54216.2022.9836724"},{"key":"ref_16","doi-asserted-by":"crossref","first-page":"1685","DOI":"10.1007\/s42835-021-00701-z","article-title":"Identifying the mating posture of cattle using deep learning-based object detection with networks of various settings","volume":"16","author":"Chae","year":"2021","journal-title":"J. Electr. Eng. Technol."},{"key":"ref_17","first-page":"251","article-title":"Pig Counting Algorithm Based on Improved YOLO v5n","volume":"54","author":"Yang","year":"2023","journal-title":"Trans. Chin. Soc. Agric. Mach."},{"key":"ref_18","doi-asserted-by":"crossref","unstructured":"Hao, W., Zhang, L., Han, M., Zhang, K., Li, F., Yang, G., and Liu, Z. (2023). YOLOv5-SA-FC: A Novel Pig Detection and Counting Method Based on Shuffle Attention and Focal Complete Intersection over Union. Animals, 13.","DOI":"10.3390\/ani13203201"},{"key":"ref_19","unstructured":"Laradji, I., Rodriguez, P., Kalaitzis, F., Vazquez, D., Young, R., Davey, E., and Lacoste, A. (2020). Counting cows: Tracking illegal cattle ranching from high-resolution satellite imagery. arXiv."},{"key":"ref_20","doi-asserted-by":"crossref","first-page":"31","DOI":"10.1080\/01431161.2019.1624858","article-title":"Cattle detection and counting in UAV images based on convolutional neural networks","volume":"41","author":"Shao","year":"2020","journal-title":"Int. J. Remote Sens."},{"key":"ref_21","doi-asserted-by":"crossref","unstructured":"Sarwar, F., Griffin, A., Periasamy, P., Portas, K., and Law, J. (2018, January 27\u201330). Detecting and counting sheep with a convolutional neural network. Proceedings of the International Conference on Advanced Video and Signal Based Surveillance (AVSS), Auckland, New Zealand.","DOI":"10.1109\/AVSS.2018.8639306"},{"key":"ref_22","doi-asserted-by":"crossref","first-page":"105844","DOI":"10.1016\/j.compag.2020.105844","article-title":"Automatic fish counting method using image density grading and local regression","volume":"179","author":"Zhang","year":"2020","journal-title":"Comput. Electron. Agric."},{"key":"ref_23","doi-asserted-by":"crossref","first-page":"1213","DOI":"10.1109\/TMECH.2022.3175377","article-title":"Deep Learning-Based Cow Tail Detection and Tracking for Precision Livestock Farming","volume":"28","author":"Huang","year":"2022","journal-title":"IEEE\/ASME Trans. Mechatron."},{"key":"ref_24","doi-asserted-by":"crossref","first-page":"107696","DOI":"10.1016\/j.compag.2023.107696","article-title":"A sheep dynamic counting scheme based on the fusion between an improved-sparrow-search YOLOv5x-ECA model and few-shot deepsort algorithm","volume":"206","author":"Cao","year":"2023","journal-title":"Comput. Electron. Agric."},{"key":"ref_25","doi-asserted-by":"crossref","first-page":"108049","DOI":"10.1109\/ACCESS.2019.2933060","article-title":"Automated individual pig localisation, tracking and behaviour metric extraction using deep learning","volume":"7","author":"Cowton","year":"2019","journal-title":"IEEE Access"},{"key":"ref_26","doi-asserted-by":"crossref","first-page":"1","DOI":"10.1016\/j.compag.2015.07.003","article-title":"Validity of the Microsoft Kinect sensor for assessment of normal walking patterns in pigs","volume":"117","author":"Stavrakakis","year":"2015","journal-title":"Comput. Electron. Agric."},{"key":"ref_27","doi-asserted-by":"crossref","unstructured":"Kim, J., Suh, Y., Lee, J., Chae, H., Ahn, H., Chung, Y., and Park, D. (2022). EmbeddedPigCount: Pig Counting with Video Object Detection and Tracking on an Embedded Board. Sensors, 22.","DOI":"10.3390\/s22072689"},{"key":"ref_28","doi-asserted-by":"crossref","unstructured":"Chen, G., Shen, S., Wen, L., Luo, S., and Bo, L. (August, January 31). Efficient pig counting in crowds with keypoints tracking and spatial-aware temporal response filtering. Proceedings of the 2020 IEEE International Conference on Robotics and Automation (ICRA), Paris, France.","DOI":"10.1109\/ICRA40945.2020.9197211"},{"key":"ref_29","doi-asserted-by":"crossref","unstructured":"Huang, Y., Xiao, D., Liu, J., Tan, Z., Liu, K., and Chen, M. (2023). An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model. Sensors, 23.","DOI":"10.3390\/s23146309"},{"key":"ref_30","doi-asserted-by":"crossref","unstructured":"Redmon, J., Divvala, S., Girshick, R., and Farhadi, A. (2016, January 27\u201330). You only look once: Unified, real-time object detection. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA.","DOI":"10.1109\/CVPR.2016.91"},{"key":"ref_31","unstructured":"Xu, W., and Wan, Y. (2024). ELA: Efficient Local Attention for Deep Convolutional Neural Networks. arXiv."},{"key":"ref_32","doi-asserted-by":"crossref","unstructured":"Hu, J., Shen, L., and Sun, G. (2018, January 18\u201322). Squeeze-and-excitation networks. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA.","DOI":"10.1109\/CVPR.2018.00745"},{"key":"ref_33","doi-asserted-by":"crossref","unstructured":"Woo, S., Park, J., Lee, J.Y., and Kweon, I.S. (2018, January 8\u201314). Cbam: Convolutional block attention module. Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany.","DOI":"10.1007\/978-3-030-01234-2_1"},{"key":"ref_34","doi-asserted-by":"crossref","first-page":"62","DOI":"10.1007\/s11554-024-01436-6","article-title":"Slim-neck by GSConv: A lightweight-design for real-time detector architectures","volume":"21","author":"Li","year":"2024","journal-title":"J. Real-Time Image Process."},{"key":"ref_35","doi-asserted-by":"crossref","unstructured":"Yousef, R., Khan, S., Gupta, G., Siddiqui, T., Albahlal, B.M., Alajlan, S.A., and Haq, M.A. (2023). U-Net-based models towards optimal MR brain image segmentation. Diagnostics, 13.","DOI":"10.3390\/diagnostics13091624"},{"key":"ref_36","doi-asserted-by":"crossref","unstructured":"Bewley, A., Ge, Z., Ott, L., Ramos, F., and Upcroft, B. (2016, January 25\u201328). Simple online and realtime tracking. Proceedings of the International Conference on Image Processing (ICIP), Phoenix, AZ, USA.","DOI":"10.1109\/ICIP.2016.7533003"},{"key":"ref_37","doi-asserted-by":"crossref","unstructured":"Wojke, N., Bewley, A., and Paulus, D. (2017, January 17\u201320). Simple online and realtime tracking with a deep association metric. Proceedings of the International Conference on Image Processing (ICIP), Beijing, China.","DOI":"10.1109\/ICIP.2017.8296962"},{"key":"ref_38","unstructured":"Gao, Y., Li, K., and Mosalam, K.M. (2018, January 25\u201329). Deep Residual Net with Transfer Learning for Image-based Structural Damage Recognition Deep Residual Network with Transfer Learning. Proceedings of the 11th National Conference on Earthquake Engineering, Los Angeles, CA, USA."},{"key":"ref_39","doi-asserted-by":"crossref","unstructured":"Huang, G., Liu, Z., Laurens, V.D.M., and Weinberger, K.Q. (2017, January 21\u201326). Densely Connected Convolutional Networks. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA.","DOI":"10.1109\/CVPR.2017.243"}],"container-title":["Sensors"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.mdpi.com\/1424-8220\/25\/9\/2680\/pdf","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,10,9]],"date-time":"2025-10-09T17:20:29Z","timestamp":1760030429000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.mdpi.com\/1424-8220\/25\/9\/2680"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,4,24]]},"references-count":39,"journal-issue":{"issue":"9","published-online":{"date-parts":[[2025,5]]}},"alternative-id":["s25092680"],"URL":"https:\/\/doi.org\/10.3390\/s25092680","relation":{},"ISSN":["1424-8220"],"issn-type":[{"value":"1424-8220","type":"electronic"}],"subject":[],"published":{"date-parts":[[2025,4,24]]}}}