Abstract
This study addresses the practical demand for facial recognition of pigs in the food safety and insurance industries, tackling the challenge of low recognition accuracy caused by complex farming environments, occlusions, and similar textures. To this end, we propose an enhanced model, DGS-YOLO, based on YOLOv11n, designed to achieve precise facial recognition of group-raised young pigs. The core improvements of the model include the following: (1) replacing standard convolutions with dynamic convolutions (DMConv) to enhance the network's adaptive extraction capability for critical detail features; (2) designing a C3k2_GBC module with a bottleneck structure to replace the C3k2 neck, enabling more efficient capture of multi-scale contextual information; (3) introducing the SimAM parameter-free attention mechanism to optimize feature focusing; (4) employing the Shape-IoU loss function to mitigate the impact of bounding box geometry on regression accuracy. Experiments on self-built datasets demonstrate that DGS-YOLO achieves 4%, 2.1%, and 2.3% improvements in accuracy, recall, and mAP50, respectively, compared to the baseline model YOLOv11n. Furthermore, its overall performance surpasses that of Faster R-CNN and SSD in comprehensive evaluation metrics. Especially in limited sample scenarios, the model demonstrates strong generalization ability, with accuracy and mAP50 further increased by 20.1% and 10.3%. This study provides a highly accurate and robust solution for animal facial recognition in complex scenarios.