ApexID: Hierarchical Learning for Multi-Species Animal Re-Identification

Seifeldin Elkerdany, Mohamed ElBassat, Gamal Abouelhamd, Assem Elkady, Jana Ghoneim, Matin Mahmood, Abigail Allen Martin, Gerard de Melo, Antonio Rueda-ToicenarXiv 2026

Imagine you’re a field biologist trying to track a specific jaguar across the vast Pantanal wetlands. You have thousands of camera trap photos, but the lighting changes, the jaguar is lounging in one shot and sprinting in the next, and—to make matters worse—your AI model keeps getting confused by the spots on a nearby leopard.

This is the "Animal Re-Identification" (Re-ID) problem. It’s not just about saying "that’s a jaguar"; it’s about saying "that’s specifically Jaguar ID #42." A new paper titled ApexID tackles this challenge by teaching AI to think hierarchically, much like a human expert would.

TL;DR

ApexID is a hierarchical learning framework that improves individual animal identification across multiple species. By simultaneously training a model to recognize broad categories (like "whale" or "turtle") and specific individuals, the researchers created a system that generalizes better to new species and environments than previous state-of-the-art models.

What Problem Does This Paper Address?

Most computer vision models for animal Re-ID are specialists—they are trained on one dataset for one specific species. When you try to use a "zebra model" on a "giraffe dataset," performance usually tanks.

Furthermore, standard models often fall into the "Clever Hans" trap: they learn to identify an individual based on the background (e.g., a specific rock or tree) rather than the animal itself. To solve this, we need models that:

  1. Generalize: Work across different species, even those not seen during training.
  2. Focus: Ignore the background and focus on the subtle, unique markings of the animal's body.
  3. Structure: Understand that identities belong to broader categories, which helps organize the "embedding space" (the mathematical map where the AI stores features).

Methods

The researchers introduced the ApexID Hierarchical Loss, a two-pronged mathematical objective used during training.

Figure 1. The encoder produces one normalized embedding per image. The global identity loss compares it with every training identity using learned identity sub-centers. A separate category prediction head uses learned category proxies and balanced supervision, assigning greater weight to categories with fewer training identities.
  • Global Identity Discrimination: Based on SphereFace2, this part of the loss teaches the model to separate individuals in a high-dimensional space. They use "sub-centers"—multiple mathematical "anchors" for a single individual—to account for the fact that an animal looks different from the side than from the front.
  • Balanced Category Supervision: This adds a second layer of "parent" labels. The model is penalized if it can't correctly identify the broad category (e.g., "Zebra"). Crucially, they use a weighting system so that common animals in the dataset don't drown out the rare ones.
  • Foreground Curation: Before training, they used the Segment Anything Model (SAM) to strip away backgrounds, forcing the AI to look only at the animal's fur, skin, or scales.

Datasets

The authors didn't just write code; they did a massive amount of data "gardening." They curated 132,533 images from 19 different public datasets, harmonizing labels for species ranging from sea turtles to chimpanzees.

For evaluation, they tested the models on four "external" datasets that the AI never saw during training:

  • ELPephants: African forest elephants.
  • GCN-ID: Great crested newts.
  • Bristol Gorillas: Western lowland gorillas.
  • Private Jaguar Data: Jaguars from the Pantanal.

Key Insights and Ideas

  • The Elephant in the Room: One of the most striking findings was that the model performed exceptionally well on elephants, even though no elephants were included in the training data. This suggests that by learning the "hierarchy" of other animals, the model developed a general sense of what makes any individual animal unique.
  • Hierarchy as a Regularizer: Teaching the model the species category acts as a guide. It prevents the model from "overfitting" on weird quirks of a single dataset and encourages it to learn features that are biologically meaningful.
  • Backbone Flexibility: The ApexID loss isn't tied to one specific neural network. They proved it works whether you're using a modern ConvNeXt architecture or fine-tuning existing specialized wildlife models like MIEW-ID.

Key Results

The results show a clear step up from previous benchmarks. When using a ConvNeXt-Small backbone, ApexID achieved a Rank-1 accuracy of 64.89% across the four test datasets.

Comparison of different loss functions across three backbones. ApexID consistently takes the lead.

In the world of Re-ID, "Rank-1" means the very first image the AI suggested was indeed the correct individual. Outperforming established models like MegaDescriptor-L (which is nearly four times larger in terms of parameters) proves that how you train (the loss function) can be more important than just having a bigger model.

Limitations and Future Work

While ApexID is a leap forward, the "Open-Set" problem remains a tough nut to crack. In a real-world scenario, a camera trap will often see a "novel" individual—one the model has never seen before. While ApexID is great at matching known individuals, perfectly clustering and discovering entirely new individuals in the wild is still a work in progress.

The authors also noted that their "categories" are quite broad. Future versions might benefit from a deeper taxonomic hierarchy (Family -> Genus -> Species) to provide even more granular guidance to the learning process.

Summary updated

Abstract

Animal re-identification (Re-ID) must distinguish individuals across species and capture conditions. We introduce ApexID, a hierarchical SphereFace2-based loss that integrates global identity discrimination with balanced animal-category supervision. Using 132,533 images curated from 19 public datasets, we evaluate three model families and four objectives on four external datasets with observation-aware retrieval protocols. ApexID achieves a dataset-averaged Rank-1 accuracy of 64.89% with ConvNeXt-Small and an mAP of 32.54% with MIEW-ID, outperforming their pretrained reference models. On elephants, a category absent from animal Re-ID training, our ConvNeXt-Small variant achieves the highest retrieval performance among the fourteen evaluated configurations. Scores vary by backbone and dataset, and open-set evaluation reveals remaining discovery challenges. These findings support hierarchical category-identity learning to improve transfer to unseen datasets and species.
BibTeX
@misc{elkerdany2026apexid,
  author = {Seifeldin Elkerdany and Mohamed ElBassat and Gamal Abouelhamd and Assem Elkady and Jana Ghoneim and Matin Mahmood and Abigail Allen Martin and Gerard de Melo and Antonio Rueda-Toicen},
  title = {{ApexID: Hierarchical Learning for Multi-Species Animal Re-Identification}},
  year = {2026},
  eprint = {2611.29723},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.29723},
}
Figure