Yizhi Luo , Chen Yang , Enli Lv , Aqing Yang , Fanming Meng , Haowen Luo
{"title":"A lightweight model for automatic pig counting in intensive piggeries using a green inspection robot and image segmentation method","authors":"Yizhi Luo , Chen Yang , Enli Lv , Aqing Yang , Fanming Meng , Haowen Luo","doi":"10.1016/j.atech.2025.101115","DOIUrl":null,"url":null,"abstract":"<div><div>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.2 MB, 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.</div></div>","PeriodicalId":74813,"journal":{"name":"Smart agricultural technology","volume":"12 ","pages":"Article 101115"},"PeriodicalIF":5.7000,"publicationDate":"2025-06-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Smart agricultural technology","FirstCategoryId":"1085","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S277237552500348X","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"AGRICULTURAL ENGINEERING","Score":null,"Total":0}
引用次数: 0
Abstract
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.2 MB, 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.