An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model

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

Full description

Bibliographic Details
Main Authors: Yigui Huang, Deqin Xiao, Junbin Liu, Zhujie Tan, Kejian Liu, Miaobin Chen
Format: Article
Language:English
Published: MDPI AG 2023-07-01
Series:Sensors
Subjects:
Online Access:https://www.mdpi.com/1424-8220/23/14/6309
_version_ 1797587515292516352
author Yigui Huang
Deqin Xiao
Junbin Liu
Zhujie Tan
Kejian Liu
Miaobin Chen
author_facet Yigui Huang
Deqin Xiao
Junbin Liu
Zhujie Tan
Kejian Liu
Miaobin Chen
author_sort Yigui Huang
collection DOAJ
description 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 (R<sup>2</sup>) 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.
first_indexed 2024-03-11T00:41:00Z
format Article
id doaj.art-5f9e9c9526f14f8da9510c73b9bb9a02
institution Directory Open Access Journal
issn 1424-8220
language English
last_indexed 2024-03-11T00:41:00Z
publishDate 2023-07-01
publisher MDPI AG
record_format Article
series Sensors
spelling doaj.art-5f9e9c9526f14f8da9510c73b9bb9a022023-11-18T21:15:56ZengMDPI AGSensors1424-82202023-07-012314630910.3390/s23146309An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT ModelYigui Huang0Deqin Xiao1Junbin Liu2Zhujie Tan3Kejian Liu4Miaobin Chen5College of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, ChinaCollege of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, ChinaCollege of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, ChinaCollege of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, ChinaCollege of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, ChinaCollege of Mathematics Informatics, South China Agricultural University, Guangzhou 510642, ChinaPig 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 (R<sup>2</sup>) 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.https://www.mdpi.com/1424-8220/23/14/6309computer visionobject detectionmultiobject trackingpig
spellingShingle Yigui Huang
Deqin Xiao
Junbin Liu
Zhujie Tan
Kejian Liu
Miaobin Chen
An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model
Sensors
computer vision
object detection
multiobject tracking
pig
title An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model
title_full An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model
title_fullStr An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model
title_full_unstemmed An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model
title_short An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model
title_sort improved pig counting algorithm based on yolov5 and deepsort model
topic computer vision
object detection
multiobject tracking
pig
url https://www.mdpi.com/1424-8220/23/14/6309
work_keys_str_mv AT yiguihuang animprovedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT deqinxiao animprovedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT junbinliu animprovedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT zhujietan animprovedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT kejianliu animprovedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT miaobinchen animprovedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT yiguihuang improvedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT deqinxiao improvedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT junbinliu improvedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT zhujietan improvedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT kejianliu improvedpigcountingalgorithmbasedonyolov5anddeepsortmodel
AT miaobinchen improvedpigcountingalgorithmbasedonyolov5anddeepsortmodel