Source-linked AI summary

Visual Identification of Individual Holstein-Friesian Cattle via Deep Metric Learning

William Andrew, Jing Gao, Siobhan Mullan, Neill Campbell, Andrew W Dowsey, Tilo Burghardt

arXiv:2006.09205v3cs.CV

TL;DR

The paper addresses the need to identify and monitor cattle without physical identifiers or retraining when new animals enter a herd. It proposes a complete coat-pattern-based detection and metric-learning pipeline, achieving 93.75% average accuracy in open-set experiments. The approach performs without re-enrolment of individuals or re-training of the system.

  • Problem

    Existing closed-set systems require imagery and manual identification of all animals before training, followed by labour-intensive data gathering and retraining when populations change.

  • Method

    The paper proposes a complete pipeline that detects cattle, embeds coat-pattern regions, and uses SoftMax-based reciprocal triplet loss for open-set identification.

  • Results

    93.75% average accuracy was observed in extensive open-set recognition experiments using reciprocal triplet loss.

  • Takeaways & Limitations

    The complete pipeline performs without re-enrolment of individuals or re-training of the system.

  • Takeaways & Limitations

    The closed-set baseline requires manually annotated and identified imagery of all animals before system training.

Abstract

from arXiv · show

Holstein-Friesian cattle exhibit individually-characteristic black and white coat patterns visually akin to those arising from Turing's reaction-diffusion systems. This work takes advantage of these natural markings in order to automate visual detection and biometric identification of individual Holstein-Friesians via convolutional neural networks and deep metric learning techniques. Existing approaches rely on markings, tags or wearables with a variety of maintenance requirements, whereas we present a totally hands-off method for the automated detection, localisation, and identification of individual animals from overhead imaging in an open herd setting, i.e. where new additions to the herd are identified without re-training. We propose the use of SoftMax-based reciprocal triplet loss to address the identification problem and evaluate the techniques in detail against fixed herd paradigms. We find that deep metric learning systems show strong performance even when many cattle unseen during system training are to be identified and re-identified -- achieving 93.8% accuracy when trained on just half of the population. This work paves the way for facilitating the non-intrusive monitoring of cattle applicable to precision farming and surveillance for automated productivity, health and welfare monitoring, and to veterinary research such as behavioural analysis, disease outbreak tracing, and more. Key parts of the source code, network weights and datasets are available publicly.

1. Introduction

The introduction motivates hands-off visual identification of Holstein-Friesian cattle from their natural coat patterns. It frames open-set recognition as a way to identify new animals without retraining while supporting continuous herd monitoring.

  • Holstein-Friesian cattle are widespread and have individually characteristic patterned coats that can support visual identification.
  • Existing livestock traceability commonly relies on ear tags, injectable transponders, branding, tattoos, or collars.
  • These physical identifiers cannot provide continuous localisation and raise concerns about maintenance, welfare, longevity, reliability, and permanent damage.
  • The proposed alternative uses natural coat-pattern features with imagery from UAVs or low-cost static cameras for non-intrusive visual identification.
  • The pipeline detects cattle regions of interest, embeds them in a learned latent identity space, and classifies identities with lightweight methods such as k-nearest neighbours.
  • Open-set recognition targets cattle never seen during training without further retraining, avoiding the labour-intensive annotation and retraining required by closed-set systems.

2. Related Work

Related work covers cattle biometrics, overhead computer vision, object detection, and open-set recognition. The paper builds on these areas by learning discriminative embeddings from coat patterns for unseen-animal recognition.

  • Cattle biometrics: Earlier cattle biometrics used muzzle, retinal, facial, or body features, but several approaches require constrained views or specialised imaging.
  • Cattle biometrics: Prior computer-vision work used convolutional networks and full-body dorsal coat features for cattle identification.
  • Overhead imaging: Overhead imagery from static cameras or UAVs offers a non-intrusive, consistent viewpoint with reduced occlusion concerns.
  • Object detection: The proposed detector uses a RetinaNet architecture, representing a one-stage object-detection approach.
  • Open-set recognition: Open-set recognition methods include statistical models, support-vector machines, autoencoders, open-set losses, and counterfactual data generation.
  • Open-set recognition: This work learns an embedding intended to generalise visual uniqueness beyond the training herd and separate unseen individuals in latent space.

3. Dataset: OpenCows2020

OpenCows2020 is a publicly available dataset combining indoor and outdoor top-down cattle imagery for breed-wide detection, localisation, and open-set individual identification. Its identification subset spans 46 individuals while retaining substantial variation in acquisition conditions and class sizes.

  • Dataset composition: OpenCows2020 combines indoor static-camera footage with outdoor UAV imagery and is publicly available.The dataset brings together multiple previous works and sources.
  • Detection and localisation: The detection component contains 3,707 images with 6,917 manually annotated cattle regions.Annotations enclose each animal’s torso while excluding the head, neck, legs, and tail.
  • Detection and localisation: Detection data are split into 10 shuffled folds using an 8:1:1 training, validation, and testing ratio.The data include varied object sizes and counts across sources, with UAV footage containing more small, distant cattle.
  • Identification: The identification subset retains individuals with at least 20 instances, yielding 46 individuals, 4,736 regions, and an average of 103 instances per class.Each class has 10 testing instances; remaining instances are split 9:1 between training and validation.
  • Identification: Identification instances span different coat patterns, acquisition sources, backgrounds, environments, and illumination conditions, with class imbalance across sources and individuals.Figure 6 provides one example from each individual, while Figure 7 shows the instance distribution per class.

4. Cattle Detection

