Cow Hoof Slippage Detecting Method Based on Enhanced DeepLabCut Model - NIAN Yue; ZHAO Kaixuan; JI Jiangtao (智慧农业)
[Objective]The phenomenon of hoof slipping occurs during the walking process of cows, which indicates the deterioration of the farming environment and a decline in the cows' locomotor function. Slippery grounds can lead to injuries in cows, resulting in unnecessary economic losses for farmers. To achieve automatically recognizing and detecting slippery hoof postures during walking, the study focuses on the localization and analysis of key body points of cows based on deep learning methods. Motion curves of the key body points were analyzed, and features were extracted. The effectiveness of the extracted features was verified using a decision tree classification algorithm, with the aim of achieving automatic detection of slippery hoof postures in cows.[Method]An improved localization method for the key body points of cows, specifically the head and four hooves, was proposed based on the DeepLabCut model. Ten networks, including ResNet series, MobileNet-V2 series, and EfficientNet series, were selected to respectively replace the backbone network structure of DeepLabCut for model training. The root mean square error(RMSE), model size, FPS, and other indicators were chosen, and after comprehensive consideration, the optimal backbone network structure was selected as the pre-improved network. A network structure that fused the convolutional block attention module (CBAM) attention mechanism with ResNet-50 was proposed. A lightweight attention module, CBAM, was introduced to improve the ResNet-50 network structure. To enhance the model's generalization ability and robustness, the CBAM attention mechanism was embedded into the first convolution layer and the last convolution layer of the ResNet-50 network structure. Videos of cows with slippery hooves walking in profile were predicted for key body points using the improved DeepLabCut model, and the obtained key point coordinates were used to plot the motion curves of the cows' key body points. Based on the motion curves of the cows' key body points, the feature parameter Feature1 for detecting slippery hooves was extracted, which represented the local peak values of the derivative of the motion curves of the cows' four hooves. The feature parameter Feature2 for predicting slippery hoof distances was extracted, specifically the minimum local peak points of the derivative curve of the hooves, along with the local minimum points to the left and right of these peaks. The effectiveness of the extracted Feature1 feature parameters was verified using a decision tree classification model. Slippery hoof feature parameters Feature1 for each hoof were extracted, and the standard deviation of Feature1 was calculated for each hoof. Ultimately, a set of four standard deviations for each cow was extracted as input parameters for the classification model. The classification performance was evaluated using four common objective metrics, including accuracy, precision, recall, and F1-Score. The prediction accuracy for slippery hoof distances was assessed using RMSE as the evaluation metric.[Results and Discussion]After all ten models reached convergence, the loss values ranked from smallest to largest were found in the EfficientNet series, ResNet series, and MobileNet-V2 series, respectively. Among them, ResNet-50 exhibited the best localization accuracy in both the training set and validation set, with RMSE values of only 2.69 pixels and 3.31 pixels, respectively. The MobileNet series had the fastest inference speed, reaching 48 f/s, while the inference speeds of the ResNet series and MobileNet series were comparable, with ResNet series performing slightly better than MobileNet series. Considering the above factors, ResNet-50 was ultimately selected as the backbone network for further improvements on DeepLabCut. Compared to the original ResNet-50 network, the ResNet-50 network improved by integrating the CBAM module showed a significant enhancement in localization accuracy. The accuracy of the improved network increased by 3.7% in the training set and by 9.7% in the validation set. The RMSE between the predicted body key points and manually labeled points was only 2.99 pixels, with localization results for the right hind hoof, right front hoof, left hind hoof, left front hoof, and head improved by 12.1%, 44.9%, 0.04%, 48.2%, and 39.7%, respectively. To validate the advancement of the improved model, a comparison was made with the mainstream key point localization model, YOLOv8s-pose, which showed that the RMSE was reduced by 1.06 pixels compared to YOLOv8s-pose. This indicated that the ResNet-50 network integrated with the CBAM attention mechanism possessed superior localization accuracy. In the verification of the cow slippery hoof detection classification model, a 10-fold cross-validation was conducted to evaluate the performance of the cow slippery hoof classification model, resulting in average values of accuracy, precision, recall, and F1-Score at 90.42%, 0.943, 0.949, and 0.941, respectively. The error in the calculated slippery hoof distance of the cows, using the slippery hoof distance feature parameter Feature2, compared to the manually calibrated slippery hoof distance was found to be 1.363 pixels.[Conclusion]The ResNet-50 network model improved by integrating the CBAM module showed a high accuracy in the localization of key body points of cows. The cow slippery hoof judgment model and the cow slippery hoof distance prediction model, based on the extracted feature parameters for slippery hoof judgment and slippery hoof distance detection, both exhibited small errors when compared to manual detection results. This indicated that the proposed enhanced deeplabcut model obtained good accuracy and could provide technical support for the automatic detection of slippery hooves in cows.