Click on “Download PDF” for the PDF version or on the title for the HTML version.


If you are not an ASABE member or if your employer has not arranged for access to the full-text, Click here for options.

Body Condition Scoring Method for Dairy Cow via Computer Vision and an Improved YOLOv7-BDN Model

Published by the American Society of Agricultural and Biological Engineers, St. Joseph, Michigan www.asabe.org

Citation:  Journal of the ASABE. 69(1): 1-12. (doi: 10.13031/ja.16317) @2026
Authors:   Xiaoping Huang, Chenyang Wang, Yangyang Guo, Mengyi Liu, Shuijian Zheng, Zhaohong Jia
Keywords:   Body condition score, Computer vision, Robustness, Target detection and classification, YOLOv7.

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.

(Download PDF)    (Export to EndNotes)