Abstract:Objective To achieve accurate and efficient detection of pig carcasses' segmentation features, which are hard to distinguish and relatively small.Methods The Ghost Conv module and C3Ghost module are introduced into the Backbone layer to replace the ordinary convolution and C2 modules in the original YOLOv8n feature extraction network, aiming to reduce the computational amount and model complexity. The SPPF module is replaced with the SPPELAN module, so that the model can more effectively cope with multi-scale and small target features. Finally, parameter-free attention SimAM is introduced in front of the three detection heads to improve the ability to recognize the small target features of the lower pig carcass in a complex environment.Results The mAP50 of the improved YOLOv8n model on the self-made dataset is 97.3%, which is 5.3% higher than that of the original YOLOv8n. The parameter Params, computational FLOPs, and the model size of the improved model are 1.5 M, 4.9 G, and 3.5 MB, respectively, which are only 50.0%, 60.5% and 55.6% of YOLOv8n. The FPS of the model inference speed is 120.2 frames/s, which is increased by 20.7 frames/s.Conclusion The improved YOLOv8n model has advantages in detection accuracy and lightweight, and can effectively identify the small target segmentation features of pig carcasses.