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

Media reports Hugging Face Papers Source language: Chinese

ApexID’s hierarchical loss yields 64.89% Rank‑1 accuracy on 132k images, improving cross‑species animal re‑identification.

Full text

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

Seifeldin Elkerdany Email: seifeldean.hosny.2024@aiu.edu.eg Mohamed ElBassat Affiliation: Made In Alexandria AI Team (M.I.A Robotics) Alamein International University Alexandria University Email: cds.MohamedMohamed24510@alexu.edu.eg Gamal Abouelhamd Assem Elkady Affiliation: Made In Alexandria AI Team (M.I.A Robotics) Alamein International University Alexandria University Jana Ghoneim Affiliation: Made In Alexandria AI Team (M.I.A Robotics) Alamein International University Alexandria University Matin Mahmood Abigail Allen Martin Gerard de Melo Affiliation: hyperlabs Universidade Federal de Mato Grosso Hasso Plattner Institute*Equal contribution †Corresponding authors Antonio Rueda-Toicen Affiliation: hyperlabs Universidade Federal de Mato Grosso Hasso Plattner Institute*Equal contribution †Corresponding authors

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. Code, weights, and data splits are available in our GitHub repository.

1 Introduction

Individual animal re-identification (Re-ID) supports non-invasive population monitoring, movement analysis, and behavioral research by matching individuals across sightings [43, 13]. Reliable matching must preserve subtle individual cues despite changes in pose, viewpoint, illumination, and time. A representation shared across animal categories must also accommodate broad appearance differences while distinguishing individuals within each category.

Standard identity-only objectives do not explicitly model the category–identity relationships present in multi-species annotations. Meanwhile, backgrounds and acquisition conditions may correlate with identity or dataset, creating contextual cues that may not persist across sightings. These challenges motivate category-aware identity learning from curated animal foregrounds.

We introduce ApexID, a multi-species animal Re-ID approach that maps curated animal foregrounds into a shared embedding space. We train its encoders with the ApexID Hierarchical Loss, a two-level category–identity objective based on SphereFace2 [46]. The loss combines global identity discrimination over learnable identity sub-centers with balanced category supervision. For hierarchical supervision, an identity’s parent is a broad animal category, such as whale. Once the foregrounds have been extracted, closed-set retrieval ranks gallery images by cosine similarity between normalized embeddings alone.

We harmonize animal category labels across 19 public datasets, apply dataset-specific near-duplicate filtering within identities, and segment the animal foregrounds. We manually review the images, create or correct masks where needed, and retain 132,533 images for training and validation.

We compare four objectives on three backbones and include two unmodified animal Re-ID checkpoints as references. Across four external datasets, ConvNeXt-Small trained with our loss achieves the highest dataset-macro Rank-1 accuracy (64.89%) among the 14 configurations and a dataset-macro mean average precision (mAP) of 30.84%. Both scores exceed those of the unmodified MIEW-ID v3 and MegaDescriptor-L checkpoints. MIEW-ID v3 fine-tuned with our loss achieves the highest dataset-macro mAP (32.54%), compared with 31.89% for the same backbone fine-tuned with SphereFace2. Gains vary by backbone and dataset. We also evaluate the embeddings in a separate, dataset-adapted open-set protocol that uses calibrated similarities to associate queries with known identities and group observations of novel individuals.

Our contributions are threefold:

•

ApexID models for multi-species Re-ID. We fine-tune ImageNet-pretrained ConvNeXt-Small and two animal Re-ID encoders, MIEW-ID v3 and MegaDescriptor-L, on curated foregrounds using the proposed loss.

•

A hierarchical category–identity objective. ApexID Hierarchical Loss augments global identity discrimination with balanced category-level supervision through a separate learned proxy for each animal category.

•

A curated multi-source dataset. We harmonize annotations from 19 public datasets, remove unusable images, and retain 13,348 source-specific identities. We retain the source dataset and observation-group identifier for each image. Motivated by prior work on time- and similarity-aware splitting [1], we assign each observation group wholly to either training or validation.

2 Related Work

Shared animal Re-ID representations.

WildlifeDatasets introduced MegaDescriptor and a unified framework for learning across heterogeneous wildlife datasets [13]. MIEW-ID studies multi-species animal Re-ID [32], while OpenAnimals investigates the transfer of person Re-ID techniques to animals [24]. We evaluate category-aware supervision across MIEW-ID v3, MegaDescriptor-L, and ImageNet-pretrained ConvNeXt-Small.

Recognition objectives.

ArcFace applies a fixed additive angular margin to the target class [16], while Dynamic ArcFace adapts this margin during training [26]. Sub-center ArcFace represents each identity with multiple learned centers [17], and SphereFace2 trains one binary classifier per identity [46]. Yang et al. [47] construct coarse proxies by clustering class proxies and also evaluate a hierarchy defined by annotations. The ApexID Hierarchical Loss uses the annotated animal category as an additional prediction target, with one learned proxy per category, alongside sub-center SphereFace2 identity discrimination.

Foregrounds and observation-aware evaluation.

Rueda-Toicen et al. [40] examine background reliance and laterality in jaguar Re-ID, illustrating why retrieval scores alone do not identify the visual evidence driving a match. ApexID applies foreground processing across multiple animal categories. WildlifeReID-10k uses timestamps when available and visual similarity otherwise to reduce overlap between partitions [1]. We follow this principle by keeping observation groups intact in both training–validation and closed-set gallery–query splits. For our separate batch open-set analysis, we adapt the calibrated similarity and graph clustering used by ElBassat et al. [19] in their AnimalCLEF 2026 system.