The cattle-detection stage uses a breed-wide object detector to localise every cow torso in overhead imagery. RetinaNet combines focal classification loss with Smooth L1 localisation loss, and the evaluated detectors achieve near-perfect performance for this application while retaining identifiable failure modes in crowded or boundary cases.

  • Detection objective: The first pipeline stage automatically detects and localises Holstein-Friesian cattle, outputting bounding-box coordinates and confidence scores for cow torsos.The detector is intended to be generic across the breed rather than tied to individual animals.
  • RetinaNet architecture: RetinaNet uses separate classification and bounding-box regression sub-networks on backbone features.Focal loss handles binary cattle-versus-background classification, while regression predicts offsets between anchor and ground-truth boxes.
  • Detection loss: The detector minimises a combined Smooth L1 and focal loss for localisation and classification.The focal-loss formulation prioritises positive and difficult samples through a modulating factor and class-balancing parameter.
  • Results: All evaluated methods achieve near-perfect detection performance and are suitable for the application.The comparison includes RetinaNet, YOLOv3, and Faster R-CNN.
  • Failure modes: Detection failures arise mainly from image boundaries, closely spaced cattle, non-maximum suppression, and limitations of orthogonal bounding boxes.The testing NMS threshold is 0.28; closer cattle produce more overlapping boxes, increasing the chance that one prediction is removed.

5. Open-Set Individual Identification via Metric Learning

The section develops metric-learning embeddings that cluster images of the same cattle individual while separating different individuals, enabling open-set identification without retraining a closed-set classifier. It compares triplet-based losses and proposes combining SoftMax supervision with reciprocal triplet loss.

  • Open-set identification: Open-set identification avoids manually labelling new individuals and fully retraining a closed-set classifier.The intended setting includes both seen and unseen cattle individuals.
  • Metric-space identification: Metric learning maps cattle images into a class-distinctive latent space where distances encode input similarity and same-individual images cluster together.A lightweight clustering method such as k-NN can then represent individuals in the latent space.
  • Triplet loss: Triplet loss pulls an anchor toward a positive example from the same class and pushes it away from a negative example from a different class.The formulation uses embeddings of an anchor, positive, and negative image input.
  • Triplet loss: The margin α can be satisfied at any distance from the anchor, causing training issues and motivating reciprocal triplet loss, which removes the margin hyperparameter.The section identifies this as a limitation of the standard triplet-loss formulation.
  • Combined loss: The proposed SoftMax-based reciprocal triplet loss combines fully supervised SoftMax learning with reciprocal triplet loss in a novel formulation.The combined loss is presented as LSoftMax+RTL = LSoftMax + λ · LRTL, with the component losses defined separately.

6. Experiments

The experiments evaluate embedding spaces for open-set Holstein-Friesian identification after cattle regions have been detected, varying how many identity classes are withheld from training. Embedding-based methods substantially outperform a closed-set SoftMax baseline and generalize to unseen cattle, with reciprocal triplet loss performing slightly better across the task.

  • Experimental design: The experiments compare triplet-loss functions for open-set Holstein-Friesian identification and assess whether their embedding spaces support the task.The evaluation assumes that an earlier pipeline stage has detected cattle and extracted good-quality regions of interest.
  • Experimental design: The study withholds identity classes entirely from training, varying the unknown-class ratio from 0.1 to 0.9 across repeated random splits.Ten repetitions are generated at each ratio to characterize performance as the identification problem becomes more open.
  • Quantitative results: Embedding-based methods substantially outperform the closed-set SoftMax baseline as the identification problem becomes more open.The closed-set baseline cannot generalize to unseen classes by design, whereas embedding methods can.
  • Error analysis: Identification errors show no tendency to originate from unknown identities or a particular image source, while animals with fewer instances account for a slightly higher error proportion.The dataset contains 46 individuals, and the results are illustrated in Figure 13.
  • Quantitative results: The reciprocal triplet loss performs slightly better across the learning task than the original triplet loss, supporting its use for this identification problem.The authors report that the results are consistent across the employed loss functions and recommend RTL for the task.
  • Qualitative analysis: Training on half the identity classes produces an embedding that can accommodate and cluster previously unseen cattle identities.Triplet-loss embeddings cluster like-identities and separate others sufficiently to re-identify testing identities never seen during training.

7. Conclusion

The work presents a complete pipeline for detecting and identifying individual Holstein-Friesian cattle in changing, agriculturally relevant herds. Open-set experiments show that embeddings trained with relatively few individuals can generalise to unseen cattle, while deployment does not require re-enrolment or system retraining as populations change.

  • Pipeline and scope: The pipeline targets non-intrusive detection and identification of both seen and previously unseen Holstein-Friesian cattle.It is intended for agriculturally relevant scenarios where herd composition changes over time.
  • Open-set recognition: Few instances were needed to construct an embedding space that generalised from image regions of interest to identity clusters for unseen cattle.The conclusion describes this as a robust embedding space learned through extensive open-set experiments.
  • Applications: The approach is positioned as a viable step toward automated cattle detection and identification for precision farming, disease detection, and welfare monitoring.The paper connects individual monitoring with management decisions involving disease prevention, fertility, feeding, and welfare.
  • Deployment: The identification component can be trained at deployment and operate without re-enrolment or system retraining as the population changes.This property is presented as important for transferability in practical settings.
  • Future work: Future work will test robustness under heavy cattle bunching, scalability to larger populations, video tracking, and additional depth imagery.The conclusion also identifies collision, behaviour, health, and welfare analysis as further goals.
Loading 2006.09205v3…