File size: 5,602 Bytes
e5099fb
c84e606
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e5099fb
c84e606
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
license: other
license_name: upstream-miewid-msv3
license_link: https://huggingface.co/conservationxlabs/miewid-msv3
library_name: pytorch
pipeline_tag: image-feature-extraction
base_model: conservationxlabs/miewid-msv3
datasets:
  - Made-In-Alexandria-AI/ApexID-Dataset
tags:
  - animal-re-identification
  - re-identification
  - wildlife
  - metric-learning
  - apexid
  - miewid
  - efficientnet
---
# ApexID MIEW-ID v3 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 MIEW-ID v3 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 mAP (32.54%) of all fourteen configurations in the paper.

The other ApexID encoders are [ApexID_ConvNext_Backbone](https://huggingface.co/Made-In-Alexandria-AI/ApexID_ConvNext_Backbone) and [ApexID_MegaDescriptor_Backbone](https://huggingface.co/Made-In-Alexandria-AI/ApexID_MegaDescriptor_Backbone).

## Model details

| | |
| --- | --- |
| Architecture | MIEW-ID v3 |
| Initialization | [conservationxlabs/miewid-msv3](https://huggingface.co/conservationxlabs/miewid-msv3) at revision `4f1d7f2b521149e5fe34bb85f377248ce9971a7d` |
| Parameters | 51.08M |
| Embedding | 2152-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/miewid_v3/apexid_hierarchical.yaml`](https://github.com/MIA-AI-Team/ApexID-Hierarchical-Learning-for-Multi-Species-Animal-Re-Identification-Official-Repo/blob/main/configs/miewid_v3/apexid_hierarchical.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/miewid_v3/apexid_hierarchical.yaml")
weights = hf_hub_download("Made-In-Alexandria-AI/ApexID_MiewID_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, 2152)
```

## 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 MIEW-ID v3 backbone.

| Model | Rank-1 | mAP | mINP |
| --- | ---: | ---: | ---: |
| Pretrained MIEW-ID v3 | 58.14 | 27.40 | 13.74 |
| ArcFace | 63.65 | 32.09 | 17.71 |
| Dynamic ArcFace | 62.72 | 31.51 | 17.31 |
| SphereFace2 | 63.40 | 31.89 | 17.78 |
| **ApexID Hierarchical (this model)** | 63.88 | 32.54 | 18.28 |

Transfer to ELPephants, a category absent from all animal Re-ID training, in percent:

| Model | Rank-1 | mAP |
| --- | ---: | ---: |
| Original MIEW-ID v3 checkpoint | 14.12 | 4.82 |
| ApexID Hierarchical (this model) | 14.21 | 4.87 |

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 ApexID code is MIT-licensed. These weights are fine-tuned from [conservationxlabs/miewid-msv3](https://huggingface.co/conservationxlabs/miewid-msv3), which does not declare a license, so they follow whatever terms Conservation X Labs and Wild Me set for the upstream checkpoint.

## 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}
}
```