To address the issues of low accuracy, high model complexity, and slow detection speed that existed in current pig posture recognition tasks, a lightweight pig pose recognition method is proposed in this study. This method applies the performance-aware global channel pruning algorithm to the YOLOv5s model, identifies and removes redundant or less contributions to performance in the original model, and performs parameter adjustment compensation optimization on the pruned model. The results indicate that: The YOLOv5s-prune model achieved an average precision value (mAP0.5) of 94.7% at an intersection over union (IoU) threshold of 0.5,and reached an average precision mean (mAP0.5-0.95) of 84.6% with multiple IoU thresholds set at intervals of 0.05 between [0.5, 0.95], which were 0.8% and 0.4% higher compared to the original YOLOv5s model, respectively. Furthermore, the number of parameters and the number of floating-point operations per second (FLOPs) were 3.9×106 and 10.9×109, respectively, which were 3.1×106 and 5.3×109 lower than those of the original YOLOv5s model; The model achieved an inference speed of 3.6 ms, representing an improvement of 1.1 ms over the original model. Compared to other object detection models including Faster R-CNN, CenterNet, YOLOv3-SPP, YOLOXs, YOLOv8s, YOLOv10s and YOLOv11s, the model constructed in this study reduced the parameter count by 132.8×106, 28.2×106, 100.8×106, 5.0×106, 7.2×106, 4.2×106 and 5.5×106, decreased the FLOPs by 143.9×109, 79.4×109, 272.9×109, 16.3×109, 18×109, 14.3×109 and 11.1×109, improved the detection time of each graph by 25.4, 20.4, 35.2, 1.5, 3.9, 4.2 and 1.8 ms, respectively. The detection performance of the model was better than that of YOLOv5 s in the scenario of feeding 12, 8 and 6 pigs in a single column. In summary, the proposed method not only reduces model parameters and computational complexity but also enhances detection speed and recognition accuracy. Therefore, the new method presented in this study effectively meets the requirements of pig posture recognition in practical pig farming scenarios.
XuJ Y, ZhouS Y, XiaF, XuA J, YeJ H. Research on the lying pattern of grouped pigs using unsupervised clustering and deep learning[J]. Livestock Science, 2022, 260: 104946
[2]
YangQ M, XiaoD Q. A review of video-based pig behavior recognition[J]. Applied Animal Behaviour Science, 2020, 233: 105146
[3]
EllisJ L, JacobsM, DijkstraJ, van LaarH, CantJ P, TulpanD, FergusonN. Review: Synergy between mechanistic modelling and data-driven models for modern animal production systems in the era of big data [J]. Animal, 2020, 14(S2): s223-s237
[4]
ChenC, ZhuW X, NortonT. Behaviour recognition of pigs and cattle: Journey from computer vision to deep learning[J]. Computers and Electronics in Agriculture, 2021, 187: 106255
FuL S, SongZ Z, ZhangX, LiR, WangD, CuiY J. Applications and research progress of deep learning in agriculture[J]. Journal of China Agricultural University, 2020, 25(2): 105-120 (in Chinese)
TengG H, JiH Y, ZhuangY R, LiuM L. Research progress of deep learning in the process of pig feeding[J]. Transactions of the Chinese Society of Agricultural Engineering, 2022, 38(14): 235-249 (in Chinese)
[9]
LiG M, HuangY B, ChenZ Q, ChesserG D Jr, PurswellJ L, LinhossJ, ZhaoY. Practices and applications of convolutional neural network-based computer vision systems in animal farming: A review [J]. Sensors, 2021, 21(4): 1492
[10]
LeCunY, BengioY, HintonG. Deep learning[J]. Nature, 2015, 521: 436-444
[11]
ZhengC, ZhuX M, YangX F, WangL N, TuS Q, XueY J.. Automatic recognition of lactating sow postures from depth images by deep learning detector[J]. Computers and Electronics in Agriculture, 2018, 147: 51-63
YangX F, ZhengC, ZouC H, GanH M, LiS M, HuangS M, XueY J. A CNN-based posture change detection for lactating sow in untrimmed depth videos[J]. Computers and Electronics in Agriculture, 2021, 185: 106139
[14]
YangX F, ZhengC, ZouC H, GanH M, LiS M, HuangS M, XueY J. A CNN-based posture change detection for lactating sow in untrimmed depth videos[J]. Computers and Electronics in Agriculture, 2021, 185: 106139
[15]
NasirahmadiA, SturmB, EdwardsS, JeppssonK H, OlssonA C, MüllerS, HenselO. Deep learning and machine vision approaches for posture detection of individual pigs[J]. Sensors, 2019, 19(17): 3738
[16]
RiekertM, KleinA, AdrionF, HoffmannC, GallmannE. Automatically detecting pig position and posture by 2D camera imaging and deep learning[J]. Computers and Electronics in Agriculture, 2020, 174: 105391
[17]
RiekertM, OpderbeckS, WildA, GallmannE. Model selection for 24/7 pig position and posture detection by 2D camera imaging and deep learning[J]. Computers and Electronics in Agriculture, 2021, 187: 106213
[18]
ShaoH M, PuJ Y, MuJ. Pig-posture recognition based on computer vision: Dataset and exploration [J]. Animals, 2021, 11(5): 1295
[19]
JiH Y, YuJ H, LaoF D, ZhuangY R, WenY B, TengG H. Automatic position detection and posture recognition of grouped pigs based on deep learning[J]. Agriculture, 2022, 12(9): 1314
[20]
XuJ Y, ZhouS Y, XuA J, YeJ H, ZhaoA Y. Automatic scoring of postures in grouped pigs using depth image and CNN-SVM[J]. Computers and Electronics in Agriculture, 2022, 194: 106746
WangZ, XuX S, HuaZ X, ShangY Y, DuanY C, SongH B. Lightweight recognition for the oestrus behavior of dairy cows combining YOLO v5n and channel pruning[J]. Transactions of the Chinese Society of Agricultural Engineering, 2022, 38(23): 130-140 (in Chinese)
[23]
LuoJ H, ZhangH, ZhouH Y, XieC W, WuJ X, LinW Y. ThiNet: Pruning CNN filters for a thinner net[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2019, 41(10): 2525-2538
[24]
YuR C, LiA, ChenC F, LaiJ H, MorariuV I, HanX T, GaoM F, LinC Y, DavisL S. NISP: pruning networks using neuron importance score propagation[C]. In. 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Salt Lake City, UT, USA. IEEE, 2018: 9194-9203
KangJ, LiuG, WangQ, XiaY, GuoG F, LiuW B. Weed detection algorithm based on dynamic pruning neural network[J]. Transactions of the Chinese Society for Agricultural Machinery, 2023, 54(4): 268-275 (in Chinese)
[27]
HuangL, XuL J, WangY C, PengY Q, ZouZ Y, HuangP. Efficient detection method of Pig-Posture behavior based on multiple attention mechanism[J]. Computational Intelligence and Neuroscience, 2022, 2022: 1759542
XueY J, ZhuX M, ZhengC, MaoL, YangA Q, TuS Q, HuangN, YangX F, ChenP F, ZhangN F. Lactating sow postures recognition from depth image of videos based on improved Faster R-CNN[J]. Transactions of the Chinese Society of Agricultural Engineering, 2018, 34(9): 189-196 (in Chinese)
[30]
YeH C, ZhangB, ChenT, FanJ Y, WangB. Performance-aware approximation of global channel pruning for multitask CNNs[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2023, 45(8): 10267-10284