Automatic lameness detection in dairy cows based on machine vision

Zongwei Jia, Xuhui Yang, Zhi Wang, Ruirui Yu, Ruibin Wang

Abstract


This study proposed a method for detecting lameness in dairy cows based on machine vision, addressing the challenges associated with manual detection. Data from a dairy farm in Taigu, Shanxi, China were collected and divided into two parts. The first part was utilized to precisely position the cow’s back by employing a dedicated deep learning model named GhostNet_YOLOv4, which can be implemented on mobile or embedded devices. The second part was used with the Visual Background Extractor (Vibe) algorithm, incorporating additional morphological processing techniques. Enhancing the Vibe algorithm, a widely used background subtraction algorithm for image sequences, achieved more accurate recognition of the specific pixel areas of cows. Subsequently, cow shape-related feature parameters were extracted from the back area using the combined approach. These parameters were used to calculate the average curvature, which describes the degree of curvature of the cow’s back contour during walking. The differences in curvature values were employed for classification to detect lameness. Through extensive experimentation, distinct average curvature ranges of [−0.025, −0.125], [−0.025, +∞], and [−∞, −0.125] were established for normal cows, early lameness, and moderate-severe lameness, respectively. The algorithm’s effectiveness was validated by processing 600 image sequences of dairy cows, resulting in a lameness detection accuracy of 91.67%. These findings can serve as a reference for the timely and accurate recognition of lameness in dairy cows.
Keywords: dairy cow, lameness detection, machine vision, object detection, deep learning
DOI: 10.25165/j.ijabe.20231603.8097

Citation: Jia Z W, Yang X H, Wang Z, Yu R R, Wang R B. Automatic lameness detection in dairy cows based on machine vision. Int J Agric & Biol Eng, 2023; 16(3): 217–224.

Keywords


dairy cow, lameness detection, machine vision, object detection, deep learning

Full Text:

PDF

References


Han S Q, Zhang J, Cheng G D, Peng Y Q, Zhang J H, Wu J Z. Current state and challenges of automatic lameness detection in dairy cattle. Smart Agriculture, 2020; 2(3): 21-36. (in Chinese)

Kang X, Zhang X D, Liu G. A review: Development of computer vision-based lameness detection for dairy cows and discussion of the practical applications. Sensors, 2021; 21(3): 753. doi: 10.3390/s21030753.

Novotna I, Langova L, Havlicek Z. Risk factors and detection of lameness using infrared thermography in dairy cows - A review. Annals of Animal Science, 2019; 19(3): 563-578.

Sprecher D J, Hostetler D E, Kaneene J B. A lameness scoring system that uses posture and gait to predict dairy cattle reproductive performance. Theriogenology, 1997; 47(6): 1179-1187. doi: 10.1016/S0093-691X(97)00098-8.

Thomsen P T, Munksgaard L, Tøgersen F A. Evaluation of a lameness scoring system for dairy cows. Journal of Dairy Science, 2008; 91(1): 119-126.

Van Nuffel A, Zwertvaegher I, Van Weyenberg S, Pastell M, Thorup V M, Bahr C, et al. Lameness detection in dairy cows: Part 2. Use of sensors to automatically register changes in locomotion or behavior. Animals, 2015; 5(3): 861-885.

Chapinal N, de Passillé A M, Pastell M, Hanninen L, Munksgaard L, Rushen J. Measurement of acceleration while walking as an automated method for gait assessment in dairy cattle. Journal of Dairy Science, 2011; 94(6): 2895-2901.

Bahr C, Leroy T, Song X Y, Vranken E, Maertens W, Vangeyte J, et al. Automatic detection of lameness in dairy cattle - Analyzing image parameters related to lameness. Livestock Environment VIII, Iguassu Falls: ASABE, 2008; paper No. 701P0408. doi: 10.13031/2013.25608.

Song H B, Jiang B, Wu Q, Li T, He D J. Detection of dairy cow lameness based on fitting line slope feature of head and neck outline. Transactions of the CSAE, 2018; 34(15): 190-199. (in Chinese)

Zhao K, Bewley J M, He D, Jin X. Automatic lameness detection in dairy cattle based on leg swing analysis with an image processing technique. Computers and Electronics in Agriculture, 2018; 148: 226-236.

Van Hertem T, Viazzi S, Steensels M, Maltz E, Antler A, Alchanatis V, et al. Automatic lameness detection based on consecutive 3D-video recordings. Biosystems Engineering, 2014; 119: 108-116.

