Highlights A real-time video acquisition platform is built in the ranch, so images/videos can be acquired automatically; based on this platform, our dataset used for training and testing is built. A new improved single shot multibox detector (YOLOv7) algorithm is proposed for tail detection in video. The YOLOv7 method is improved by adding a two-level routing attention mechanism to the feature extraction network, replacing convolution with a distributed shift convolution. The experimental results show that the improved YOLOv7 algorithm with an attention mechanism and Gaussian distance loss can identify the body condition of cows in fuzzy environments with high accuracy. ABSTRACT. Under the requirements of smart farming and precision management, accurately detecting and classifying cow body conditions is crucial for the large-scale intelligent breeding of cows. This study proposed a novel body condition scoring model for cows based on the YOLOv7 (you only look once version 7) framework. First, a vision transformer with Bi-Level Routing Attention (BiFormer bidirectional feature transformer) mechanism was added to the reparameterized path of the YOLOv7 backbone network to enhance the feature extraction capability. Furthermore, the convolution in YOLOv7 was replaced with a learnable efficient convolution operator (DSConv (distributed shift convolution)). Finally, the NWD (normalized Wasserstein distance) loss module was integrated into the CIoU (complete intersection over union) loss to reduce the regression error of the original model. The experimental results demonstrate that the improved YOLOv7-BDN model achieves an mAP@0.5 of 95.9%, and an F1 score of 90.4%. Compared with the YOLOv5m, YOLOv6m, YOLOv7, YOLOv8m, and YOLOv8l models, these indicators improved by 4.7%, 4.0%, 2.2%, 4.7%, and 2.2%, respectively. In this work, Gaussian noise with a noise kernel of 18 is added, and data augmentation techniques are adopted in the training dataset. The YOLOv7-BDN model proposed in this study can accurately identify the body condition of dairy cows in complex environments with stronger robustness and generalizability. Keywords: Body condition score, Computer vision, Robustness, Target detection and classification, YOLOv7.
Huang et al. (Thu,) studied this question.