File size: 2,549 Bytes
fa30eb7 | 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 | ---
license: apache-2.0
pipeline_tag: image-feature-extraction
tags:
- pet-re-identification
- image-embeddings
- onnx
- dinov2
library_name: onnx
---
# pet-recognition-base
Individual **pet re-identification** embeddings (dogs and cats) β the "which pet is this"
layer used by [Gallery](https://opennoodle.de)'s pet recognition, on top of whole-animal
crops from its pet detector.
A **frozen [`facebook/dinov2-base`](https://huggingface.co/facebook/dinov2-base)** backbone (86M
parameters) plus a **trained linear projection** to 512 dimensions. The projection's
L2-normalized output *is* the embedding; identity is compared with cosine similarity.
Fine-tuning the backbone was tried and rejected β it overfits the training identities and
forgets DINOv2's general features, while the frozen-backbone projection beats zeroshot on
both species.
## I/O contract
| | |
| --- | --- |
| Input | `input`, float32 `[N, 3, 224, 224]`, RGB, ImageNet mean/std normalized |
| Output | `embedding`, float32 `[N, 512]`, **L2-normalized** |
| Batch | dynamic |
| Opset | 17 |
Crop the detected animal's bounding box, resize to 224x224, normalize with ImageNet
statistics (mean `[0.485, 0.456, 0.406]`, std `[0.229, 0.224, 0.225]`). Compare embeddings
with cosine similarity (equivalently, dot product β the outputs are unit vectors).
## Quality
Verification EER and identification Top-1 on **held-out identities** β individuals never
seen in training β scored over the complete test splits:
| Test set | Images | Identities | EER | Top-1 | AUC |
| --- | --- | --- | --- | --- | --- |
| Dogs β Dogs-World (whole animal) | 53830 | 16469 | 0.047 | 0.612 | 0.988 |
| Cats β Cat Individual Images (whole animal) | 2575 | 102 | 0.045 | 0.916 | 0.991 |
| Dogs β DogFaceNet (unseen dataset, aligned faces) | 8363 | 1393 | 0.031 | 0.943 | 0.994 |
## Training data & licensing
The backbone is Apache-2.0. The projection was trained **only** on openly-licensed data:
- **Dogs-World** (CC0) β whole-animal dog photos, identity from the per-image metadata
sidecars; single-dog images only.
- **Cat Individual Images** (CC BY) β whole-animal cat photos, one directory per cat.
DogFaceNet (CC BY) is used for evaluation only. No restrictively-licensed pet re-ID
dataset (PetFace, AvitoTech, MegaDescriptor) was used for training or distillation, so
this model is safe for commercial use.
## Siblings
`pet-recognition-small` / `pet-recognition-base` / `pet-recognition-large` trade accuracy
against cost; `base` is Gallery's default.
|