3 Dataset Construction and Handling

3.1 Sources and Scope

ApexID combines 19 public animal Re-ID datasets that vary in annotation, image quality, and observation metadata. For each image, we retain its source dataset, animal category, individual identity, and observation group. Each individual is identified by the combination of its source dataset and its local identity label. Animal categories represent broad categories shared across the datasets.

Table 1 summarizes the curated corpus, and Supplementary Table 6 lists all sources.

Table 1: Primary ApexID training and validation partitions. Identities are counted within each source dataset. Known-validation identities also appear in training through different observation groups.

Partition Images Identities

Training 90,921 11,677

Known-identity validation 28,070 10,768

Held-out-identity validation 13,542 1,671

Total (unique) 132,533 13,348

The primary partitions contain 96,435 observation groups. Within each source-specific identity, these groups are constructed from capture dates, verified filename or session information, or visual similarity, depending on the metadata available. Together, the two validation partitions contain 41,612 images across 12,439 identities. We exclude all four external evaluation datasets from ApexID training and checkpoint selection. Sec. 5.1 describes their roles in closed-set retrieval and dataset-adapted open-set evaluation.

3.2 Preprocessing and Curation

Before segmentation and partitioning, we use MegaDescriptor embeddings [13] to filter near-duplicates in the datasets. We compare images only within the same source-specific identity and use a dataset-specific cosine-similarity threshold.

We segment images with Segment Anything Model 3 (SAM 3) [12] using an animal-category text prompt. We retain the highest-confidence valid animal mask and set the pixels outside it to black. Using V-Rush [18], we manually review images for poor quality, segmentation failures, and annotation inconsistencies. We generate or refine incomplete masks with bounding-box-prompted MobileSAM [49] and correct them with a manual brush. We exclude samples whose identity annotations remain unresolved. Counts are computed after curation; additional procedural details appear in Supplementary Sec. A.

3.3 Observation-Aware Partitioning

Following observation-aware evaluation [1], we keep each observation group in a single partition. Within each source dataset, an identity is eligible for the split if at least two images are labeled as the same identified animal. Using seed 42, we select approximately 12.5% of these identities for held-out-identity validation and exclude all their images from training.

For each eligible identity outside the holdout, we target 22.5% of its images for known-identity validation while retaining at least one training group. If all images are dated and span at least two days, we choose the cutoff that keeps groups intact and comes closest to the target, assigning earlier groups to training and later groups to validation. Otherwise, if verified filename or session information groups all images into at least two groups, we deterministically select whole groups for validation.

If neither rule applies, we group images separately for each animal. Two images go in the same group if they are exact copies, share a recorded capture date, come from the same verified capture sequence, or have a high DINOv2 similarity score [31]. All groups with two or more images go to training. We select validation images from the single-image groups and use the rest for training. See Supplementary Sec. A.1 for details.

4 Method

We present ApexID, a multi-species animal re-identification approach that learns a shared identity-discriminative embedding from heterogeneous wildlife datasets. Its hierarchical objective combines global identity discrimination with balanced animal-category supervision, encouraging identity-level feature learning while incorporating category-level information.

4.1 Problem Formulation

Training labels.

Our training set is 𝒟tr={(xi,yi,si)}i=1N\mathcal{D}_{\mathrm{tr}}=\{(x_{i},y_{i},s_{i})\}_{i=1}^{N}. Each of the NN images xix_{i} depicts one of CC training individuals. Its identity yi∈{1,…,C}y_{i}\in\{1,\ldots,C\} is defined by its source dataset and local identity label. Each image is also assigned an animal category label si∈{1,…,S}s_{i}\in\{1,\ldots,S\} when available. The observed categories include both species-specific labels and broader animal categories, such as whale. We write si=⊥s_{i}=\bot when the image lacks a usable category label.

For each training identity jj, we obtain its parent category h⁡(j)h(j) from the images of that individual. We reject conflicting category annotations. For each observed category ss, we define its set of training identities ℐs\mathcal{I}_{s} and their number nsn_{s} as

ℐs={j:h⁡(j)=s},ns=|ℐs|.\mathcal{I}_{s}=\{j:h(j)=s\},\qquad n_{s}=|\mathcal{I}_{s}|. (1)

Retrieval.

The encoder fθf_{\theta} maps a preprocessed image x∈𝒳x\in\mathcal{X} to a DD-dimensional vector. Here θ\theta denotes the learned encoder parameters. We scale each vector to unit length to obtain the embedding

𝐳⁡(x)=fθ​(x)‖fθ​(x)‖2,𝐳i=𝐳⁡(xi).\mathbf{z}(x)=\frac{f_{\theta}(x)}{\|f_{\theta}(x)\|_{2}},\qquad\mathbf{z}_{i}=\mathbf{z}(x_{i}). (2)

Given a query image xqx_{q}, we rank the MM labeled reference images in the gallery 𝒢={(xg,yg)}g=1M\mathcal{G}=\{(x_{g},y_{g})\}_{g=1}^{M}. We rank the gallery images from highest to lowest similarity. For unit-length embeddings, this is their dot product,

sim⁡(xq,xg)=𝐳​(xq)⊤​𝐳​(xg).\operatorname{sim}(x_{q},x_{g})=\mathbf{z}(x_{q})^{\top}\mathbf{z}(x_{g}). (3)

4.2 Model Architecture

