Downloads · 30 days
0
realphongha/danbooru-tag-query
danbooru-tag-query is a image classification model from realphongha. Use it when you need a label for an image. It is set up for onnx. The card lists the license as other.
Lightweight multi-label anime image tagger using DINOv3 ViT backbone and a cross-attention tag query head, trained on Danbooru images.
Downloads · 30 days
0
Access
Public
Updated Aug 12, 2026
Repo size
28.4 GB
Likes
6
Public
Click a slice to open those files.
.pt15.3 GB · 90%
From the Hugging Face model README
Lightweight multi-label anime image tagger using DINOv3 ViT backbone and a cross-attention tag query head, trained on Danbooru images.
GitHub repo
You can try our models here:
realphongha/DanbooruTagQuery
Image → ViT backbone (DINOv3) → patch tokens → cross-attention → per-tag logits.
Each tag is a single learnable embedding vector (a "query"). An nn.MultiheadAttention layer computes attention between all tag queries and all ViT patch tokens; each query's attended feature is projected through a scalar linear classifier. No MLP, no positional encoding — the query itself encodes "what to look for". This design is modular: the head can be swapped without touching the dataset, training loop, or metrics.
Input image (448×448)
│
▼
┌─────────────────────┐
│ DINOv3 │ pretrained ViT backbone
└─────────┬───────────┘
│ tokens: (B, N_patches+5, D)
▼
┌─────────────────────┐
│ Tag Query Head │
│ │
│ tag_queries: │ learned (num_tags, D)
│ (num_tags, D) ─────┼─→ cross-attention ──→ tag features (B, num_tags, D)
│ │ queries attend to ViT patch tokens
│ classifier: │
│ Linear(D→1) ───────┘ → logits (B, num_tags)
└─────────────────────┘
│
▼
sigmoid(logits) → per-tag probabilities
Evaluated against popular community taggers on the intersection evaluation subset (3,383 tags present in every model's vocabulary), drawn from a held-out danbooru2025 test set of images with post ID > 7220105 (avoids contamination with WD-SwinV2 training data). Each model ran at its native resolution; thresholds searched over [0.10, 0.15, …, 0.95].
| Model | Params | Input | Latency | mAP | Macro F1 | Micro F1 | Best threshold |
|---|---|---|---|---|---|---|---|
| Ours (L/16) - trained from scratch | 319.0M | 448×448 | 36.6ms | 0.5352 | 0.4775 | 0.6884 | 0.20 |
| WD-eva02-large-tagger-v3 | 315.2M | 448×448 | 50.3ms | 0.4822 | 0.4344 | 0.6684 | 0.30 |
| Ours (B/16) - trained from scratch | 96.8M | 448×448 | 24.9ms | 0.4693 | 0.4195 | 0.6684 | 0.20 |
| WD-SwinV2-tagger-v3 | 98.0M | 448×448 | 35.8ms | 0.4603 | 0.4140 | 0.6474 | 0.15 |
| ML-Danbooru | 68.9M | 448×448 | 34.0ms | 0.4023 | 0.3490 | 0.5952 | 0.60 |
| JoyTag | 91.5M | 448×448 | 20.2ms | 0.3783 | 0.3429 | 0.6179 | 0.35 |
| DeepDanbooru (CNN) | 161.0M | 512×512 | 33.6ms | 0.2100 | 0.1920 | 0.4692 | 0.15 |
Key results:
Latency measured on a single NVIDIA RTX 5090 (PyTorch eager for local runs; ONNX Runtime for ONNX-exported models).
Note: this model tags adult (NSFW) content. Danbooru contains explicit imagery and its tag vocabulary reflects that. Do not use in contexts where such content is unacceptable.
trojblue/danbooru2025-metadatatag_string_general + tag_string_character + tag_string_copyright unified; tags with frequency ≥ 100; images with ≥ 2 tagsdata/ignored_tags.txttrojblue/danbooru2025-metadata — training datasrc/compared_models/: DeepDanbooru, WD-tagger, ML-Danbooru, JoyTag