MTG + Pokemon Card Embedder - DINOv3 Small
Built with DINOv3.
This shared model produces visual embeddings for Magic: The Gathering and Pokemon card images. It is intended for nearest-neighbor retrieval against a separately created local card catalog for the corresponding game; it does not directly classify or identify a card printing.
Model
- Architecture: DINOv3 ViT-S/16
- Base model:
facebook/dinov3-vits16-pretrain-lvd1689m - Image size: 224 x 224 pixels
- Embedding: final-layer CLS token, L2-normalized by the retrieval workflow
- Runtime: Hugging Face Transformers
Training
The v2 model was fine-tuned from facebook/dinov3-vits16-pretrain-lvd1689m using paired augmented views of cached MTG and Pokemon reference images. Joint-training batches contain exactly 16 cards from each game (batch size 32); contrastive loss is calculated separately per game so cross-game examples are not used as retrieval negatives. Each view can include brightness, contrast, and color changes; small rotation; blur; and perspective distortion.
Training configuration: 5 epochs, batch size 32, learning rate 1e-5, temperature 0.07, zero data-loader workers, seed 42, and a per-game 10% validation split. The complete training workflow is available in the Open Card Collector repository.
Usage
from PIL import Image
import torch
from transformers import AutoModel, AutoProcessor
model_id = "matteot11/collector-mtg-pkm-embedder-dinov3-small"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModel.from_pretrained(model_id).eval()
image = Image.open("card.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.inference_mode():
vector = model(**inputs).last_hidden_state[:, 0]
vector = torch.nn.functional.normalize(vector, dim=1)
Limitations
The model was fine-tuned for MTG and Pokemon card retrieval, not general-purpose image recognition or authoritative card identification. Retrieval quality can degrade with glare, motion blur, occlusion, low resolution, heavy cropping, uncommon printings, or reference catalogs that do not contain the target card. The nearest retrieved catalog item should be reviewed by a user.
License and Attribution
This model is a derivative of DINOv3 and is distributed under the DINOv3 License. Use, modification, and redistribution must comply with those terms.
The training workflow uses Magic card imagery obtained through Scryfall and Pokemon card imagery obtained through TCGdex. Card names, artwork, and related intellectual property belong to their respective rights holders. This repository does not distribute training images, catalog data, or derived catalog embeddings. Scryfall, TCGdex, Wizards of the Coast, Nintendo, and The Pokemon Company do not endorse this project.