--- license: mit library_name: pytorch pipeline_tag: image-feature-extraction datasets: - Made-In-Alexandria-AI/ApexID-Dataset tags: - animal-re-identification - re-identification - wildlife - metric-learning - apexid - convnext --- # ApexID ConvNeXt-Small encoder [Project page](https://mia-ai-team.github.io/ApexID-Hierarchical-Learning-for-Multi-Species-Animal-Re-Identification-Official-Repo/) · [Code](https://github.com/MIA-AI-Team/ApexID-Hierarchical-Learning-for-Multi-Species-Animal-Re-Identification-Official-Repo) · [Dataset](https://huggingface.co/datasets/Made-In-Alexandria-AI/ApexID-Dataset) · Paper: arXiv link coming soon This is the ConvNeXt-Small image encoder from *ApexID: Hierarchical Learning for Multi-Species Animal Re-Identification*, trained with the ApexID Hierarchical Loss. It maps a segmented animal image to an L2-normalized embedding, so individuals of any species can be matched by cosine similarity. In the paper it gives the highest dataset-averaged Rank-1 (64.89%) and the best ELPephants transfer (17.69% Rank-1, 6.63% mAP) of all fourteen configurations in the paper. The other ApexID encoders are [ApexID_MiewID_Backbone](https://huggingface.co/Made-In-Alexandria-AI/ApexID_MiewID_Backbone) and [ApexID_MegaDescriptor_Backbone](https://huggingface.co/Made-In-Alexandria-AI/ApexID_MegaDescriptor_Backbone). ## Model details | | | | --- | --- | | Architecture | ConvNeXt-Small | | Initialization | ImageNet-1k weights from TorchVision (`ConvNeXt_Small_Weights.IMAGENET1K_V1`) | | Parameters | 49.45M | | Embedding | 2048-d, L2-normalized | | Input | 440 × 440 RGB, normalized with mean (0.485, 0.456, 0.406) and std (0.229, 0.224, 0.225) | | File | `best_backbone.pt` (PyTorch state dict) | | Matching config | [`configs/default.yaml`](https://github.com/MIA-AI-Team/ApexID-Hierarchical-Learning-for-Multi-Species-Animal-Re-Identification-Official-Repo/blob/main/configs/default.yaml) | ## Usage Install the [ApexID repository](https://github.com/MIA-AI-Team/ApexID-Hierarchical-Learning-for-Multi-Species-Animal-Re-Identification-Official-Repo) and run from its root: ```python import numpy as np import torch from PIL import Image from huggingface_hub import hf_hub_download from apexid.data import build_eval_transforms from apexid.evaluation.embeddings import ApexIDModelAdapter from apexid.utils.config import load_config config = load_config(config_path="configs/default.yaml") weights = hf_hub_download("Made-In-Alexandria-AI/ApexID_ConvNext_Backbone", "best_backbone.pt") device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = ApexIDModelAdapter.from_checkpoint(config, weights, device).model transform = build_eval_transforms(config=config) rgb = np.asarray(Image.open("animal.png").convert("RGB")) # a segmented foreground works best with torch.inference_mode(): embedding = model(transform(image=rgb)["image"][None].to(device)) # shape (1, 2048) ``` ## Results Closed-set retrieval, averaged over four external datasets (ELPephants, GCN-ID, Bristol Gorillas and private jaguar data) and five observation-disjoint split seeds, in percent. All rows use the ConvNeXt-Small backbone. | Model | Rank-1 | mAP | mINP | | --- | ---: | ---: | ---: | | ArcFace | 62.24 | 29.54 | 14.57 | | Dynamic ArcFace | 61.75 | 29.23 | 14.51 | | SphereFace2 | 63.60 | 30.24 | 15.31 | | **ApexID Hierarchical (this model)** | 64.89 | 30.84 | 15.71 | Transfer to ELPephants, a category absent from all animal Re-ID training, in percent: | Model | Rank-1 | mAP | | --- | ---: | ---: | | ApexID Hierarchical (this model) | 17.69 | 6.63 | The [project page](https://mia-ai-team.github.io/ApexID-Hierarchical-Learning-for-Multi-Species-Animal-Re-Identification-Official-Repo/) has the full fourteen-configuration comparison, the open-set evaluation and ScoreCAM maps. ## Intended use and limitations The encoder is meant for research on individual animal re-identification: ranking a gallery of known individuals against a query image, or clustering images of unknown individuals. It works best on segmented foregrounds like those it was trained on. Absolute scores on unseen species remain low, and open-set results vary by dataset, so verify matches with an expert before acting on them. ## Training data The encoder was trained on the ApexID corpus: 132,533 curated images of 13,348 identities from 19 public animal re-identification datasets. See the [dataset card](https://huggingface.co/datasets/Made-In-Alexandria-AI/ApexID-Dataset) for sources, licenses and splits. ## License The weights and code are released under the MIT License. ## Citation ```bibtex @article{elkerdany2026apexid, title = {ApexID: Hierarchical Learning for Multi-Species Animal Re-Identification}, author = {Elkerdany, Seifeldin and ElBassat, Mohamed and Abouelhamd, Gamal and Elkady, Assem and Ghoneim, Jana and Mahmood, Matin and Martin, Abigail Allen and de Melo, Gerard and Rueda-Toicen, Antonio}, journal = {arXiv preprint}, year = {2026} } ```