Automated Re-Identification of Holstein-Friesian Cattle in Dense Crowds
Phoenix Yu, Tilo Burghardt, Andrew W Dowsey, Neill W Campbell
TL;DR
This work tackles the challenge of re-identifying Holstein-Friesian cattle in densely packed groups where traditional detectors fail due to dazzle patterns. It introduces a two-stage detect-segment-identify pipeline that combines OWLv2 for open-vocabulary localisation with SAM2 for instance segmentation, followed by unsupervised contrastive learning to enable Re-ID without manual labeling. On nine days of farm CCTV data, the approach achieves up to 98.93% localisation accuracy and 94.82% Re-ID accuracy, substantially outperforming baseline bounding-box and SAM-based detectors. The method is training-free and transferable across cameras and farms, with code and data released for reproducibility, highlighting the practical potential of automated, labeling-free livestock surveillance in real-world settings.
Abstract
Holstein-Friesian detection and re-identification (Re-ID) methods capture individuals well when targets are spatially separate. However, existing approaches, including YOLO-based species detection, break down when cows group closely together. This is particularly prevalent for species which have outline-breaking coat patterns. To boost both effectiveness and transferability in this setting, we propose a new detect-segment-identify pipeline that leverages the Open-Vocabulary Weight-free Localisation and the Segment Anything models as pre-processing stages alongside Re-ID networks. To evaluate our approach, we publish a collection of nine days CCTV data filmed on a working dairy farm. Our methodology overcomes detection breakdown in dense animal groupings, resulting in a 98.93% accuracy. This significantly outperforms current oriented bounding box-driven, as well as SAM species detection baselines with accuracy improvements of 47.52% and 27.13%, respectively. We show that unsupervised contrastive learning can build on this to yield 94.82% Re-ID accuracy on our test data. Our work demonstrates that Re-ID in crowded scenarios is both practical as well as reliable in working farm settings with no manual intervention. Code and dataset are provided for reproducibility.
