{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,7,9]],"date-time":"2026-07-09T11:39:54Z","timestamp":1783597194665,"version":"3.55.0"},"reference-count":34,"publisher":"MDPI AG","issue":"14","license":[{"start":{"date-parts":[[2023,7,11]],"date-time":"2023-07-11T00:00:00Z","timestamp":1689033600000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"funder":[{"name":"National Key R&amp;D Program of China","award":["2021YFD200802"],"award-info":[{"award-number":["2021YFD200802"]}]},{"name":"National Key R&amp;D Program of China","award":["2023B10564002"],"award-info":[{"award-number":["2023B10564002"]}]},{"name":"Key technology research and integrated application of smart agriculture","award":["2021YFD200802"],"award-info":[{"award-number":["2021YFD200802"]}]},{"name":"Key technology research and integrated application of smart agriculture","award":["2023B10564002"],"award-info":[{"award-number":["2023B10564002"]}]}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Sensors"],"abstract":"<jats:p>Pig counting is an important task in pig sales and breeding supervision. Currently, manual counting is low-efficiency and high-cost and presents challenges in terms of statistical analysis. In response to the difficulties faced in pig part feature detection, the loss of tracking due to rapid movement, and the large counting deviation in pig video tracking and counting research, this paper proposes an improved pig counting algorithm (Mobile Pig Counting Algorithm with YOLOv5xpig and DeepSORTPig (MPC-YD)) based on YOLOv5 + DeepSORT model. The algorithm improves the detection rate of pig body parts by adding two different sizes of SPP networks and using SoftPool instead of MaxPool operations in YOLOv5x. In addition, the algorithm includes a pig reidentification network, a pig-tracking method based on spatial state correction, and a pig counting method based on frame number judgment on the DeepSORT algorithm to improve pig tracking accuracy. Experimental analysis shows that the MPC-YD algorithm achieves an average precision of 99.24% in pig object detection and an accuracy of 85.32% in multitarget pig tracking. In the aisle environment of the slaughterhouse, the MPC-YD algorithm achieves a correlation coefficient (R2) of 98.14% in pig counting from video, and it achieves stable pig counting in a breeding environment. The algorithm has a wide range of application prospects.<\/jats:p>","DOI":"10.3390\/s23146309","type":"journal-article","created":{"date-parts":[[2023,7,12]],"date-time":"2023-07-12T01:05:01Z","timestamp":1689123901000},"page":"6309","update-policy":"https:\/\/doi.org\/10.3390\/mdpi_crossmark_policy","source":"Crossref","is-referenced-by-count":25,"title":["An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model"],"prefix":"10.3390","volume":"23","author":[{"given":"Yigui","family":"Huang","sequence":"first","affiliation":[{"name":"College of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, China"},{"name":"Key Laboratory of Smart Agricultural Technology in Tropical South China, Ministry of Agriculture and Rural Affairs, Guangzhou 510642, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Deqin","family":"Xiao","sequence":"additional","affiliation":[{"name":"College of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, China"},{"name":"Key Laboratory of Smart Agricultural Technology in Tropical South China, Ministry of Agriculture and Rural Affairs, Guangzhou 510642, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Junbin","family":"Liu","sequence":"additional","affiliation":[{"name":"College of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, China"},{"name":"Key Laboratory of Smart Agricultural Technology in Tropical South China, Ministry of Agriculture and Rural Affairs, Guangzhou 510642, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Zhujie","family":"Tan","sequence":"additional","affiliation":[{"name":"College of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, China"},{"name":"Key Laboratory of Smart Agricultural Technology in Tropical South China, Ministry of Agriculture and Rural Affairs, Guangzhou 510642, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Kejian","family":"Liu","sequence":"additional","affiliation":[{"name":"College of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, China"},{"name":"Key Laboratory of Smart Agricultural Technology in Tropical South China, Ministry of Agriculture and Rural Affairs, Guangzhou 510642, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Miaobin","family":"Chen","sequence":"additional","affiliation":[{"name":"College of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, China"},{"name":"Key Laboratory of Smart Agricultural Technology in Tropical South China, Ministry of Agriculture and Rural Affairs, Guangzhou 510642, China"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"1968","published-online":{"date-parts":[[2023,7,11]]},"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":"Girshick, R., Donahue, J., Darrell, T., and Malik, J. (2013, January 23\u201328). Rich Feature Hierarchies for Accurate Object Detection and Semantic Segmentation. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Portland, OR, USA.","DOI":"10.1109\/CVPR.2014.81"},{"key":"ref_3","doi-asserted-by":"crossref","unstructured":"Redmon, J., Divvala, S., Girshick, R., and Farhadi, A. (2016). You Only Look Once: Unified, Real-Time Object Detection. Computer Vision & Pattern Recognition. arXiv.","DOI":"10.1109\/CVPR.2016.91"},{"key":"ref_4","doi-asserted-by":"crossref","first-page":"1137","DOI":"10.1109\/TPAMI.2016.2577031","article-title":"Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks","volume":"39","author":"Ren","year":"2017","journal-title":"IEEE Trans. Pattern Anal. Mach. Intell."},{"key":"ref_5","doi-asserted-by":"crossref","first-page":"386","DOI":"10.1109\/TPAMI.2018.2844175","article-title":"Mask R-CNN","volume":"42","author":"He","year":"2017","journal-title":"IEEE Trans. Pattern Anal. Mach. Intell."},{"key":"ref_6","doi-asserted-by":"crossref","unstructured":"Huang, Z., Huang, L., Gong, Y., Huang, C., and Wang, X. (2019). Mask Scoring R-CNN. arXiv.","DOI":"10.1109\/CVPR.2019.00657"},{"key":"ref_7","unstructured":"Qi, L., Zhang, X., Chen, Y., Chen, Y., and Jia, J. (2020). PointINS: Point-based Instance Segmentation. arXiv."},{"key":"ref_8","doi-asserted-by":"crossref","unstructured":"Bewley, A., Ge, Z., Ott, L., Ramos, F., and Upcroft, B. (2016). Simple Online and Realtime Tracking. arXiv.","DOI":"10.1109\/ICIP.2016.7533003"},{"key":"ref_9","doi-asserted-by":"crossref","unstructured":"Kim, C., Li, F., Ciptadi, A., and Rehg, J.M. (2015, January 7\u201313). Multiple Hypothesis Tracking Revisited. Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV), Santiago, Chile.","DOI":"10.1109\/ICCV.2015.533"},{"key":"ref_10","doi-asserted-by":"crossref","unstructured":"Wojke, N., Bewley, A., and Paulus, D. (2017). Simple Online and Realtime Tracking with a Deep Association Metric. arXiv.","DOI":"10.1109\/ICIP.2017.8296962"},{"key":"ref_11","doi-asserted-by":"crossref","unstructured":"Li, G., Huang, Y., Chen, Z., Chesser, G.D., Purswell, J.L., Linhoss, J., and Zhao, Y. (2021). Practices and Applications of Convolutional Neural Network-Based Computer Vision Systems in Animal Farming: A Review. Sensors, 21.","DOI":"10.3390\/s21041492"},{"key":"ref_12","doi-asserted-by":"crossref","unstructured":"Li, G., Shi, G., and Jiao, J. (2023). YOLOv5-KCB: A New Method for Individual Pig Detection Using Optimized K-Means, CA Attention Mechanism and a Bi-Directional Feature Pyramid Network. Sensors, 23.","DOI":"10.3390\/s23115242"},{"key":"ref_13","doi-asserted-by":"crossref","first-page":"106518","DOI":"10.1016\/j.compag.2021.106518","article-title":"CRA-Net: A channel recalibration feature pyramid network for detecting small pests","volume":"191","author":"Dong","year":"2021","journal-title":"Comput. Electron. Agric."},{"key":"ref_14","doi-asserted-by":"crossref","unstructured":"Li, D., Chen, Y., Zhang, K., and Li, Z. (2019). Mounting Behaviour Recognition for Pigs Based on Deep Learning. Sensors, 19.","DOI":"10.3390\/s19224924"},{"key":"ref_15","doi-asserted-by":"crossref","unstructured":"Tu, S., Yuan, W., Liang, Y., Wang, F., and Wan, H. (2021). Automatic Detection and Segmentation for Group-Housed Pigs Based on PigMS R-CNN. Sensors, 21.","DOI":"10.3390\/s21093251"},{"key":"ref_16","doi-asserted-by":"crossref","unstructured":"Zhou, H., Li, Q., and Xie, Q. (2023). Individual Pig Identification Using Back Surface Point Clouds in 3D Vision. Sensors, 23.","DOI":"10.3390\/s23115156"},{"key":"ref_17","doi-asserted-by":"crossref","first-page":"100113","DOI":"10.1016\/j.atech.2022.100113","article-title":"Optimal estimation of broiler movement for commercial tracking","volume":"3","author":"Brunet","year":"2023","journal-title":"Smart Agric. Technol."},{"key":"ref_18","doi-asserted-by":"crossref","first-page":"104615","DOI":"10.1016\/j.engappai.2021.104615","article-title":"A novel vision-based weakly supervised framework for autonomous yield estimation in agricultural applications","volume":"109","author":"Bellocchio","year":"2022","journal-title":"Eng. Appl. Artif. Intell."},{"key":"ref_19","doi-asserted-by":"crossref","first-page":"105449","DOI":"10.1016\/j.engappai.2022.105449","article-title":"A benchmark for multi-class object counting and size estimation using deep convolutional neural networks","volume":"116","author":"Liu","year":"2022","journal-title":"Eng. Appl. Artif. Intell."},{"key":"ref_20","doi-asserted-by":"crossref","first-page":"105200","DOI":"10.1016\/j.compag.2019.105200","article-title":"A method for counting and classifying aphids using computer vision","volume":"169","author":"Lins","year":"2020","journal-title":"Comput. Electron. Agric."},{"key":"ref_21","doi-asserted-by":"crossref","first-page":"182","DOI":"10.1016\/j.biosystemseng.2021.11.014","article-title":"A backlight and deep learning based method for calculating the number of seeds per silique","volume":"213","author":"Zhao","year":"2022","journal-title":"Biosyst. Eng."},{"key":"ref_22","doi-asserted-by":"crossref","first-page":"107000","DOI":"10.1016\/j.compag.2022.107000","article-title":"A novel apple fruit detection and counting methodology based on deep learning and trunk tracking in modern orchard","volume":"197","author":"Gao","year":"2022","journal-title":"Comput. Electron. Agric."},{"key":"ref_23","doi-asserted-by":"crossref","first-page":"59","DOI":"10.1016\/j.engappai.2018.09.011","article-title":"MangoNet: A deep semantic segmentation architecture for a method to detect and count mangoes in an open orchard","volume":"77","author":"Kestur","year":"2019","journal-title":"Eng. Appl. Artif. Intell."},{"key":"ref_24","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_25","doi-asserted-by":"crossref","first-page":"81","DOI":"10.1016\/j.biosystemseng.2016.08.018","article-title":"Automatic estimation of number of piglets in a pen during farrowing, using image analysis","volume":"151","author":"Oczak","year":"2016","journal-title":"Biosyst. Eng."},{"key":"ref_26","doi-asserted-by":"crossref","first-page":"106417","DOI":"10.1016\/j.compag.2021.106417","article-title":"Center clustering network improves piglet counting under occlusion","volume":"189","author":"Huang","year":"2021","journal-title":"Comput. Electron. Agric."},{"key":"ref_27","doi-asserted-by":"crossref","first-page":"106296","DOI":"10.1016\/j.compag.2021.106296","article-title":"Automatic counting and positioning of slaughter pigs within the pen using a convolutional neural network and video images","volume":"188","author":"Jensen","year":"2021","journal-title":"Comput. Electron. Agric."},{"key":"ref_28","doi-asserted-by":"crossref","unstructured":"Chen, G., Shen, S., Wen, L., Luo, S., and Bo, L. (2020). Efficient Pig Counting in Crowds with Keypoints Tracking and Spatial-aware Temporal Response Filtering. arXiv.","DOI":"10.1109\/ICRA40945.2020.9197211"},{"key":"ref_29","doi-asserted-by":"crossref","first-page":"1059217","DOI":"10.3389\/fenvs.2023.1059217","article-title":"Dynamic identification and automatic counting of the number of passing fish species based on the improved DeepSORT algorithm","volume":"11","author":"Wu","year":"2023","journal-title":"Front. Environ. Sci."},{"key":"ref_30","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_31","doi-asserted-by":"crossref","unstructured":"Chen, X., Pu, H., He, Y., Lai, M., Zhang, D., Chen, J., and Pu, H. (2023). An Efficient Method for Monitoring Birds Based on Object Detection and Multi-Object Tracking Networks. Animals, 13.","DOI":"10.3390\/ani13101713"},{"key":"ref_32","doi-asserted-by":"crossref","unstructured":"Wojke, N., and Bewley, A. (2018, January 12\u201315). Deep Cosine Metric Learning for Person Re-identification. Proceedings of the 2018 IEEE Winter Conference on Applications of Computer Vision (WACV), Lake Tahoe, NV, USA.","DOI":"10.1109\/WACV.2018.00087"},{"key":"ref_33","doi-asserted-by":"crossref","first-page":"1904","DOI":"10.1109\/TPAMI.2015.2389824","article-title":"Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition","volume":"37","author":"He","year":"2015","journal-title":"IEEE Trans. Pattern Anal. Mach. Intell."},{"key":"ref_34","doi-asserted-by":"crossref","unstructured":"Stergiou, A., Poppe, R., and Kalliatakis, G. (2021, January 10\u201317). Refining activation downsampling with SoftPool. Proceedings of the IEEE\/CVF International Conference on Computer Vision (ICCV), Montreal, QC, Canada.","DOI":"10.1109\/ICCV48922.2021.01019"}],"container-title":["Sensors"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.mdpi.com\/1424-8220\/23\/14\/6309\/pdf","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,10,10]],"date-time":"2025-10-10T20:10:43Z","timestamp":1760127043000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.mdpi.com\/1424-8220\/23\/14\/6309"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2023,7,11]]},"references-count":34,"journal-issue":{"issue":"14","published-online":{"date-parts":[[2023,7]]}},"alternative-id":["s23146309"],"URL":"https:\/\/doi.org\/10.3390\/s23146309","relation":{},"ISSN":["1424-8220"],"issn-type":[{"value":"1424-8220","type":"electronic"}],"subject":[],"published":{"date-parts":[[2023,7,11]]}}}