Instructions to use HanClinto/milo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- CollectorVision
How to use HanClinto/milo with CollectorVision:
pip install git+https://github.com/HanClinto/CollectorVision huggingface_hub
from huggingface_hub import hf_hub_download import collector_vision as cvg checkpoint = hf_hub_download(repo_id="HanClinto/milo", filename="model.onnx") # Detector models, such as Cornelius: detector = cvg.NeuralCornerDetector(checkpoint) # Embedder models, such as Milo: embedder = cvg.NeuralEmbedder(checkpoint)
- Notebooks
- Google Colab
- Kaggle
File size: 2,231 Bytes
0bcb5f8 2de5e4a 290fa81 0bcb5f8 2de5e4a 0bcb5f8 2de5e4a 0bcb5f8 2de5e4a | 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 | ---
license: agpl-3.0
library_name: collectorvision
tags:
- onnx
- image-retrieval
- metric-learning
- arcface
- mobilevit
base_model: apple/mobilevit-xx-small
---
# Milo — CCG Card Embedder
MobileViT-XXS backbone trained with ArcFace loss (multitask: illustration_id + set_code) to produce 128-dimensional L2-normalised embeddings of CCG card images for nearest-neighbour retrieval.
## Model details
| Property | Value |
|---|---|
| Architecture | MobileViT-XXS + linear projection |
| Input | 448×448 RGB, ImageNet-normalised |
| Output | 128-d L2-normalised embedding vector |
| Parameters | ~1.0M |
| File size | 5.2 MB (fp32 ONNX) |
| Codename | milo |
| Version | 1.0.0 (epoch 15) |
| Training labels | illustration_id + set_code (multitask ArcFace) |
## Usage
The easiest way to use Milo is through the [CollectorVision](https://github.com/HanClinto/CollectorVision) library, which handles corner detection, dewarping, gallery loading, and nearest-neighbour search:
```python
import collector_vision as cvg
cvid = cvg.Identifier(cvg.HFD("HanClinto/milo", "scryfall-mtg"))
result = cvid.identify("photo.jpg")
print(result.ids) # {"scryfall_id": "..."}
print(result.confidence) # 0.94
```
### Direct ONNX usage
```python
import onnxruntime as ort
import numpy as np
from PIL import Image
session = ort.InferenceSession("model.onnx")
# Preprocess: resize to 448×448, ImageNet normalise, NCHW float32
img = Image.open("card_crop.jpg").convert("RGB").resize((448, 448))
x = np.array(img, dtype=np.float32) / 255.0
x = (x - [0.485, 0.456, 0.406]) / [0.229, 0.224, 0.225]
x = x.transpose(2, 0, 1)[None] # (1, 3, 448, 448)
emb = session.run(None, {"pixel_values": x})[0] # (1, 128) float32, L2-normalised
```
Cosine similarity between two embeddings is just their dot product (both are unit vectors).
## Gallery compatibility
Gallery files built with Milo v1.0.0 use `milo1` in their filename. Embeddings from different Milo versions are **not** compatible — rebuild the gallery when upgrading.
## Part of CollectorVision
Used together with [HanClinto/cornelius](https://huggingface.co/HanClinto/cornelius) in the [CollectorVision](https://github.com/HanClinto/CollectorVision) inference library.
|