Instructions to use AARecords/AAR-AnimeReID with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AARecords/AAR-AnimeReID with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="AARecords/AAR-AnimeReID")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AARecords/AAR-AnimeReID", device_map="auto") - TensorRT
How to use AARecords/AAR-AnimeReID with TensorRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
- AAR-AnimeReID
- Executive Summary β Headline Results
- Benchmark Suites & Evaluation Protocols
- Model Architecture
- Complete Development & Benchmark Journey
- 1. Pre-Training Baseline (
165,615Official Portraits /89,824Characters) - 2. Training Stage 1 β In-Domain Metric Foundation (NVIDIA L4 24GB)
- 3. Training Stage 2 β Multi-Domain Scaling (NVIDIA L40S 48GB, ~1.01M Views)
- 4. Production Serving & Multi-Hardware Benchmarks (
TensorRT 11.5 FP16/FP8,ONNX,L4,L40S, &ARM64 CPU) - 5. Head-to-Head Comparison vs
DeepGHS CCIP& RawDINOv2-Large - 6. Large-Scale Wild Safebooru Benchmark (
3,000Images) & Anime Profile Head Cropping - 7. Post-Retrieval Mathematical Re-Ranking (
< 1 msCPU) - 8. Expanded Multi-View Gallery (
165,615β228,462Images) & End-to-End Progression
- 1. Pre-Training Baseline (
- Quick Usage (
inference.py) - Repository Contents
- Model Lineage, Upstream Attribution & Licensing
- Executive Summary β Headline Results
AAR-AnimeReID
AAR Open-Set Anime Character Re-Identification & Reverse Image Search (1024-d, Cosine Similarity)
Developed by AAR, fine-tuned directly on top of Meta AI's facebook/dinov2-with-registers-large (Apache License 2.0) via a Two-Stage Contrastive Curriculum over 89,824 unique anime characters and ~1.01M+ multi-domain training views across official anime portraits, Zerochan illustrations, and Danbooru fanart β and evaluated in production alongside TensorRT 11.5 (FP16 / FP8), anime head profile framing, CSLS + LogSumExp post-retrieval re-ranking, and a 228,462-image multi-view gallery.
Weights & Inference Only: This repository distributes standalone Apache-2.0 model weights,
inference.py, and license/attribution files only. No copyrighted anime images or internal databases are redistributed.
Executive Summary β Headline Results
Evaluated against an open-set production gallery of 228,462 images spanning 89,824 unique characters under strict zero-leakage isolation (all held-out evaluation characters and matching external post_ids completely excluded from training and gallery targets; see Benchmark Suites & Evaluation Protocols below for exact dataset definitions):
| Benchmark Suite | Commercial / Raw Baselines | After Training Stage 1 (165K) | AAR-AnimeReID Whole-Img (165K) |
AAR-AnimeReID Full Pipeline (228K + Profile Crop + CSLS+LSE) |
|---|---|---|---|---|
Real-World Mixed User Queries (10 imgs: fanart, cosplay & unseen char) |
Commercial MM: 30.0% Hit@1 |
90.0% Hit@1 (100% @3) |
100.0% Hit@1 |
100.0% (10/10) Hit@1 | MRR@10 = 1.0000 |
Held-Out Unseen Characters (1,000 chars vs full gallery) |
Commercial MM: 21.6% Hit@1 |
70.1% Hit@1 / 84.3% @10 |
75.5% Hit@1 / 87.9% @10 |
77.90% Hit@1 / 89.20% @10 | MRR 0.8171 |
Wild OOD Web Fanart β Held-Out Unseen Chars (38 pics) |
Commercial MM: 5.26% Hit@1 |
26.32% Hit@1 (31.58% RRF) |
47.37% Hit@1 / 71.05% @10 |
73.68% Hit@1 / 78.95% @10 | MRR 0.7494 |
Wild OOD Web Fanart β All Untrained (50 pics, incl. 1-shot) |
Commercial MM: 8.0% Hit@1 |
24.0% Hit@1 (28.0% RRF) |
42.0% Hit@1 / 68.0% @10 |
62.00% Hit@1 / 76.00% @10 | MRR 0.6679 |
Large-Scale Wild Safebooru Solo (1,500 random solo fanart imgs) |
β | β | 37.47% Hit@1 / 55.07% @10 |
60.67% Hit@1 / 74.20% @10 | MRR 0.6510 |
Wild Safebooru Solo β Held-Out Subset (84 unseen-char imgs) |
β | β | 46.43% Hit@1 / 77.38% @10 |
72.62% Hit@1 / 89.29% @10 | MRR 0.7887 |
Wild Multi-Character Scenes (1,500 group scenes, 2β3+ chars) |
β | β | 23.93% Any@1 / 5.27% All@10 |
51.53% Any@1 / 74.20% Any@10 / 20.93% All@10 |
Degraded Crops & Screenshots (300 imgs: 58β78% crop + rot Β±7Β° + JPEG 65) |
Commercial MM: 60.33% / BoVW: 88.67% |
97.0% (97.33% RRF) |
97.33% Hit@1 (98.0% @10 RRF) |
β |
Cross-Pose Gallery Queries (400 chars, self excluded) |
Commercial MM: 17.75% (19.75% RRF) |
71.5% Hit@1 / 86.5% @10 |
75.75% Hit@1 / 90.25% @10 |
79.25% Hit@1 / 90.50% @10 (165K + CSLS+LSE) |
Head-to-Head vs DeepGHS CCIP (Held-Out val3k, NVIDIA L4) |
CCIP: 59.3% Hit@1 (75.5 img/s) |
β | 79.80% Hit@1 (228.5 img/s) |
+20.5% Hit@1 & 3.0Γ faster |
Benchmark Suites & Evaluation Protocols
To make every number in this model card reproducible and self-explanatory, each test suite evaluates a distinct real-world failure mode:
| Suite / Split Name | Size | What Is Actually Being Tested? | Leakage & Self-Exclusion Protocol |
|---|---|---|---|
| Real-World Mixed User Queries | 10 images |
End-to-end "in-the-wild" user uploads spanning 4 characters (Kurisu Makise, Mayoi Hachikuji, Light Yagami, and Frieren as an unseen held-out character), mixing clean fanart, compressed .webp/.jpg web crops, and a real human cosplay photo matched back to anime portraits. |
Evaluated end-to-end against the full 165K / 228K open-set gallery (89,824 characters). |
| Held-Out Unseen Characters (Full-Gallery) | 1,000 queries |
1,000 multi-view anime characters queried against the entire 165,615 / 228,462-image open-set index (89,824 characters). Tests generalization to completely unknown character identities. |
Strict zero leakage: 0 images of these 1,000 characters were ever seen during Stage 1 or Stage 2 training; the exact query image is excluded from results so only other depictions count. |
Held-Out In-Loop Benchmark (val3k) |
1,000 queries / 3,000 targets |
Closed benchmark used to track epoch-by-epoch convergence and compare AAR-AnimeReID vs DeepGHS CCIP and raw DINOv2-Large: 1,000 unseen character query images matched against 1,000 distinct positive unseen targets + 2,000 hard unseen distractors, plus Balanced 1:1 and Hard-Negative 1:1 verification pairs. |
100% held-out unseen characters (0 overlap with training). |
| Cross-Pose Gallery Queries | 400 queries |
400 multi-view characters queried with one official portrait against all other portraits in the 165,615-image gallery. Tests pose, angle, expression, and outfit invariance rather than duplicate matching. |
Exact query image UUID masked out so identical/near-identical image self-matches cannot count. |
| Degraded Crops & Screenshots | 300 queries |
300 character portraits synthetically degraded with random 58β78% crops, Β±7Β° rotation, brightness/contrast shifts, and lossy JPEG q65 compression. Simulates memes, reaction crops, and low-bitrate video screenshots. |
Tested against the full 165,615-image gallery without external fanart expansion. |
| Wild OOD Web Fanart (Held-Out + 1-Shot) | 50 images (38 + 12) |
50 uncurated web fanart illustrations sourced directly from Safebooru (0 file overlap with training or base gallery): 38 images belong to held-out val_unseen characters, and 12 images belong to 1-shot characters that had only 1 portrait in the base gallery out of 89,824 characters. |
Zero leakage: all 50 characters' Zerochan folders and matching Danbooru tags were excluded from Stage 1 & Stage 2 training. |
| Large-Scale Wild Safebooru Solo | 1,500 images (84 held-out) |
1,500 randomly sampled solo fanart illustrations across 556 unique characters (84 images strictly from held-out val_unseen characters). Measures large-scale fanart style/artist shift tolerance. |
Any gallery entry sharing the query's post_id is masked out during evaluation. |
| Large-Scale Wild Multi-Character Scenes | 1,500 scenes (4,290 heads) |
1,500 randomly sampled multi-character illustrations across 915 unique characters (1,081 exact 2-character scenes + 419 scenes with 3+ characters). Evaluated with Any-Hit@k (β₯1 character right in Top-k), Recall@k, and All-Found@k (every character in the scene found in Top-k). |
Same strict post_id masking; multi-head cropping searches each detected face/profile independently and merges character scores. |
Model Architecture
- Base Vision Transformer:
facebook/dinov2-with-registers-large(304Mparams, ViT-L/14 with 4 register tokens,hidden_size = 1024) - Parameter-Efficient Adaptation (Merged into Standalone Weights):
- LoRA (
r = 16,lora_alpha = 32,lora_dropout = 0.05) onq_proj,k_proj,v_proj,o_proj(3,145,728 / 307,518,464trainable =1.0229%), cleanly merged viamerge_and_unload()intobackbone/ - Dual-Pooling Residual Projection Head (
reid_head.pt): concatenates[CLS]token andMean(PatchTokens)(2048-d->Linear->GELU->LayerNorm->Linear->1024-d), added residually toCLS(F.normalize(base_proj(cls) + resid, p=2)) so Epoch 0 preserves DINOv2's pretrained geometry cleanly.
- LoRA (
- Preprocessing:
224 Γ 224aspect-preserving RGB bicubic letterbox (fill=(128,128,128)), normalized with standard DINOv2 ImageNet mean/std.
Complete Development & Benchmark Journey
1. Pre-Training Baseline (165,615 Official Portraits / 89,824 Characters)
We first established a hybrid baseline across 165,615 character portraits (89,824 characters: 18,971 multi-image, 70,859 single-image) combining a commercial multimodal embedding API (1024-d), classical spatial layout descriptors (288-d CIELAB/HSV + CLD DCT + Multi-Grid HOG), 8192-vocab RootSIFT BoVW BM25, and pHash/dHash:
- Key Bottleneck: While BoVW and multimodal embeddings handled exact cropped duplicates well (
Degraded Crops 300:60.33%commercial MM,88.67%BoVW alone /92.33%pre-training hybrid), cross-pose character recognition collapsed (Cross-Pose 400: 17.75β18.0%,Held-Out Unseen 1k: 21.6%,Wild OOD Web Fanart: 5.26β8.0%, raw zero-shotDINOv2-Large:9.7%on165K/17.0%onval3k).
2. Training Stage 1 β In-Domain Metric Foundation (NVIDIA L4 24GB)
- Strict Zero-Leakage Split:
17,965multi-image training characters +70,859single-image characters, with1,000held-out unseen characters completely isolated (0images touched in training). - Curriculum: Top-15 visual lookalike hard negatives per character + Symmetric SupCon + Hard-Negative Margin Penalty + EMA for 12 epochs Γ 250 steps (
p_anchors=16,grad_accum=3,lr=1.2e-4,BF16). - Stage-1 Results vs
165,615-Image Index:- Held-Out Unseen Characters (
1,000queries):21.6%->70.1%Hit@1 |84.3%Hit@10 (MRR 0.7528) - Cross-Pose Gallery (
400queries):17.75%->71.5%Hit@1 |86.5%Hit@10 (MRR 0.7638) - Degraded Crops & Screenshots (
300queries):97.0%Hit@1 (97.33%RRF) - Real-World Mixed User Queries (
10images, incl. cosplay & unseen Frieren):30.0%->90.0%(9/10) Hit@1 |100.0%Hit@3
- Held-Out Unseen Characters (
- Identified Domain Gap: On wild out-of-distribution fanart (
50external Safebooru images), Stage 1 achieved24.0%Hit@1 (26.32%on the38held-out unseen subset,31.58%RRF) due to official-portrait training bias.
3. Training Stage 2 β Multi-Domain Scaling (NVIDIA L40S 48GB, ~1.01M Views)
To generalize across wild fanart, diverse lighting, and varied framing without sacrificing official-portrait accuracy:
- Multi-Domain Corpus (
~1.01Mimage views across 14 epochs):- Linked
deepghs/character_similarity(face & pruned solo subsets) and non-saturated solo illustrations fromaipracticecafe/curated-danbooru-2026viadeepghs/site_tags. 44,564multi-view training characters (17,965base multi-view +3,625single-image characters upgraded to multi-domain +22,974additional deduplicated characters) +67,228single-image characters.11,656characters paired directly cross-domain (Official Portrait <-> Wild Illustration/Face).- Re-mined Top-15 hardest visual lookalikes directly from Stage-1 prototypes + same-series hard negatives.
- Strict Isolation Maintained: Excluded every held-out
val_unseen(1,000) andwild_unseen(50) character (448+127matching Zerochan folders and matching Danbooru tags).
- Linked
- Training Setup: Continued from Stage-1 checkpoint, 14 epochs Γ 550 steps =
7,700optimizer steps (p_anchors = 44->132images/step,35.5 GBVRAM on L40S,lr = 4.0e-5, frozen Stage-1 teacher distillation anchoranchor_w = 0.12, cosine LR,~11.9 min/epoch).
Stage-2 Validation Progression (val3k: 1,000 Unseen Queries vs 1,000 Unseen Targets + 2,000 Distractors)
| Epoch | Train Loss | Hit@1 | Hit@5 | Hit@10 | MRR@10 | Pos Sim | Hard-Neg Sim | Margin |
|---|---|---|---|---|---|---|---|---|
| 0 (Stage 1 Start) | - | 76.9% | 88.4% | 91.4% | 0.8173 | 0.6042 | 0.5073 | +0.0969 |
| 1 | 1.4814 | 77.8% | 88.4% | 91.3% | 0.8221 | 0.6053 | 0.4980 | +0.1073 |
| 2 | 1.3713 | 78.7% | 88.6% | 91.9% | 0.8315 | 0.6093 | 0.4948 | +0.1144 |
| 3 | 1.2983 | 79.5% | 89.3% | 92.1% | 0.8371 | 0.6120 | 0.4924 | +0.1196 |
| 4 | 1.2511 | 80.9% | 89.0% | 92.0% | 0.8452 | 0.6121 | 0.4900 | +0.1221 |
| 5 | 1.2127 | 81.2% | 89.6% | 92.4% | 0.8497 | 0.6115 | 0.4857 | +0.1258 |
| 6 | 1.1893 | 81.3% | 89.5% | 92.4% | 0.8509 | 0.6107 | 0.4813 | +0.1294 |
| 7 | 1.1518 | 81.1% | 90.3% | 93.1% | 0.8510 | 0.6126 | 0.4822 | +0.1304 |
| 8 | 1.1274 | 81.7% | 89.9% | 92.9% | 0.8549 | 0.6099 | 0.4785 | +0.1314 |
| 9 | 1.1203 | 81.9% | 90.3% | 92.9% | 0.8554 | 0.6110 | 0.4784 | +0.1326 |
| 10 | 1.0868 | 81.7% | 90.4% | 92.9% | 0.8547 | 0.6125 | 0.4791 | +0.1334 |
| 11 | 1.0676 | 81.7% | 90.4% | 93.0% | 0.8547 | 0.6103 | 0.4756 | +0.1346 |
| 12 (Selected Final) | 1.0704 | 82.0% | 90.5% | 93.0% | 0.8576 | 0.6113 | 0.4764 | +0.1350 |
| 13 | 1.0697 | 81.8% | 90.7% | 93.0% | 0.8563 | 0.6117 | 0.4767 | +0.1350 |
| 14 | 1.0551 | 81.8% | 90.7% | 92.9% | 0.8555 | 0.6111 | 0.4759 | +0.1352 |
4. Production Serving & Multi-Hardware Benchmarks (TensorRT 11.5 FP16/FP8, ONNX, L4, L40S, & ARM64 CPU)
Benchmarked across data-center GPUs (L40S 48GB, L4 24GB), fractional vGPU (L4-3Q 2.8 GB VRAM, 2 vCPU), and multi-core/single-core ARM64 CPU (Neoverse-V1):
| Compute Target / Runtime | p50 Single-Query |
p95 / Mean |
Throughput | Memory | Cos Parity vs L40S BF16 |
|---|---|---|---|---|---|
NVIDIA L4 (24GB, TRT 11.5 FP16, batch=1) |
5.12 ms |
p95 = 5.20 ms |
195.4 RPS (228.5 img/s @ bs32) |
~0.6 GB VRAM | 0.9999+ |
NVIDIA L40S (48GB, PyTorch BF16, 1 worker) |
9.11 ms (20.4β27.0 ms w/ I/O) |
p95 = 9.34 ms |
108.9 RPS (681.0 img/s @ bs256) |
708.9 MB VRAM |
Reference (1.000) |
NVIDIA L40S (48GB, PyTorch BF16, 2 workers) |
16.40 ms |
p95 = 17.02 ms |
120.3 RPS |
1,898.4 MB VRAM |
1.000 |
Fractional L4-3Q (2.8GB, TRT 11.5 FP16) |
34.04 ms |
p95 = 48.78 ms |
25.7 RPS (37.6 img/s @ bs16) |
590.8 MB engine |
0.9999+ |
Fractional L4-3Q (2.8GB, TRT 11.5 FP8 W8A16) |
49.18 ms |
p95 = 49.37 ms |
22.9 RPS (34.5 img/s @ bs16) |
293.7 MB weights |
0.9967+ |
Fractional L4-3Q (2.8GB, PyTorch BF16, 3 workers) |
119.34 ms (58.31 ms @ 1w) |
p95 = 135.60 ms |
23.3 RPS (17.1 RPS @ 1w) |
1,895.7 MB VRAM |
1.0000 |
Fractional L4-3Q (2.8GB, ORT CUDA FP16) |
66.67 ms |
p95 = 66.80 ms |
15.0 RPS (25.3 img/s @ bs16) |
β | 0.9999+ |
ARM64 CPU 8 Cores (Neoverse-V1, FP32) |
527.0 ms |
534.1 ms / p95 = 578.8 |
1.87 RPS |
2,166.6 MB RAM |
0.999919 |
ARM64 CPU 4 Cores (taskset -c 0-3, FP32) |
925.4 ms |
932.8 ms / p95 = 976.1 |
1.07 RPS |
2,150.9 MB RAM |
0.999919 |
ARM64 CPU 1 Core (taskset -c 0, FP32) |
2,622.1 ms |
2,629.4 ms / p95 = 2,686.2 |
0.38 RPS |
2,214.1 MB RAM |
0.999919 (min 0.9981) |
- Quantization Accuracy Verified (
165,615-Image Index):TensorRT 11.5 FP16: Held-Out Unseen (1k) =75.20% Hit@1 / 88.10% Hit@10| Wild OOD (50) =44.0% / 68.0%| Degraded Crops (300) =97.33%| Real-World User Queries (10) =100%TensorRT 11.5 FP8(146 quantized Linear/MatMul layers,293.7 MB): Held-Out Unseen (1k) =75.20% / 87.80%| Wild OOD (50) =42.0% / 68.0%| Real-World User Queries (10) =100%
5. Head-to-Head Comparison vs DeepGHS CCIP & Raw DINOv2-Large
Evaluated on identical NVIDIA L4 hardware over the held-out zero-leakage val3k benchmark (1,000 unseen character queries vs 1,000 unseen targets + 2,000 distractors), Balanced 1:1 pairs, and Hard-Negative 1:1 lookalike pairs:
| Model | val3k Hit@1 |
val3k Hit@5 |
val3k Hit@10 |
MRR@10 | Balanced F1 (ROC-AUC) |
Hard-Neg F1 (ROC-AUC / Margin) |
L4 Speed (bs=32) |
|---|---|---|---|---|---|---|---|
AAR-AnimeReID (TRT FP16) |
79.80% |
89.70% |
92.60% |
0.8409 |
0.9775 (0.9958) |
0.7795 (0.8023 / +0.130) |
228.5 img/s |
DeepGHS CCIP (Official) |
59.30% |
71.50% |
77.20% |
0.6468 |
0.9427 (0.9873) |
0.6667 (0.5775 / +0.008) |
75.5 img/s |
DINOv2-Large (Raw Pretrained) |
17.00% |
27.40% |
33.20% |
0.2160 |
0.7148 (0.7573) |
0.6667 (0.3220 / -0.089) |
β |
DeepGHS CCIPreproduced its published verification benchmark (F1 = 0.9427vs published0.941), whileAAR-AnimeReIDsurpassed it by+20.5%Hit@1,+3.48%Balanced F1,+0.225Hard-Neg ROC-AUC, and3.0Γthroughput.
6. Large-Scale Wild Safebooru Benchmark (3,000 Images) & Anime Profile Head Cropping
Stress-tested on 3,000 random Safebooru illustrations mapped to our 89,824-character catalog:
- Wild Safebooru Solo (
1,500images):1,500random solo illustrations across556unique characters (84strictly held-out unseen characters). - Wild Multi-Character Scenes (
1,500images):1,500random multi-character illustrations across915unique characters (1,081exact 2-char scenes +419scenes with 3+ characters;4,290heads detected).
Adding YOLO11 anime head detection (head_detect_v2.0_s_yv11, 16.87 ms p50, 97.73% solo detection rate) with profile head framing (profile_head_crop β expanding head bounding box to preserve hair + shoulders) lifted retrieval on the 165,615-image gallery immediately:
- Solo (
1,500imgs): Whole image37.47%-> Tight head41.93%->profile_head_crop43.27%Hit@1 (+5.80%) |59.33%Hit@10 (on the84held-out unseen subset:46.43%->53.57%Hit@1,77.38%->84.52%Hit@10) - Multi-Char (
1,500scenes, per-head search merge):Any-Hit@123.93%->38.33%(+14.4%),Any-Hit@1040.00%->60.00%(+20.0%),All-Found@105.27%->14.07%(2.7Γ)
7. Post-Retrieval Mathematical Re-Ranking (< 1 ms CPU)
Evaluated 8 scoring formulas over the Top-150 cosine candidate pool (165,615-image gallery):
| Formula / Method | Held-Out Unseen (1,000 queries) |
Cross-Pose (400 queries) |
Wild Safebooru Solo (1,500 queries) |
CPU Overhead |
|---|---|---|---|---|
Max-Sim (Baseline) |
75.6% / 0.7964 |
75.75% / 0.8105 |
43.27% / 0.4832 |
0.089 ms |
Top-3 Hybrid (0.7 max + 0.3 mean) |
75.2% / 0.7934 |
76.00% / 0.8104 |
43.60% / 0.4824 |
0.120 ms |
LogSumExp ($\tau = 0.05$) |
75.0% / 0.7938 |
77.00% / 0.8138 |
44.73% / 0.4965 |
0.644 ms |
Max + Centroid Hybrid |
(self-excluded) | (self-excluded) | 45.40% / 0.5016 |
0.328 ms |
CSLS (k=10) + Max |
77.5% / 0.8128 |
77.75% / 0.8249 |
43.13% / 0.4816 |
0.164 ms |
Ξ±-Query Expansion ($k=3, \alpha=3$) |
74.6% / 0.7850 |
76.00% / 0.8034 |
43.47% / 0.4763 |
0.235 ms |
k-Reciprocal Jaccard ($\lambda=0.5$) |
71.6% / 0.7658 |
72.25% / 0.7817 |
38.60% / 0.4376 |
8.529 ms |
CSLS (k=10) + LogSumExp (Ο=0.08) |
77.2% / 0.8139 |
79.25% / 0.8326 |
45.67% / 0.5033 |
~0.8 ms |
CSLS(k=10) + LogSumExp(Ο=0.08)suppressed hubness and rewarded multi-image consensus across every benchmark (< 1 msCPU), whereask-Reciprocal JaccardandΞ±-QEdegraded sparse 1β2 image galleries.
8. Expanded Multi-View Gallery (165,615 β 228,462 Images) & End-to-End Progression
Mapped 39,837 / 89,824 characters (97.5% Top-200, 94.1% Top-1,000, 90.8% Top-5,000) to Safebooru tags, embedded 62,847 clean multi-view images (29,404 full_body + 33,443 profile_head_crop, 10,678 unique characters) via TensorRT 11.5 FP16, expanding the search gallery to 228,462 images (with strict query post_id masking so zero test posts appear in search results):
Benchmark Suite (n) |
165K Whole-Img + Max-Sim | 165K + Profile Crop | 165K + Crop + CSLS+LSE |
228K + Crop + CSLS+LSE |
Total Gain (Hit@1) |
|---|---|---|---|---|---|
Wild Safebooru Solo (1,500 random solo images) |
37.47% / 55.07% |
43.27% / 59.33% |
45.67% / 60.80% |
60.67% / 74.20% (MRR 0.6510) |
+23.20% |
β³ Wild Safebooru Held-Out Subset (84 unseen-char imgs) |
46.43% / 77.38% |
53.57% / 84.52% |
63.10% / 86.90% |
72.62% / 89.29% (MRR 0.7887) |
+26.19% |
Wild OOD Web Fanart β All Untrained (50 external imgs) |
44.00% / 68.00% |
46.00% / 68.00% |
52.00% / 70.00% |
62.00% / 76.00% (MRR 0.6679) |
+18.00% |
β³ Held-Out Unseen Subset (38 unseen-char imgs) |
50.00% / 71.05% |
55.26% / 71.05% |
60.53% / 76.32% |
73.68% / 78.95% (MRR 0.7494) |
+23.68% |
β³ Single-Image Gallery Subset (12 1-shot gallery chars) |
25.00% / 58.33% |
16.67% / 58.33% |
25.00% / 50.00% |
25.00% / 66.67% (MRR 0.4097) |
+8.34% @10 |
Held-Out Unseen Characters vs Full Gallery (1,000 chars) |
75.50% / 88.10% |
β | 77.20% / 88.80% |
77.90% / 89.20% (MRR 0.8171) |
+2.40% |
Real-World Mixed User Queries (10 imgs, cosplay + Frieren) |
100.0% / 100.0% |
100.0% / 100.0% |
100.0% / 100.0% |
100.0% / 100.0% (MRR 1.0000) |
100.0% |
Wild Multi-Character Scenes (1,500 scenes) (Any@1 / Any@10 / All@10) |
23.93% / 40.00% / 5.27% |
38.33% / 60.00% / 14.07% |
42.47% / 63.60% / 15.60% |
51.53% / 74.20% / 20.93% (MRR 0.5947) |
+27.60% (4Γ All@10) |
Quick Usage (inference.py)
from inference import AnimeCharReID
# Auto-selects CUDA (BF16) or CPU (FP32)
encoder = AnimeCharReID(".")
embeddings = encoder.encode_images(["query_character.jpg"]) # shape: (1, 1024), L2-normalized
CLI test:
python inference.py --image query_character.jpg
Repository Contents
backbone/β Merged standalone Hugging FaceTransformersweights in full precision (config.json,model.safetensors,preprocessor_config.json)reid_head.ptβ Dual-pooling residual MLP head weights (full precision)fp16/β PortableFP16weights & graph (backbone/model.safetensors,reid_head.pt, and end-to-endmodel_fp16.onnx) for GPU / TensorRT / ONNX Runtime servingfp8/β PortableFP8(E4M3) quantized artifacts (model_fp8_e4m3fn.safetensors,model_fp8_qdq.onnx,config.json,preprocessor_config.json) for TensorRT FP8 / Ada-Lovelace & Hopper GPUsassets/β Evaluation and training progression charts embedded in this model cardinference.pyβ Minimal standalone PyTorch encoder helperLICENSEβ Apache License 2.0
Model Lineage, Upstream Attribution & Licensing
AAR-AnimeReID was not fine-tuned from any third-party anime Re-ID or anime DINOv2 checkpoint. Both curriculum stages were trained directly on top of Meta AI's facebook/dinov2-with-registers-large (Apache License 2.0), inheriting Apache-2.0.
| Component | Upstream Repository | Authors / Publisher | License | Role |
|---|---|---|---|---|
| Base Vision Backbone | facebook/dinov2-with-registers-large |
Meta AI Research | Apache License 2.0 | Direct pretrained ViT-L/14 base for Stage 1 & Stage 2; LoRA (1.0229%) merged into standalone weights. |
| Stage-2 Dataset | deepghs/character_similarity |
DeepGHS | HF Dataset Terms | Multi-view character pairs; images not redistributed. |
| Stage-2 Dataset | aipracticecafe/curated-danbooru-2026 |
aipracticecafe |
Apache License 2.0 | Auxiliary solo Danbooru illustrations; images not redistributed. |
| Head Detector (Optional) | deepghs/anime_head_detection (head_detect_v2.0_s_yv11) |
DeepGHS | MIT License | Optional pre-crop step (profile_head_crop) via dghs-imgutils. |
| Utilities / Eval | deepghs/imgutils & deepghs/ccip |
DeepGHS | MIT / OpenRAIL | Detection utility + CCIP head-to-head benchmark baseline only. |
| Tag Metadata | deepghs/site_tags |
DeepGHS | HF Dataset Terms | Character/series alias & tag mapping. |
@misc{darcet2024visiontransformersneedregisters,
title={Vision Transformers Need Registers},
author={TimothΓ©e Darcet and Maxime Oquab and Julien Mairal and Piotr Bojanowski},
year={2024},
eprint={2309.16588},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2309.16588}
}
Model tree for AARecords/AAR-AnimeReID
Base model
facebook/dinov2-with-registers-large


