Self-Supervised Animal Identification for Long Videos
Xuyang Fang, Sion Hannuna, Edwin Simpson, Neill Campbell
TL;DR
This work tackles identifying individual animals in long videos under a practical constraint: a known, fixed number of individuals. It reframes the problem as global clustering and introduces a memory-efficient self-supervised pipeline that uses frame-pair sampling, a frozen backbone, and in-batch pseudo-labels via the Hungarian algorithm, followed by $K$-means clustering at inference. The BCE loss (with a learnable temperature) often outperforms supervised contrastive losses, achieving state-of-the-art accuracy (>97%) on real-world datasets while consuming under 1 GB per training batch, significantly reducing the labeling burden. The approach eliminates error-propagation issues of sequential trackers and demonstrates practical applicability on resource-constrained hardware, with strong ablations showing robustness to backbone choice and memory-saving strategies.
Abstract
Identifying individual animals in long-duration videos is essential for behavioral ecology, wildlife monitoring, and livestock management. Traditional methods require extensive manual annotation, while existing self-supervised approaches are computationally demanding and ill-suited for long sequences due to memory constraints and temporal error propagation. We introduce a highly efficient, self-supervised method that reframes animal identification as a global clustering task rather than a sequential tracking problem. Our approach assumes a known, fixed number of individuals within a single video -- a common scenario in practice -- and requires only bounding box detections and the total count. By sampling pairs of frames, using a frozen pre-trained backbone, and employing a self-bootstrapping mechanism with the Hungarian algorithm for in-batch pseudo-label assignment, our method learns discriminative features without identity labels. We adapt a Binary Cross Entropy loss from vision-language models, enabling state-of-the-art accuracy ($>$97\%) while consuming less than 1 GB of GPU memory per batch -- an order of magnitude less than standard contrastive methods. Evaluated on challenging real-world datasets (3D-POP pigeons and 8-calves feeding videos), our framework matches or surpasses supervised baselines trained on over 1,000 labeled frames, effectively removing the manual annotation bottleneck. This work enables practical, high-accuracy animal identification on consumer-grade hardware, with broad applicability in resource-constrained research settings. All code written for this paper are \href{https://huggingface.co/datasets/tonyFang04/8-calves}{here}.
