journal article·2025-06-05Open access

Lightweight Domestic Pig Behavior Detection Based on YOLOv8

Kaining Zhang, Yu Zhang, Hongli Xu

Applied Sciences· Volume 15· Issue 11

Abstract

The prevalence and magnitude of extensive domestic pig breeding in China are rising, and behavioral assessment of these pigs is essential for enhancing production efficiency. The existing behavior identification technique for domestic pigs is computationally intensive, making it challenging to use on edge devices. This study introduces a lightweight method for identifying domestic pig behavior, YOLOv8-PigLite, derived from YOLOv8. Initially, a novel two-branch bottleneck module is developed within the C2f module, incorporating average pooling and deep convolution (DWConv) in one branch, while the other branch utilizes maximum pooling and DWConv to augment multi-scale feature representation. Subsequently, a Grouped Convolution module is integrated into the convolution framework, followed by incorporating the SE module to diminish the recognition error rate further. Ultimately, we implement BiFPN in the neck network to replace the original FPN, which streamlines the neck network and enhances its feature-processing capabilities. The test findings indicated that, in comparison to the original YOLOv8n model, the precision, recall, and mean average precision at 50% remain constant, while the parameters and floating-point computations are diminished by 59.80% and 39.50%, respectively. Additionally, the FPS has increased by 32.61%, and the model’s generalizability has been validated on public datasets.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Advanced Neural Network Applications · Industrial Vision Systems and Defect Detection · Smart Agriculture and AI

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

School of Information Science and Engineering, Shandong Agricultural University, Tai’an 271018, China

Funding

Shandong Agricultural University

References (30)

Show source-provided references
1. Research on feature selection methods for pig posture recognition
2. Song, W. (2019). Pig Target Detection and Status Analysis Based on Deep Learning. [Master’s Thesis, Northeast Agricultural University].
3. Automatic recognition of lactating sow postures from depth images by deep learning detector10.1016/j.compag.2018.01.023 ↗
4. Jie, L., Xiaohui, H., and Jingbo, G. Lightweight field cotton grade detection based on YOLOv8, Comput. Eng., (accepted, in press).
5. Girshick, R., Donahue, J., Darrell, T., and Malik, J. (2014, January 23–28). Rich feature hierarchies for accurate object detection and semantic segmentation. Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, Columbus, OH, USA.10.1109/CVPR.2014.81 ↗
6. Girshick, R. (2015, January 7–13). [Fast R-CNN] Fast R-CNN. Proceedings of the IEEE International Conference on Computer Vision, Santiago, Chile.10.1109/ICCV.2015.169 ↗
7. Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks10.1109/TPAMI.2016.2577031 ↗
8. Redmon, J., Divvala, S., Girshick, R., and Farhadi, A. (2016, January 27–30). You only look once: Unified, real-time object detection. Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA.10.1109/CVPR.2016.91 ↗
9. Research progress of computer vision and deep learning in pig recognition
10. Wang, X.L., Kong, T., Shen, C.H., Jiang, Y., and Li, L. (2020). SOLO: Segmenting objects by locations. Computer Vision—ECCV 2020, Springer International Publishing.10.1007/978-3-030-58523-5_38 ↗
11. Pig behavior recognition method based on posture and temporal features
12. Group-housed pig behavior recognition and tracking method based on improved DeepSORT
13. Shao, H.M., Pu, J.Y., and Mu, J. (2021). Pig-posture recognition based on computer vision: Dataset and exploration. Animals, 11.10.3390/ani11051295 ↗
14. Ji, H.Y., Yu, J.H., Lao, F.D., Zhuang, Y.R., Wen, Y.B., and Teng, G.H. (2022). Automatic position detection and posture recognition of grouped pigs based on deep learning. Agriculture, 12.10.3390/agriculture12091314 ↗
15. Lightweight pig posture recognition method based on improved YOLOv5s
16. Zhang, N.N. (2025). Pig Behavior Recognition Dataset. Mendeley Data V1.
17. A Comprehensive Review of YOLO Architectures in Computer Vision: From YOLOv1 to YOLOv8 and YOLO-NAS10.3390/make5040083 ↗
18. Feng, C., Zhong, Y., Gao, Y., Scott, M.R., and Huang, W. (2021, January 10–17). TOOD: Task-aligned One-stage Object Detection. Proceedings of the IEEE International Conference on Computer Vision, Montreal, QC, Canada.10.1109/ICCV48922.2021.00349 ↗
19. AEM-YOLOv8s: Small Target Detection Algorithm for UAV Aerial Images
20. Strawberry target detection method based on transfer learning and lightweight YOLOv5s
21. ImageNet classification with deep convolutional neural networks10.1145/3065386 ↗
22. Ye, D.H., Zikic, D., Glocker, B., Criminisi, A., and Konukoglu, E. (2016). [SqueezeNet] Squeezenet: Alexnet-Level Accuracy with 50X Fewer Parameters and <0.5MB Model Size. arXiv.
23. Zhang, X., Zhou, X., Lin, M., and Sun, J. (2018, January 18–23). ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices. Proceedings of the Computer Society Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA.10.1109/CVPR.2018.00716 ↗
24. Xie, S., Girshick, R., Dollár, P., Tu, Z., and He, K. (2017, January 21–26). Aggregated residual transformations for deep neural networks. Proceedings of the 30th IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA.10.1109/CVPR.2017.634 ↗
25. Squeeze-and-Excitation Networks10.1109/TPAMI.2019.2913372 ↗
26. Automatic extraction of image water depth based on YOLOv5 algorithm
27. Object detection based on deep feature enhancement and path aggregation optimization
28. Selvaraju, R.R., Cogswell, M., Das, A., Vedantam, R., Parikh, D., and Batra, D. (2017, January 22–29). Grad-CAM: Visual explanations from deep networks via gradient-based localization. Proceedings of the IEEE International Conference on Computer Vision 2017, Venice, Italy.10.1109/ICCV.2017.74 ↗
29. Hyperparameter optimization method for YOLO model based on orthogonal optimization strategy
30. Insulator defect detection based on lightweight improved RT-DETR edge deployment algorithm