A Method of Body Condition Scoring for Dairy Cows Based on Lightweight Convolution Neural Network
Authors: Feng Tao , Guo Yangyang , Huang Xiaoping , Wu Jiaxin , Cheng Can 
Published: April 2024

Highlights

A cow body condition scoring model (ShuffleNet-SEH) based on a lightweight convolutional neural network using ShuffleNetV2 was proposed.

Introducing the SE attention mechanism and H-Swish activation function enhances the feature extraction capability of the model.

Achieved over 98% classification accuracy rate on the cow datasets.

The proposed method can be applied to mobile devices.

Abstract. Body condition scoring is an essential tool for nutrition management in large-scale dairy farming. The traditional method of manual scoring is inefficient and prone to subjective error. With the advancement of deep learning algorithms and machine vision technology, automatic scoring methods have been proposed. In response to the current problems of large parameter sizes and poor robustness in deep learning models, this study proposes a cow body condition scoring model (ShuffleNet-SEH) based on a lightweight convolutional neural network using ShuffleNetV2 as a foundation. Firstly, tail area images of cows were collected to construct a diverse dataset that includes complex variations such as motion blur and different levels of illumination. Secondly, the ShuffleNet-SEH model was developed by integrating a Squeeze-and-Excitation Networks (SENet) module into the main branch of ShuffleNetV2 after 1×1 convolution to enhance the representation ability of the network and improve its accuracy in identifying the cow body condition. Additionally, the nonlinear activation function ReLU in SENet was replaced by H-Swish to reduce the computational data required for the model on mobile devices, making it suitable for quantization operations. ShuffleNet-SEH was comprehensively evaluated, including ablation experiments, confusion matrix analysis, and feature map analysis. Multiple complex test sets were constructed for validation purposes. Throughout these evaluations, ShuffleNet-SEH exhibited remarkable performance. Furthermore, the efficacy and interpretability of ShuffleNet-SEH in cow body condition scoring tasks were further substantiated through meticulous feature map analysis. The findings underscore the robustness and reliability of ShuffleNet-SEH across diverse experimental scenarios and assessments. In the constructed motion blur test set, ShuffleNet-SEH demonstrated outstanding performance. Specifically, it achieved an accuracy rate of 98.2%, a precision rate of 98.5%, and a recall rate of 98.3%. These results represent significant improvements of 2.3%, 2.4%, and 3.2%, respectively, compared to the performance of the ShuffleNetV2 model. In addition, it is noteworthy that the ShuffleNet-SEH model has a size of approximately 5.64 MB, while the original ShuffleNet model has a size of 4.97 MB. This indicates a modest increase in model size of approximately 13.5% with the incorporation of the ShuffleNet-SEH enhancements. Moreover, superior overall performance was displayed by ShuffleNet-SEH model compared to mainstream convolutional neural network classification models, including MobileNetV2, EfficientNetV1, and ConvNeXt. The success of ShuffleNet-SEH in accurately identifying cow body condition while maintaining a lightweight architecture makes it suitable for deployment on mobile devices and, thus, has the potential to promote the commercialization of cow body condition scoring. Keywords: Attention mechanism, Body condition score, Deep learning, ShuffleNetV2.