A Fuzzy K-Nearest Neighbour-based Model for detecting Lameness in Cattle

  • Opeyemi O. Adanigbo
  • Oyeyemi T. Oyewole


In Africa, cattle are reared for meat and milk production and lameness is considered a major problem in modern dairy farming. Several studies have attempted to explicate automatic lameness detection systems using different techniques. However, these detection techniques are easily impacted by the physiological attributes of individual cows, ensuing in imprecise lameness detection. Consequently, this study presents a description and assessment of the performance of a fuzzy k-nearest neighbor (FKNN)-based classification system for automatic lameness detection from sensor data with a view to improving cattle lameness detection accuracy by reducing the rates of false-positive alerts. In order to further improve the model detection accuracy, Principal Component Analysis (PCA) was used in projecting the features on to a lower dimension on which the optimal FKNN model was formulated. The proposed system was tested using Classification Accuracy(Acc), sensitivity, specificity and the area under the receiver operating characteristic curve (ROC) curve (AUC) as performance metrics.


Afonso, J.S., Bruce,M., Keating,P. Raboisson, D.,Clough, H., Oikonomou, G. and Rushton, J. (2020). Frontiers. Profiling detection and Classification of Lameness Methods in British Dairy Cattle Research: A Systematic Review and Meta-Analysis.

Alsaaod, M.; Fadul, M.; and Steiner, A.(2019). Automatic lameness detection in cattle. Vet. J. 2019, 246, 35–44.

Chapinal, N.; De Passillé, A.; Rushen, J.;and Wagner, S.( 2010). Automated methods for detecting lameness and measuring analgesia in dairy cattle. J. Dairy Sci. 2010, 93, 2007– 2013.

Duda, R. O., and Hart, P. E., (1973). Pattern classification and scene analysis. Wiley and Sons, New York. 184-189.

Gardenier, J.; Underwood, J.; Weary, D.; and Clark, C. (2021). Pairwise comparison locomotion scoring for dairy cattle. J. Dairy Sci. 2021,104, 6185–6193.

Herrero, M.; Henderson, B.; Havlík, P.; Thornton, P.K.; Conant, R.T.; Smith, P.; Wirsenius, S.; Hristov, A.N.; Gerber, P.; and Gill, M. (2016). Greenhouse gas mitigation potentials in the livestock sector. Nat. Clim. Chang. 2016, 6, 452– 461.

Keller, J. M., Gray, M. R., and Givens, J. A., (1985). A fuzzy k-nearest neighbours algorithm. IEEE Transacions on Systems, Man, Cybernetics, Vol.15, 580–585.

Liu, J.; Dyer, R.M.; Neerchal, N.K.; Tasch, U.; and Rajkondawar, P.G. (2011). Diversity in the magnitude of hind limb unloading occurs with similar forms of lameness in dairy cows. J. Dairy Res. 2011, 78, 168–177.

O’Leary, N.; Byrne, D.; O’Connor, A.; and Shalloo, L.(2020). Invited review: Cattle lameness detection with accelerometers. J. Dairy Sci.2020, 103, 3895–3911.

Pluk, A.; Bahr, C., Poursaberi, A , Maertens, W., Van Nuffel, A. and Berckmans, D. (2012). Automatic measurement of touch and release angles of the fetlock joint for lameness detection in dairy cattle using vision techniques. Journal of dairy science. 95. 1738-48. 10.3168/jds.2011-4547.

Schlageter Tello, A.,Van Hertem, T.,Viazzi, S., Groot, K., P.W.G., Bahr, C., and Lokhorst, Kees. (2015). Relation between observed locomotion traits and locomotion score in dairy cows. Journal of Dairy Science. 10.3168/jds.2014- 9059.

Sjöström, K., Fall, N., Blanco-Penedo, I., Duval, J.E., Krieger, M. and Emanuelson, U. (2018). Lameness prevalence and risk factors in organic dairy herds in four European countries. Livest. Sci., 208 (2018), 44-50 https://doi.org/10.1016/j.livsci.2017.12. 009

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

Thorup, V.M.; Munksgaard, L.; Robert, P.E.; Erhard, H.; Thomsen, P.; and Friggens, N.(2015). Lameness detection via leg- mounted accelerometers on dairy cows on four commercial farms. Animal 2015, 9, 1704–1712.

Van Hertem, T., Viazzi, S., Steensels, M., Maltz, E., Antler, A., Alchanatis, V., Schlageter-Tello, A.A., Lokhorst, K., Romanini, E.C.B., Bahr C., Berckmans, D., and Halachmi, I., (2014). Automatic lameness detection based on consecutive 3D-video recordings. Journal of Biosystems Engineering, Vol.119, 108- 116.

Viazzi, S.; Bahr, C.; Van Hertem, T.; Schlageter-Tello, A.; Romanini, C.; Halachmi, I.; Lokhorst, C.; and Berckmans, D.(2014).Comparison of a three-dimensional and two-dimensional camera system for automated measurement of back posture in dairy cows. Comput. Electron. Agric. 2014, 100, 139–147.