Fixed-time data segmentation and behaviour classification of pasture-based cattleEnhancing performance using a hidden Markov model

Type Article
Original languageEnglish
Pages (from-to)585-596
Number of pages12
JournalComputers and Electronics in Agriculture
Issue numberPart B
Publication statusPublished - 20 Nov 2017
Permanent link
Show download statistics
View graph of relations
Citation formats


It is often difficult to monitor dairy cow behavior where grazing contributes a significant proportion of dairy cow diets and where cow contact is reduced. We previously developed a behavioral model of the pasture-based dairy cow that requires incoming, transformed GPS data collected from cattle to be partitioned into segments of a fixed length prior to behavioral classification into grazing, resting or walking. However, fixed-time segmentation presents a problem during behavior classification because segment boundaries may not be located precisely at the point of behavioral transition, leading to classification errors. The objective of this work was to try to overcome this problem by statistically correcting the behavioral predictions. This was achieved using a hidden Markov model trained using 90 h of supervised data gathered from a previously studied cohort of dairy cattle. The statistical probabilities of the behaviors predicted by the classifier being the true (hidden) behaviors exhibited by cows and also the probability of transition between behaviors was used to statistically modify the predicted output sequences from the classifier. Using 51 h of behavior-labelled validation data we report a significant mean improvement in the classification of grazing, resting and walking behaviors of Holstein dairy cattle (overall classification accuracy = 0.85 (CI = 0.83–0.87) vs. 0.94 (CI = 0.92–0.95)) for the classifier alone and after the application of the hidden Markov model to the predicted behaviors respectively. To further test our combined models, buffer fed, healthy, early lactation (mean ± SD; 43 ± 20.9 DIM) primiparous (n = 12) and multiparous (n = 12) pasture-based Holstein dairy cattle were fitted with a GlobalSat® DG-100 GPS and monitored every other day for 10 days for the proportion of time spent grazing, resting and walking. Over the 10-day observation period, the predicted mean daily duration of grazing, resting and walking for primiparous cows was 344.86 min (CI = 319.04–370.68), 752.99 min (CI = 725.25–780.74) and 42.15 min (CI = 31.35–52.95) respectively. Multiparous cows were predicted to spend on average 392.33 min (CI = 366.51–418.16) grazing, 714.19 min (CI = 686.45–741.94) resting and 33.48 min (CI = 22.68–44.28) walking. These results corroborate other studies that have measured the activity of pasture based-dairy cows and provide confidence in the predictive ability of the combined models


  • dairy cattle, hidden markov model, automated measures, classification, transition detection