Viazzi S, Bahr C, Schlageter-Tello A, Van Hertem T, Romanini C E B, Pluk A, et al. Analysis of individual classification of lameness using automatic measurement of back posture in dairy cattle. Journal of Dairy Science, 2013; 96(1): 257-266. doi: 10.3168/jds.2012-5806.

Poursaberi C, Bahr C, Pluk A, Van Nuffel A, Berckmans D. Real-time automatic lameness detection based on back posture extraction in dairy cattle: Shape analysis of cow with image processing techniques. Computers and Electronics in Agriculture, 2010; 74(1): 110-119.

Zhang H Y, Cisse M, Dauphin Y N, Lopez-Paz D. Mixup: Beyond empirical risk minimization. arXiv Preprint, 2018. arXiv: 1710.09412.

Devries T, Taylor G W. Improved regularization of convolutional neural networks with cutout. arXiv Preprint, 2017. arXiv:1708.04552.

Yun S, Han D, Chun S, Oh S J, Yoo Y, Choe J. CutMix: Regularization strategy to train strong classifiers with localizable features. 2019 IEEE/CVF International Conference on Computer Vision (ICCV), Seoul: IEEE, 2019; pp.6022-6031. doi: 10.1109/ICCV.2019.00612.

Buslaev A, Iglovikov V I, Khvedchenya E, Parinov A, Druzhinin M, Kalinin A A. Albumentations: Fast and flexible image augmentations. Information, 2020; 11(2): 125. doi:10.3390/info11020125.

Han K, Wang Y H, Tian Q, Guo J Y, Xu C J, Xu C. GhostNet: More features from cheap operations. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle: IEEE, 2020; pp.1577-1586. doi: 10.1109/CVPR42600.2020.00165.

Bochkovskiy A, Wang C Y, Liao H Y M. YOLOv4: Optimal speed and accuracy of object detection. arXiv Preprint, 2020. arXiv:2004.10934.

Jiang B R, Luo R X, Mao J Y, Xiao T T, Jiang Y N. Acquisition of localization confidence for accurate object detection. arXiv Preprint, 2018. arXiv:1807.11590.

Barnich O, Van Droogenbroeck M. ViBe: A universal background subtraction algorithm for video sequences. IEEE Transactions on Image Processing, 2011; 20(6): 1709-1724. doi:10.1109/TIP.2010.2101613.

Dudi B, Rajesh V. Optimized threshold-based convolutional neural network for plant leaf classification: a challenge towards untrained data. Journal of Combinatorial Optimization, 2022; 43: 312-349.

Liu W, Anguelov D, Erhan D, Szegedy C, Reed S, Fu C Y, et al. SSD: Single Shot Multibox Detector. Computer Vision – ECCV 2016. 2016; 9905: 21-37. doi: 10.1007/978-3-319-10578-9_23.

Jiang Z C, Zhao L Q, Li S Y, Jia Y F. Real-time object detection method based on improved yolov4-tiny. arXiv Preprint, 2020. arXiv.2011.04244.

Ren S Q, He K M, Girshick R, Sun J. Faster R-CNN: Towards real-time object detection with region proposal networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017; 39(6): 1137-1149.

Tan M X, Pang R M, Le Q C. EfficientDet: Scalable and Efficient Object Detection. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle: IEEE, 2020; pp.10778-10787. doi: 10.1109/CVPR42600.2020.01079.

Farnebck G. Two-grame motion estimation based on polynomial expansion. 13th Scandinavian Conference on Image Analysis (SCIA 2003), Springer-Verlag, 2003; pp.363-370. doi: 10.1007/3-540-45103-X_50.

Muro S, Yoshida I, Hashimoto M, Takahashi K. Moving-object detection and tracking by scanning LiDAR mounted on motorcycle based on dynamic background subtraction. Artificial Life and Robotics, 2021; 26: 412-422.

Wang, Y, Tan Y H, Tian J W. Video segmentation algorithm with Gaussian mixture model and shadow removal. Opto-Electronic Engineering, 2008; 3: 21-25.

Tamara F, Nicolas R, Xu W K, Arthur G. Kernelized stein discrepancy tests of goodness-of-fit for time-to-event data. arXiv Preprint, 2020. arXiv:2008.08397v2.




Copyright (c) 2023 International Journal of Agricultural and Biological Engineering

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.

2023-2026 Copyright IJABE Editing and Publishing Office