Abstract:
Objective To address the low detection accuracy of pig detection algorithms and the limited computational capacity of edge computing devices in large-scale pig farms caused by dense occlusion, illumination variations, and background interference, this study proposes a lightweight pig detection algorithm based on YOLO11n and develops the YOLO11n-MWES model.
Method Based on YOLO11n, MobileNetV4 was used as a lightweight backbone to reduce model complexity. WTConv was then introduced to improve the original C3K2 feature extraction module by enlarging its receptive field, thereby enhancing the model’s ability to extract pig image features in complex scenarios. Additionally, an efficient upsampling module was incorporated into the YOLO11n neck feature fusion network to improve the model’s detection accuracy and robustness. Finally, ShapeIoU was adopted as the loss function to accelerate model training convergence.
Result Experimental results show that YOLO11n-MWES achieved a precision of 98.55%, a recall of 97.57%, and an mAP@0.95 of 80.74%, improving by 0.25, 0.87, and 4.74 percentage points, respectively, over YOLO11n. The number of model parameters was reduced by 29.34%, and the FPS was increased by 12.5. Compared with mainstream detection models such as Faster R-CNN, RT-DETR, and YOLOv5, YOLO11n-MWES significantly reduced both false detections and missed detections under occlusion, stacking, background interference, and low-light conditions.
Conclusion YOLO11n-MWES effectively balances accuracy and lightweight design, making it suitable for edge-based applications such as pig population monitoring and weight estimation in large-scale pig farms.