Abstract:Body measurement of goats is a fundamental aspect of livestock management, serving as a core indicator for quantifying production performance, analyzing genetic traits, improving the accuracy of breeding selection, and monitoring health status. It plays an irreplaceable role in enhancing economic efficiency and optimizing genetic breeding strategies. To address the challenges of measuring goat body dimensions under dynamic and multi-posture conditions, a non-contact, rapid, and accurate measurement method was proposed. An improved YOLO v8n-Pose deep learning model, named YOLO v8n-SK, was developed for keypoint detection of goats in the channel environment. This model specifically focused on accurately detecting the knee joints of goats to minimize the interference of movement on height measurements during motion. The model introduced a spatial-channel collaborative reconstruction convolution (ScConv) module to optimize the convolution-to-feature (C2f) structure, reducing parameter redundancy while enhancing feature extraction capability. CBAM attention mechanism was integrated to improve the model's robustness to interference, and an EIoU loss function was adopted to further optimize the training process and improve bounding box localization accuracy. From the extracted keypoints, body measurement-related features were obtained and combined with monocular depth estimation data. A nonlinear regression model was then employed to predict the goat body dimensions. Experimental results demonstrated that the proposed model exhibited excellent performance in detecting trunk and back keypoints, achieving a precision of 98.0%, recall of 98.1%, and mAP@50-95 of 95.8%. Meanwhile, the model complexity was significantly reduced, with parameters and FLOPs controlled at 6.7×10? and 7.9×10?, respectively. In the prediction of body measurement parameters, the mean absolute percentage errors (MAPE) for height, chest girth, abdominal girth, and body diagonal length were 2.408%, 1.731%, 1.340% and 2.519% respectively, demonstrating high measurement accuracy. Compared with traditional manual methods, the proposed approach significantly improved measurement efficiency and avoided stress responses in goats, enabling fast and accurate body measurement without disturbing the animals.