A lightweight model for automatic pig counting in intensive piggeries using a green inspection robot and image segmentation method
• Use mobile robots to collect data and conduct field verification. • Replaces the C2f module with the Ghost module in the backbone network based on the YOLOv8n-seg framework. • Adopts a spatial group enhancement attention mechanism, and a lightweight shared detail enhancement convolutional detection head. • Achieving a balance between segmentation performance and computational resource efficiency, this approach facilitates precise and low-computation pig instance segmentation on resource-constrained edge devices. To address the high computational resource consumption of traditional pig instance segmentation models, which impedes their deployment on resource-constrained edge devices, this paper proposes an improved, lightweight instance segmentation and counting method based on YOLOv8n-seg model. Specifically, the C2f module is replaced with the Ghost module to reduce the model’s computational complexity. Additionally, a spatial group-enhanced attention mechanism is introduced in the neck network to enhance the model's feature fusion ability in the presence of pig occlusion and overlap. In the head network, a lightweight shared detail-enhanced convolution detection head is employed, which reduces computational load and parameter count through shared convolutions while capturing the intricate details of pigs from multiple angles via the detail-enhanced convolution module. Experimental results show that the improved model achieves an average precision of 95.7% with memory usage, floating-point operations per second (FLOPS), and frames per second (FPS) at 1.2MB, 7 × 10^9, and 217.86, respectively. Compared with State-of-the-art model, such as DeeplabV3+, HRNet, PSPNet, Seg-Former, and UNet models, the proposed model exhibits superior performance metrics. This research provides a lightweight solution for pig instance segmentation in farm environments.
Authors
- Haowen Luo (ORCID: https://orcid.org/0000-0001-5639-7180)
- Yizhi Luo (ORCID: https://orcid.org/0000-0002-8362-5481)
- Fanming Meng (ORCID: https://orcid.org/0000-0002-4763-6714)
- Enli Lv
- Chen Yang (ORCID: https://orcid.org/0000-0001-5228-3426)
- Aqing Yang (ORCID: https://orcid.org/0009-0005-7049-2017)
Institutions
- South China Agricultural University (CN)
- South China Normal University (CN)
- Poultry Research Institute (CN)
- Guangdong Academy of Agricultural Sciences (CN)
Publication Details
- Journal
- Smart Agricultural Technology
- Published
- 2025-06-19
- DOI
- https://doi.org/10.1016/j.atech.2025.101115
- Citations
- 4
- Primary Topic
- Industrial Vision Systems and Defect Detection
- Type
- article
- Field-Weighted Citation Impact
- 4.97