We train each backbone separately and use the same encoder for all animal categories within a model. For ImageNet-pretrained ConvNeXt-Small [28], we replace the final classification layer with a learned linear projection to D=2048D=2048. For the two encoders pretrained on animal Re-ID, we use their native embeddings directly. The embedding dimension is 21522152 for MIEW-ID v3 [32] and 15361536 for MegaDescriptor-L [13].

When training with our loss, we attach two heads to the normalized embedding. The identity head represents each training individual with KK learned reference vectors (proxies), called sub-centers. The category head uses one learned reference vector per category. At inference, we keep the encoder and discard both training heads.

4.3 ApexID Hierarchical Loss

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.
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.

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.

We build on SphereFace2 [46] and hierarchical proxy-based metric learning [47]. As shown in Fig. 1, the loss combines global identity discrimination (ℒG\mathcal{L}_{\mathrm{G}}) and category prediction (ℒSP\mathcal{L}_{\mathrm{SP}}) in a single objective,

ℒAH=ℒG+λSP​ℒSP.\boxed{\mathcal{L}_{\mathrm{AH}}=\mathcal{L}_{\mathrm{G}}+\lambda_{\mathrm{SP}}\mathcal{L}_{\mathrm{SP}}.} (4)

The nonnegative coefficient λSP\lambda_{\mathrm{SP}} controls the contribution of the category prediction task relative to global identity discrimination.

In our experiments, all BB images in a batch have category labels, so every image contributes to both the global identity loss and the category prediction loss. Accordingly, the set of valid samples for both objectives is 𝒱={1,…,B}\mathcal{V}=\{1,\ldots,B\}.

Shared identity scores.

For image ii, we compare its embedding 𝐳i\mathbf{z}_{i} with the KK sub-centers of each training identity jj. The largest cosine similarity gives the score

ci​j=max1≤k≤K⁡𝐳i⊤​𝐰^j,k.c_{ij}=\max_{1\leq k\leq K}\mathbf{z}_{i}^{\top}\widehat{\mathbf{w}}_{j,k}. (5)

Here 𝐰j,k\mathbf{w}_{j,k} is the kkth sub-center of identity jj, and a hat denotes a vector scaled to unit length. Different photos of the same individual can therefore match different sub-centers.

For image ii and training identity jj, ci​jc_{ij} is the cosine similarity to the closest sub-center of identity jj (Eq. (5)). Following SphereFace2-A [46, App. F], we convert this similarity to an angle θi​j=arccos⁡(ci​j)\theta_{ij}=\arccos(c_{ij}). We then add an angular margin mIDm_{\mathrm{ID}}, measured in radians, only when jj is the image’s true identity yiy_{i}. The adjusted angle is

