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 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 enhance the C3K2 feature extraction module. Additionally, an efficient upsampling module was incorporated into the neck network to improve feature fusion. Finally, ShapeIoU was applied to accelerate training convergence.
Result 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 model parameters were reduced by 29.34%, and the FPS was increased by 12.5. Compared with Faster R-CNN, RT-DETR, and YOLOv5, the proposed model significantly reduced the false positives and false negatives 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.