DOI: 10.3390/ani16132022 ISSN: 2076-2615

Behavior Classification of Cattle in a Virtual Fencing System Using Tri-Axial Accelerometers and Machine Learning

Silje Marquardsen Lund, Cino Pertoldi, John Frikke, Christian Sonne, Aage Kristian Olsen Alstrup

Virtual fencing is increasingly used in grazing systems as a flexible alternative to physical fencing, yet detailed assessments of cattle behavior within such systems remain limited. This study investigates the use of collar-mounted tri-axial accelerometers combined with supervised machine learning to characterize cattle behavior in a virtual fencing system. Seven free-ranging Angus cattle were monitored using accelerometers mounted on a virtual fencing system, GNSS positioning, and virtual fence warning logs. A random forest classifier was developed and trained to identify key behaviors (grazing/feeding, ruminating, lying, standing and locomotion) using features derived from tri-axial accelerometer data. The model achieved high classification performance for grazing/feeding, ruminating, and lying (mean accuracy = 0.87, range = 0.83–0.90), enabling estimation of individual behavioral time budgets. Daily activity patterns were generally stable over time and across individuals. Spatial analyses revealed significant differences in behavior between areas near the virtual fence boundary and interior pasture locations, with increased grazing and reduced ruminating near the boundary, potentially reflecting spatial variation in habitat type or forage availability. In the virtual fencing system, cattle are equipped with collars that emit an auditory warning when they approach a virtual boundary, followed by a low-energy electrical impulse when the warning is ignored over a directional distance of 5–10 m. Event-based analyses showed no consistent short-term changes in either movement intensity and direction nor locomotion following auditory warning events, indicating that cattle habituated to the system did not exhibit uniform behavioral disturbance in response to warnings. These results suggest that accelerometer-based behavior classification can provide fine-scale, non-invasive insights into spatio-temporal cattle behavior in virtual fencing systems. The finding indicates that, in a habituated herd, virtual fencing was not associated with pronounced disruption to the measured behavioral patterns, while highlighting the potential of embedded sensor data for animal-based behavioral monitoring.

More from our Archive