Abstract:Aiming to address the problems of low detection accuracy and difficult tracking caused by complex postures, high individual similarity and mutual occlusion of group-housed pigs, a lightweight pose recognition and tracking method for pigs based on an EL-YOLO v8n model was proposed. On the basis of YOLO v8n, EfficientRepBiFusion (ERB) structure was introduced to enhance multi-scale feature fusion, a lightweight LSDGCD detection head was designed to improve feature extraction capability, and an optimized EIoU loss function was adopted to enhance the learning effect of positive samples. In trajectory tracking, ByteTrack was integrated to achieve identity maintenance and tracking continuity of pigs, effectively reducing ID switches and missed detections caused by occlusion and pose switching. Experimental results showed that in the pose detection of pigs, the recognition accuracies of the proposed model for standing, lying, sitting and sprawling postures were 98.7%, 93.2%, 99.3% and 92.3%, respectively. Compared with YOLO v8n, the average detection accuracy of the model was improved by 6.24%, the recall rate was increased by 7.61%, the mean average precision (mAP@0.5) was raised by 8.49%, the number of parameters was reduced by 15.28%, and the model memory footprint was only 5.45 MB. When combined with ByteTrack, the model attained an IDF1 of 90.7%, with multiple object tracking accuracy (MOTA) and higher order tracking accuracy (HOTA) reaching 88.6% and 66.2% respectively, outperforming that of DeepSORT and BoT-SORT. The model realized edge deployment at pig farms by Jetson Nano, enabling continuous detection and tracking of the pig postures, which provided technical support for group-housed pig intelligent breeding.