θ~i​j={θi​j+mID,j=yi,θi​j,j≠yi.\tilde{\theta}_{ij}=\begin{cases}\theta_{ij}+m_{\mathrm{ID}},&j=y_{i},\\ \theta_{ij},&j\neq y_{i}.\end{cases}

Using the adjusted angle, we compute the training score, or logit, for identity jj as

ai​j=r​gt​(cos⁡θ~i​j)+b,gt​(u)=2​(1+u2)t−1.a_{ij}=r\,g_{t}(\cos\tilde{\theta}_{ij})+b,\qquad g_{t}(u)=2\left(\frac{1+u}{2}\right)^{t}-1. (6)

The exponent t>0t>0 controls how the cosine similarity is transformed, r>0r>0 scales the result, and bb is a learned bias shared by all identities.

Global identity discrimination.

Each image has one true identity and C−1C-1 other training identities. For the true identity, the penalty ℓi+\ell_{i}^{+} decreases as its score rises. For any other identity jj, the penalty ℓi​j−\ell_{ij}^{-} decreases as its score falls. These penalties are

ℓi+=log⁡(1+e−ai​yi),ℓi​j−=log⁡(1+eai​j).\ell_{i}^{+}=\log(1+e^{-a_{iy_{i}}}),\qquad\ell_{ij}^{-}=\log(1+e^{a_{ij}}).

We sum the penalties for each image and average over the batch to obtain

ℒG=ηr​B​∑i=1B[α​ℓi++(1−α)​∑j≠yiℓi​j−].\mathcal{L}_{\mathrm{G}}=\frac{\eta}{rB}\sum_{i=1}^{B}\left[\alpha\ell_{i}^{+}+(1-\alpha)\sum_{j\neq y_{i}}\ell_{ij}^{-}\right]. (7)

The coefficient α∈(0,1)\alpha\in(0,1) weights the true-identity penalty, 1−α1-\alpha weights each negative penalty, and η>0\eta>0 scales both identity losses.

Balanced category supervision.

For an image with a category label, we ask the model to predict that category. Each category ss has its own learned proxy 𝐯s\mathbf{v}_{s}. Its cosine similarity to the image is qi​s=𝐳i⊤​𝐯^sq_{is}=\mathbf{z}_{i}^{\top}\widehat{\mathbf{v}}_{s}. We apply an ArcFace-style angular margin [16] only to the score for the true category. With margin mSPm_{\mathrm{SP}} in radians and score scale γ>0\gamma>0, the category logits are

ui​s={γ​ϕmSP​(qi​s),s=si,γ​qi​s,s≠si.u_{is}=\begin{cases}\gamma\,\phi_{m_{\mathrm{SP}}}(q_{is}),&s=s_{i},\\ \gamma\,q_{is},&s\neq s_{i}.\end{cases} (8)

Here ϕm\phi_{m} applies the angular margin to the cosine. Its exact form is given in Eq. (11).

Sampling identities uniformly favors categories that contain more training individuals. To reduce this imbalance in the category loss, we give greater weight to categories with fewer training identities,

ωs=ns−1/2S−1∑v=1Snv−1/2.\omega_{s}=\frac{n_{s}^{-1/2}}{S^{-1}\sum_{v=1}^{S}n_{v}^{-1/2}}. (9)

Let Pi​(s)=exp⁡(ui​s)/∑v=1Sexp⁡(ui​v)P_{i}(s)=\exp(u_{is})/\sum_{v=1}^{S}\exp(u_{iv}) be the predicted probability of category ss. We minimize the weighted cross-entropy over images with category labels,

ℒSP=−∑i∈𝒱ωsi​log⁡Pi​(si)∑i∈𝒱ωsi.\mathcal{L}_{\mathrm{SP}}=-\frac{\sum_{i\in\mathcal{V}}\omega_{s_{i}}\log P_{i}(s_{i})}{\sum_{i\in\mathcal{V}}\omega_{s_{i}}}. (10)

Margin implementation.

For the identity logit in Eq. (6), we clip ci​jc_{ij} to [−1+δ,1−δ][-1+\delta,1-\delta] before computing θi​j=arccos⁡(ci​j)\theta_{ij}=\arccos(c_{ij}), with δ=10−5\delta=10^{-5}. We obtain θ~i​j\widetilde{\theta}_{ij} by clipping θi​j+mID𝟏{j=yi}\theta_{ij}+m_{\mathrm{ID}}\mathbf{1}_{\{j=y_{i}\}} to [δ,3.14159][\delta,3.14159]. During backpropagation, we treat the adjustment gt​(cos⁡θ~i​j)−ci​jg_{t}(\cos\widetilde{\theta}_{ij})-c_{ij} as constant, giving ∂ai​j/∂ci​j=r\partial a_{ij}/\partial c_{ij}=r. This follows the official SphereFace2 implementation [46].

For the category logit in Eq. (8), we clip the cosine qq to [−1,1][-1,1]. With m=mSPm=m_{\mathrm{SP}} and ϵ=10−7\epsilon=10^{-7}, we evaluate the margin function as

pm​(q)\displaystyle p_{m}(q) =q​cos⁡m−max⁡(1−q2,ϵ)​sin⁡m,\displaystyle=q\cos m-\sqrt{\max(1-q^{2},\epsilon)}\sin m, (11)

ϕm​(q)\displaystyle\phi_{m}(q) ={pm​(q),q>cos⁡(π−m),q−m​sin⁡(π−m),otherwise.\displaystyle=\begin{cases}p_{m}(q),&q>\cos(\pi-m),\\ q-m\sin(\pi-m),&\text{otherwise}.\end{cases}

Supplementary Sec. B gives the hyperparameter values.

5 Experimental Setup

We compare backbones and loss functions on closed-set and open-set re-identification across four external datasets.

5.1 Evaluation Datasets and Model Comparisons

We evaluate on ELPephants, GCN-ID, BristolGorillas2020, and private jaguar data (Table 2). We apply foreground processing and manual inspection to all four sources. The datasets and their evaluation identities are excluded from ApexID representation training and checkpoint selection, as well as from the animal Re-ID pretraining data for the reference checkpoints.

Table 2: External evaluation subsets after preprocessing and selection.

Dataset Species IDs Images Obs.

ELPephants [27] African forest elephant 272 2,049 2,028

GCN-ID [35] Great crested newt 207 1,232 1,152

Bristol Gorillas [11, 10] Western lowland gorilla 7 5,324 4,215

Private jaguar data Jaguar 51 1,029 672

Total – 537 9,634 8,067

Model comparisons.

We compare ConvNeXt-Small, MIEW-ID v3 [32], and MegaDescriptor-L [13], each trained or fine-tuned with ArcFace [16], Dynamic ArcFace [26], SphereFace2 [46], or ApexID Hierarchical Loss. ConvNeXt-Small starts from ImageNet weights; MIEW-ID and MegaDescriptor-L start from animal Re-ID checkpoints. This yields twelve trained variants and two unmodified animal Re-ID references, for fourteen configurations in total. Comparisons within each backbone assess the objectives; comparisons with the original checkpoints reflect both ApexID fine-tuning and its associated training choices.

Generalization setting.

All four test datasets evaluate transfer to unseen Re-ID datasets and identities. ELPephants also tests an animal category absent from both ApexID training and the training of MIEW-ID v3 and MegaDescriptor-L. This measures species transfer relative to task-specific Re-ID supervision. Note that all of these models were pretrained on ImageNet data [15], where the classes ’tusker’, ’African elephant’, and ’Indian elephant’ are present. Retrieval remains closed-set because every evaluated query identity occurs in the gallery.

5.2 Evaluation Protocols

Closed-set retrieval and AnimalCLEF-style association and discovery use separate splits and evaluation procedures [3, 4, 19].

Closed-set retrieval.

We construct observation groups using encounter metadata or timestamps, exact-image matches, and within-identity perceptual similarity. We group same-identity images when their dHash distance is ≤4\leq 4 and their pHash distance is ≤6\leq 6. Cross-identity perceptual matches are retained and recorded for audit as they represent difficult cases. This grouping is distinct from the corpus duplicate-removal step in Sec. 3.2. Identities with fewer than two groups are excluded from retrieval. For an identity with GG groups, we assign approximately 80% to the gallery, clipping the rounded count to [1,G−1][1,G-1]. Timestamps define an initial grouping and then a deterministic shuffle keyed by dataset, identity, and seed assigns whole groups to the gallery.

We fix splits for seeds 4242, 123123, 34073407, 20262026, and 13371337 and reuse the same manifests across models. Group-disjointness checks ensure that recorded observations and detected within-identity duplicate groups do not cross roles. We rank gallery images by cosine similarity between ℓ2\ell_{2}-normalized embeddings and assign the identity of the highest-ranked image.

Dataset-adapted open-set association and discovery.

We use the AnimalCLEF 2026 calibrated-similarity and graph-clustering pipeline [4, 19]. We assign observation-aware roles using exact-image matches, dates, encounter identifiers, and naming conventions. When temporal or encounter structure is insufficient, we group images by DINOv2 embedding similarity [31]. Approximately 20% of eligible identities, along with identities that have only one observation group, enter query_novel. The remaining identities provide observation-disjoint gallery and query_known samples. When temporal structure is available, later groups serve as queries. Private jaguar data are evaluated without a gallery to test the quality of the clustering output when evaluating on unknown identities. Calibration and parameter selection are described in Supplementary Sec. E.

5.3 Evaluation Metrics and Statistical Analysis

Closed-set retrieval.

We report Rank-1, CMC through rank 50, mAP, mINP [48], identity-balanced mAP and identity-balanced Rank-1. We rank gallery images individually and consider all images of the query identity relevant. Identity-balanced metrics first average scores within each query identity and then across identities. For each dataset, we average query-mean metrics across five splits, then report the equally weighted mean across the four datasets. Supplementary Sec. B.1 provides full definitions and secondary analyses.

Open-set association and discovery.

We report ARI [25], AMI [44], V-measure [36], item-averaged B3 precision, recall, and F1 [7], and pairwise clustering F1. B3 F1 is the harmonic mean of item-averaged precision and recall. Pairwise F1 treats pairs in the same predicted cluster as positive predictions and pairs with the same true identity as positive ground-truth pairs. We compute clustering metrics for all queries and for the novel-query subset. Gallery settings also report known-attachment accuracy, identity-balanced correct known recognition (BAKS), and identity-balanced novel rejection (BAUS), with NormAcc=BAKS​BAUS\mathrm{NormAcc}=\sqrt{\mathrm{BAKS}\,\mathrm{BAUS}} computed per dataset.

Table 4 summarizes dataset-macro open-set association and discovery performance across the evaluated embedding and loss configurations. All-query ARI, B3 F1, and pairwise F1 are averaged across all four datasets, whereas novel-only ARI, BAKS, and NormAcc are averaged across the three gallery-based datasets (Bristol, Elephants, and GCN-ID). NormAcc is computed per dataset as the geometric mean of BAKS and BAUS before macro-averaging. The corresponding per-dataset results, including gallery-free Jaguar discovery, are reported in Supplementary Table 13.

Paired statistical analysis.

For objectives evaluated on the same backbone, we compute pointwise 95% percentile intervals for paired metric differences using 10,000 identity-block bootstrap replicates. Identities are resampled with replacement independently within each dataset, and each sampled identity carries all its queries across the five splits and both compared models. Each replicate preserves the split-then-dataset averaging procedure described above. Intervals are pointwise and not adjusted for multiple comparisons.

6 Results and Analysis

While evaluating the performance of different models on closed-set and open-set re-identification, we noticed that models and losses that performed strongly on closed-set re-identification do not necessarily exhibit the same behavior on open-set re-identification.

6.1 Closed-Set Retrieval

Table 3 reports dataset-macro retrieval; Supplementary Table 8 provides the per-dataset breakdown.

Table 3: Dataset-macro closed-set retrieval over four external datasets and five split seeds (percentages). ID-balanced metrics average queries within each identity before averaging identities. Bold marks the best value within each backbone family, including ties at the reported precision. Pretrained rows use the original animal Re-ID checkpoints without ApexID fine-tuning under the same evaluation protocol.

Loss R-1 mAP mINP ID-bal. mAP ID-bal. R-1

ConvNeXt-Small

ArcFace 62.24 29.54 14.57 30.08 59.36

Dynamic ArcFace 61.75 29.23 14.51 29.62 58.72

SphereFace2 63.60 30.24 15.31 30.83 60.78

ApexID Hierarchical 64.89 30.84 15.71 31.72 62.13

MIEW-ID v3

ArcFace 63.65 32.09 17.71 32.60 60.82

Dynamic ArcFace 62.72 31.51 17.31 32.06 60.07

SphereFace2 63.40 31.89 17.78 32.44 60.64

ApexID Hierarchical 63.88 32.54 18.28 33.23 61.62

Pretrained 58.14 27.40 13.74 27.74 55.54

MegaDescriptor-L

ArcFace 58.20 27.13 13.05 27.53 55.52

Dynamic ArcFace 55.44 25.51 11.75 25.49 52.34

SphereFace2 57.13 26.61 12.47 26.79 54.43

ApexID Hierarchical 61.18 29.07 14.69 29.85 58.52

Pretrained 54.01 23.62 10.66 24.11 50.82

Within every backbone family, ApexID Hierarchical Loss is best on all five reported macro retrieval metrics. With MIEW-ID v3, its 32.54%32.54\% mAP and 18.28%18.28\% mINP are the highest of all fourteen configurations, and ConvNeXt-Small with ApexID Hierarchical Loss attains the highest Rank-1 overall (64.89%64.89\%). All eight fine-tuned animal Re-ID configurations improve dataset-macro Rank-1 and mAP over their corresponding original checkpoints.

Paired objective comparisons.

Figure 7 summarizes comparisons of ApexID Hierarchical Loss with each baseline on the same backbone and frozen query records. All nine macro-mAP differences are positive, ranging from +0.45+0.45 (MIEW-ID v3 vs. ArcFace) to +3.56+3.56 percentage points (MegaDescriptor-L vs. Dynamic ArcFace), and none of their pointwise 95% bootstrap intervals includes zero. The gains are largest on MegaDescriptor-L (+1.94+1.94 to +3.56+3.56).

Per-dataset behavior.

Against SphereFace2, the largest mAP gains occur on GCN-ID for all three backbones (+1.00+1.00, +1.27+1.27, and +7.57+7.57 percentage points for ConvNeXt-S, MIEW-ID v3, and MegaDescriptor-L); for MIEW-ID v3, the gain on the private jaguar data is equally large. mAP on the private jaguar data increases for every backbone (Supplementary Sec. C).

Transfer to unseen species.

On ELPephants, ConvNeXt-Small with ApexID Hierarchical Loss achieves 17.69%17.69\% Rank-1 and 6.63%6.63\% mAP, the highest among all fourteen configurations. The original MIEW-ID v3 checkpoint reaches 14.12%14.12\% Rank-1 and 4.82%4.82\% mAP, while the original MegaDescriptor-L reaches 8.63%8.63\% and 3.34%3.34\%, respectively. A full comparison is shown in Fig. 8 of the appendix.

Backbone capacity.

The CNN-based ConvNeXt-S and MIEW-ID v3 backbones have 49.45M and 51.08M parameters, respectively, versus 195.20M for MegaDescriptor-L (Supplementary Table 7). Despite this roughly fourfold size gap, the family-wise best ConvNeXt-S and MIEW-ID v3 values exceed the best MegaDescriptor-L values on all five macro retrieval metrics.

6.2 Representation and Verification

Against SphereFace2, ApexID Hierarchical Loss increases same-category AUROC in 9 of 12 backbone–dataset combinations and identity silhouette scores in 8 of 12 (Supplementary Table 10). Fisher ratios improve in all 12 combinations, while low-FAR verification includes regressions. These embedding-space diagnostics capture complementary properties: AUROC measures how well same-category pairs are separated from different-category pairs [20], silhouette scores characterize within-identity cohesion relative to between-identity separation [37], Fisher ratios quantify between-identity dispersion relative to within-identity dispersion, and effective rank summarizes the dimensionality of the embedding distribution [38].

6.3 Dataset-Adapted Open-Set Analysis

Table 4 reports macro association and discovery scores for fourteen embeddings under the dataset-adapted protocol. Supplementary Table 13 gives per-dataset results, including gallery-free jaguar discovery.

Table 4: Dataset-macro open-set association and discovery results (split seed 42). All-query ARI, B3 F1, and pairwise F1 are averaged over four datasets. Novel-only ARI, BAKS, and Normalized Accuracy (NormAcc) are averaged over the three gallery datasets (Bristol, elephants, and GCN-ID). Boldface marks the best value within each backbone family.

Loss ARI B3 F1 Pair F1 Nov. ARI BAKS NormAcc

ConvNeXt-S

ArcFace 0.424 0.596 0.447 0.392 0.098 0.207

Dynamic ArcFace 0.436 0.597 0.460 0.397 0.305 0.338

SphereFace2 0.441 0.588 0.463 0.404 0.305 0.338

ApexID Hierarchical 0.432 0.591 0.457 0.403 0.319 0.322

MIEW-ID v3

ArcFace 0.433 0.582 0.457 0.409 0.320 0.400

Dynamic ArcFace 0.444 0.593 0.479 0.396 0.331 0.419

SphereFace2 0.427 0.594 0.452 0.400 0.431 0.537

ApexID Hierarchical 0.430 0.593 0.465 0.406 0.379 0.437

Pretrained 0.451 0.592 0.474 0.416 0.405 0.521

MegaDescriptor-L

ArcFace 0.414 0.595 0.437 0.384 0.419 0.501

Dynamic ArcFace 0.443 0.609 0.473 0.382 0.475 0.498

SphereFace2 0.411 0.567 0.427 0.383 0.321 0.346

ApexID Hierarchical 0.434 0.601 0.463 0.384 0.307 0.316

Pretrained 0.428 0.580 0.457 0.398 0.317 0.321

High scores on closed-set re-identification do not imply high scores on open-set re-identification. Macro ARI spans only 0.4110.411–0.4510.451, as GCN-ID is nearly saturated and the other datasets are difficult for every model, as shown in Supplementary Table 13. Within ConvNeXt-S, ApexID Hierarchical Loss gives the best BAKS, while SphereFace2 gives the best all-query ARI, pairwise F1, and novel-only ARI, and ties with Dynamic ArcFace for the best Normalized Accuracy. Within MIEW-ID v3, the unmodified checkpoint leads in all-query ARI, while SphereFace2 leads in known-individual attachment. Within MegaDescriptor-L, ApexID Hierarchical Loss ranks second to Dynamic ArcFace on ARI, B3 F1, and pairwise F1, but has the lowest BAKS and Normalized Accuracy in its family. ApexID Hierarchical Loss has the highest elephant ARI among the fine-tuned objectives for ConvNeXt-S and MegaDescriptor-L, but the lowest ARI on private jaguar data for ConvNeXt-S and MIEW-ID v3. On elephants, the unmodified MIEW-ID v3 checkpoint has the highest ARI overall (0.2850.285), while known-individual recognition remains near zero for every embedding (BAKS ≤0.014\leq 0.014).

6.4 Ablation: Category Loss Weight

To isolate the contribution of category supervision, we vary the category loss weight λSP\lambda_{\mathrm{SP}} in Eq. (4) over {0.025,0.05,0.075,0.10,0.15,0.25,0.50}\{0.025,0.05,0.075,0.10,0.15,0.25,0.50\} on ConvNeXt-Small. All other settings are held fixed. The SphereFace2 baseline from Table 3 serves as the reference without category supervision. Table 5 reports dataset-macro closed-set retrieval under the protocol of Sec. 5.2.

All main results use λSP=0.50\lambda_{\mathrm{SP}}=0.50, the best setting on four of the five metrics.

Table 5: Effect of the category loss weight λSP\lambda_{\mathrm{SP}} on dataset-macro closed-set retrieval with ConvNeXt-Small (percentages), using the same datasets, split seeds, and metrics as Table 3. SphereFace2 is trained without category supervision.

Objective R-1 mAP mINP ID-bal. mAP ID-bal. R-1

SphereFace2 (no category term) 63.603 30.244 15.310 30.825 60.779

λSP=0.025\lambda_{\mathrm{SP}}=0.025 64.257 30.499 15.334 31.113 61.260

λSP=0.05\lambda_{\mathrm{SP}}=0.05 64.262 30.586 15.375 31.334 61.382

λSP=0.075\lambda_{\mathrm{SP}}=0.075 64.193 30.542 15.383 31.114 61.047

λSP=0.10\lambda_{\mathrm{SP}}=0.10 64.602 30.662 15.531 31.235 61.409

λSP=0.15\lambda_{\mathrm{SP}}=0.15 64.478 30.546 15.333 31.257 61.730

λSP=0.25\lambda_{\mathrm{SP}}=0.25 64.796 30.724 15.493 31.510 62.303

λSP=0.50\lambda_{\mathrm{SP}}=0.50 64.888 30.835 15.715 31.724 62.125

7 Limitations

ApexID assumes a two-level category–identity hierarchy, whose effectiveness may depend on the granularity and reliability of the animal category annotations. These categories represent broad animal types rather than a consistent biological taxonomic level. In particular, they do not necessarily distinguish between species within the same broader animal category. For example, all individuals in the whale subset are assigned to a single “whale” category, without distinguishing among whale species. This choice reflects the available annotations and uncertainty regarding species-level identification.

8 Conclusion

We presented the ApexID Hierarchical Loss, a multi-species animal Re-ID loss function that extends SphereFace2 by combining global identity discrimination with balanced category supervision. Observation-aware evaluation across three model families shows that ApexID improves closed-set retrieval over the original pretrained references, while its gains in open-set re-identification vary by backbone and dataset. Open-set analyses reveal complementary strengths and remaining discovery challenges. These findings support category-aware representations for wildlife re-identification and underscore the need to validate transfer across species and acquisition conditions.

LLM Usage Statement

We used LLMs for language editing, grammar correction, figure editing and design, and improving clarity throughout the manuscript. The authors reviewed and revised all AI-assisted text and take full responsibility for the paper’s content.

References

[1] Lukas Adam, Vojtech Cermak, Kostas Papafitsoros, and Lukas Picek. WildlifeReID-10k: Wildlife re-identification dataset with 10k individual animals. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, pages 2124–2134, 2025a.

[2] Lukáš Adam, Kostas Papafitsoros, Claire Jean, Alan F. Rees, and Vojtěch Čermák. Exploiting facial side similarities to improve AI-driven sea turtle photo-identification systems. Ecological Informatics, 89:103158, 2025b.

[3] Lukáš Adam, Kostas Papafitsoros, Roman Kovář, Vojtěch Čermák, and Lukáš Picek. Overview of AnimalCLEF 2025: Recognizing individual animals in images. In Working Notes of the Conference and Labs of the Evaluation Forum (CLEF 2025), pages 2898–2908. CEUR-WS.org, 2025c.

[4] Lukáš Adam, Lukas Picek, Kostas Papafitsoros, Dean Williams, and Daniella Biffi. AnimalCLEF26 @ CVPR & CLEF. Kaggle competition, 2026.

[5] Takuya Akiba, Shotaro Sano, Toshihiko Yanase, Takeru Ohta, and Masanori Koyama. Optuna: A next-generation hyperparameter optimization framework. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 2623–2631, 2019.

[6] Roberto Alcaraz, Balma Albalat-Oliver, Alejandro Villa, Giacomo Tavecchia, José Manuel Igual, and Andreu Rotger. A long-term photographic dataset for individual identification of the balearic wall lizard. Scientific Data, 2026.

[7] Enrique Amigó, Julio Gonzalo, Javier Artiles, and Felisa Verdejo. A comparison of extrinsic clustering evaluation metrics based on formal constraints. Information Retrieval, 12(4):461–486, 2009.

[8] Botswana Predator Conservation Trust. Hyena ID 2022. LILA BC / African Carnivore Wildbook, 2022a. Spotted hyena dataset; accessed 2026-10-30.

[9] Botswana Predator Conservation Trust. Panthera pardus csv custom export. African Carnivore Wildbook, 2022b. Retrieved 2022-04-28.

[10] Otto Brookes and Tilo Burghardt. A dataset and application for facial recognition of individual gorillas in zoo environments. In International Conference on Pattern Recognition Workshop on Visual Observation and Analysis of Vertebrate and Insect Behavior, Milan, Italy, 2021.

[11] Oliver Brookes et al. BristolGorillas2020, 2021.

[12] Nicolas Carion, Laura Gustafson, Yuan-Ting Hu, Shoubhik Debnath, Ronghang Hu, Didac Suris, Chaitanya Ryali, Kalyan Vasudev Alwala, Haitham Khedr, Andrew Huang, Jie Lei, Tengyu Ma, Baishan Guo, Arpit Kalla, Markus Marks, Joseph Greer, Meng Wang, Peize Sun, Roman Rädle, Triantafyllos Afouras, Effrosyni Mavroudi, Katherine Xu, Tsung-Han Wu, Yu Zhou, Liliane Momeni, Rishi Hazra, Shuangrui Ding, Sagar Vaze, Francois Porcher, Feng Li, Siyuan Li, Aishwarya Kamath, Ho Kei Cheng, Piotr Dollár, Nikhila Ravi, Kate Saenko, Pengchuan Zhang, and Christoph Feichtenhofer. SAM 3: Segment anything with concepts. arXiv preprint arXiv:2511.16719, 2025.

[13] Vojtěch Čermák, Lukas Picek, Lukáš Adam, and Kostas Papafitsoros. WildlifeDatasets: An open-source toolkit for animal re-identification. In 2024 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pages 5941–5951. IEEE, 2024.

[14] Ted Cheeseman and Ken Southerland. Happywhale encounters, 2026.

[15] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pages 248–255. IEEE, 2009.

[16] Jiankang Deng, Jia Guo, Niannan Xue, and Stefanos Zafeiriou. ArcFace: Additive angular margin loss for deep face recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 4690–4699, 2019.

[17] Jiankang Deng, Jia Guo, Tongliang Liu, Mingming Gong, and Stefanos Zafeiriou. Sub-center ArcFace: Boosting face recognition by large-scale noisy web faces. In Computer Vision – ECCV 2020, pages 741–757. Springer, 2020.

[18] Mohamed ElBassat, Rokayya Aly, and Seifeldin Elkerdany. V-Rush: An interactive comp

Images from the source

Figure 2: CMC curves over ranks 1–50 for the twelve trained checkpoints, averaged over the five split seeds.
Figure 2: CMC curves over ranks 1–50 for the twelve trained checkpoints, averaged over the five split seeds.
Figure 3: Rank-1 under limited gallery observations per identity, with the same eligible cohort across kk. Curves are five-split means.
Figure 3: Rank-1 under limited gallery observations per identity, with the same eligible cohort across kk. Curves are five-split means.
Figure 4: mAP under limited gallery observations per identity, with the same eligible cohort across kk. Curves are five-split means.
Figure 4: mAP under limited gallery observations per identity, with the same eligible cohort across kk. Curves are five-split means.
Figure 5: Mean average precision (mAP) as more individuals from the same category are added to the search gallery. For example, when the query shows one elephant, the distractors are other elephants. Within each dataset, the same query images are used at every distractor count. The Bristol Gorillas dataset has only seven distinct identities.
Figure 5: Mean average precision (mAP) as more individuals from the same category are added to the search gallery. For example, when the query shows one elephant, the distractors are other elephants. Within each dataset, the same query images are used at every distractor count. The Bristol Gorillas dataset has only seven distinct identities.
Figure 6: Paired macro differences, ApexID Hierarchical minus baseline on the same backbone, with pointwise 95% identity-block bootstrap intervals. Rank-1 and mINP intervals are secondary diagnostics.Figure 7: Dataset-level mAP differences of ApexID Hierarchical versus SphereFace2. Intervals are exploratory.
Figure 6: Paired macro differences, ApexID Hierarchical minus baseline on the same backbone, with pointwise 95% identity-block bootstrap intervals. Rank-1 and mINP intervals are secondary diagnostics.Figure 7: Dataset-level mAP differences of ApexID Hierarchical versus SphereFace2. Intervals are exploratory.
Figure 6: Paired macro differences, ApexID Hierarchical minus baseline on the same backbone, with pointwise 95% identity-block bootstrap intervals. Rank-1 and mINP intervals are secondary diagnostics.Figure 7: Dataset-level mAP differences of ApexID Hierarchical versus SphereFace2. Intervals are exploratory.
Figure 6: Paired macro differences, ApexID Hierarchical minus baseline on the same backbone, with pointwise 95% identity-block bootstrap intervals. Rank-1 and mINP intervals are secondary diagnostics.Figure 7: Dataset-level mAP differences of ApexID Hierarchical versus SphereFace2. Intervals are exploratory.
Figure 8: Closed-set transfer to unseen species (ELPephants). Rank-1 and mAP for fourteen configurations across three backbones. ApexID Hierarchical Loss (teal) gives the best result on ConvNeXt-S and MegaDescriptor-L. On MIEW-ID it has the highest mAP, slightly above the original checkpoint, while SphereFace2 has the highest Rank-1. The dashed line marks the best configuration in each panel.
Figure 8: Closed-set transfer to unseen species (ELPephants). Rank-1 and mAP for fourteen configurations across three backbones. ApexID Hierarchical Loss (teal) gives the best result on ConvNeXt-S and MegaDescriptor-L. On MIEW-ID it has the highest mAP, slightly above the original checkpoint, while SphereFace2 has the highest Rank-1. The dashed line marks the best configuration in each panel.

Sources

← Back to Daily AI Report