Improved YOLOv5 for piglet detection in group housing: a lightweight and accurate approach
China's pig industry, rooted in the world's largest pork-producing and consuming nation, has evolved into an indispensable cornerstone of the country's agricultural and economic development. In the intensive farming mode, the pig industry urgently needs to ensure the health of pigs with precise monitoring technology. Especially in high-density collective breeding environments where individual pigs obstruct each other and the lighting conditions inside the pens are complex and varied, traditional detection methods often fail to meet practical demands due to insufficient recognition accuracy. Therefore, this study proposes an improved lightweight detection model YOLOv5-Ghost-Triplet. This model replaces the standard convolutional layer with a lightweight GhostNet structure, generating redundant feature maps using inexpensive linear transformations. The network's parameters are reduced by 29.3%, from 7.02 million to 4.96 million, while computational complexity decreases by 32.1%, with GFLOPs optimized from 15.9 to 10.8. These enhancements greatly improve edge device deployment. Although there is only a slight difference of 1.2-2.1 percentage points between the detection accuracy (96.4%) and recall rate (94.1%) compared to the benchmark model, the fusion of Triplet Attention mechanism enhances cross dimensional feature interaction by synchronously capturing global dependencies in the channel, height, and width dimensions, effectively alleviating the problem of feature confusion caused by overlapping occlusion and uneven lighting of pigs, thus achieving a 95.1% F1 comprehensive score in dense pig herd scenes. This lightweight design provides a promising solution for intelligent livestock management.
Authors
- Xin Yang (ORCID: https://orcid.org/0000-0002-7506-9673)
- Sam Yang (ORCID: https://orcid.org/0000-0002-8565-6214)
- J. Li
- Lin-Zhi Chen
- Yi-min Lin (ORCID: https://orcid.org/0009-0003-5780-8668)
- Chongzhao Han
Institutions
- Zhuhai Institute of Advanced Technology (CN)
Publication Details
- Published
- 2025-07-16
- DOI
- https://doi.org/10.1117/12.3070653
- Primary Topic
- Animal Behavior and Welfare Studies
- Type
- article
- Field-Weighted Citation Impact
- 0.00