maelic/relsgg-vits16plus

Model

relsgg-vits16plus

0

stars

15

commits

1

linked in READMEs

Sep 14, 2026

updated

model-index
onnx
open-vocabulary
relsgg
scene-graph-generation
visual-relationship-detection

README

relsgg-vits16plus

Open-vocabulary relation prediction from any boxes or masks. Give the model an image and regions from any source (a detector, a segmenter, ground truth); it returns ranked relations over a predicate vocabulary supplied at inference, and optionally two graphs (spatial + semantic) from the same forward pass. Object class labels are never an input.

Part of RelateAnything (code · paper). Trained on RA-4M; evaluated with OV-SGG-Bench.

Use it

pip install git+https://github.com/Maelic/RelateAnything
hf download maelic/relsgg-vits16plus          # optional; the API fetches on first use
from relsgg import RelateAnything

# Regions come from any detector, any segmenter, or your own annotation.
# Object class labels are never an input.
model = RelateAnything.from_pretrained("maelic/relsgg-vits16plus", device="cuda")
for t in model.predict(image, boxes_xyxy, topk=20):    # PIL/ndarray, boxes [N, 4] in pixels
    print(t)                                           # (person) --riding [0.67]--> (horse)

# Masks instead of boxes: pass the [N, H, W] binary masks beside their extents.
triplets = model.predict(image, boxes_xyxy, masks=masks, topk=20)

# The vocabulary is an input. Any strings, at any time, without retraining.
model.set_vocabulary(["about to collide with", "reflected in"])

# Or answer from the whole training vocabulary, 19,103 strings, read from the weights.
model = RelateAnything.from_pretrained("maelic/relsgg-vits16plus", full_vocabulary=True, device="cuda")

# Two graphs from one forward pass.
graphs = model.predict(image, boxes_xyxy, decompose=True)   # {"spatial": [...], "semantic": [...]}

Every vocabulary is encoded once by the text student shipped beside the weights, and the head is reparameterized onto it; scoring afterwards is vision only. full_vocabulary=True reads predicate_embeddings.npz instead of encoding, which turns a minute and a half of CPU work into a download. model.pth embeds the backbone configuration, so running these weights needs no gated DINOv3 login.

Files: model.pth (torch, EMA weights), text_student.pt + tokenizer, predicate_embeddings.npz (the training vocabulary, encoded), relateanything.onnx, predicate_bank.npz, thresholds.json, calibration.json, README.md.

Every number below is generated from measured eval artifacts (release/make_model_cards.py); none is hand-typed.

Closed-vocabulary transfer (reparameterized, TEST, graph-constrained)

sourceR@50mR@50F1@50
vg1500.5330.2820.369
psg0.4010.3060.347
indoorvg0.5270.2950.378
hicodet0.4520.3140.371

Open-vocabulary, NO reparameterization (all 19,103 predicates deployed)

Synonym-matched at the calibrated tau (see provenance). This is the honest "the model never saw your label set" protocol.

sourceSoftR@50SoftmR@50SoftF1@50
vg1500.5600.3450.427
psg0.3050.2830.294
indoorvg0.5330.3460.419

Spatial reasoning (SpatialSense, adversarial true/false; chance = 0.5)

Macro AUC over predicates: 0.6897

Two-graph decomposition (spatial / semantic, type-stratified protocol)

sourcespatial R@50 / mR@50semantic R@50 / mR@50
vg1500.632 / 0.3080.497 / 0.309
psg0.608 / 0.5430.408 / 0.330
indoorvg0.609 / 0.3460.420 / 0.299

Deployment thresholds (per-predicate best-F1, measured on THIS checkpoint)

Score scales are checkpoint-specific (the output head is rank-trained), so these thresholds transfer to no other model. Regime: gt boxes, pair_weight=0, 5000 val images. Top predicates by support:

predicatethresholdbest F1GT support
behind0.9000.3303599
in front of0.8700.3473575
wearing0.9800.6903417
to the right of0.8550.3853198
to the left of0.8600.3723097
resting on0.9750.5792166
on0.9350.4572043
holding0.9750.4561552
beside0.9800.1961406
next to0.9400.2351352
above0.8800.3211280
below0.8950.3171240
part of0.9050.4841134
supporting0.9850.194947
looking at0.9550.256872

Provenance

runrelsgg-vits16plus
gite9ea42aed60f766f12ad19d51709129c50110a3b
backbonefacebook/dinov3-vits16plus-pretrain-lvd1689m
text studentruns/packed/text_student_v2_512/student.pt sha256 e0317830b68ea51e...
ONNX opset / parity17 / max
torch / transformers2.13.0+cu130 / 5.14.1
training mixturemegasg_clean + vg_raw + hicodet, per-image 0.727/0.063/0.210; source-aware negatives: ['hicodet']

License and data notices

Weights are a derivative of Meta DINOv3 pretrained weights and are distributed under the DINOv3 license. Training annotations (RA-4M) were generated by gemma-4-26B and carry the Gemma Terms of Use notice; images are referenced by identifier only (Objects365/COCO/OpenImages). The vg_raw subset derives from Visual Genome (CC BY 4.0). Predicate synonyms are deliberately never collapsed — surface-form diversity is part of the label space. Full notices: THIRD_PARTY_NOTICES.md in the code repository.

Citation

@article{neau2026relateanything,
  title   = {RelateAnything: Real-Time Open-Vocabulary Relation Prediction From Any Inputs},
  author  = {Neau, Ma\"elic},
  journal = {arXiv preprint arXiv:2609.12552},
  eprint  = {2609.12552},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CV},
  url     = {https://arxiv.org/abs/2609.12552},
  year    = {2026}
}

Contributors

maelic

15 commits

maelic/relsgg-vits16plus

Model

relsgg-vits16plus

0

stars

15

commits

1

linked in READMEs

Sep 14, 2026

updated

model-index
onnx
open-vocabulary
relsgg
scene-graph-generation
visual-relationship-detection

README

relsgg-vits16plus

Open-vocabulary relation prediction from any boxes or masks. Give the model an image and regions from any source (a detector, a segmenter, ground truth); it returns ranked relations over a predicate vocabulary supplied at inference, and optionally two graphs (spatial + semantic) from the same forward pass. Object class labels are never an input.

Part of RelateAnything (code · paper). Trained on RA-4M; evaluated with OV-SGG-Bench.

Use it

pip install git+https://github.com/Maelic/RelateAnything
hf download maelic/relsgg-vits16plus          # optional; the API fetches on first use
from relsgg import RelateAnything

# Regions come from any detector, any segmenter, or your own annotation.
# Object class labels are never an input.
model = RelateAnything.from_pretrained("maelic/relsgg-vits16plus", device="cuda")
for t in model.predict(image, boxes_xyxy, topk=20):    # PIL/ndarray, boxes [N, 4] in pixels
    print(t)                                           # (person) --riding [0.67]--> (horse)

# Masks instead of boxes: pass the [N, H, W] binary masks beside their extents.
triplets = model.predict(image, boxes_xyxy, masks=masks, topk=20)

# The vocabulary is an input. Any strings, at any time, without retraining.
model.set_vocabulary(["about to collide with", "reflected in"])

# Or answer from the whole training vocabulary, 19,103 strings, read from the weights.
model = RelateAnything.from_pretrained("maelic/relsgg-vits16plus", full_vocabulary=True, device="cuda")

# Two graphs from one forward pass.
graphs = model.predict(image, boxes_xyxy, decompose=True)   # {"spatial": [...], "semantic": [...]}

Every vocabulary is encoded once by the text student shipped beside the weights, and the head is reparameterized onto it; scoring afterwards is vision only. full_vocabulary=True reads predicate_embeddings.npz instead of encoding, which turns a minute and a half of CPU work into a download. model.pth embeds the backbone configuration, so running these weights needs no gated DINOv3 login.

Files: model.pth (torch, EMA weights), text_student.pt + tokenizer, predicate_embeddings.npz (the training vocabulary, encoded), relateanything.onnx, predicate_bank.npz, thresholds.json, calibration.json, README.md.

Every number below is generated from measured eval artifacts (release/make_model_cards.py); none is hand-typed.

Closed-vocabulary transfer (reparameterized, TEST, graph-constrained)

sourceR@50mR@50F1@50
vg1500.5330.2820.369
psg0.4010.3060.347
indoorvg0.5270.2950.378
hicodet0.4520.3140.371

Open-vocabulary, NO reparameterization (all 19,103 predicates deployed)

Synonym-matched at the calibrated tau (see provenance). This is the honest "the model never saw your label set" protocol.

sourceSoftR@50SoftmR@50SoftF1@50
vg1500.5600.3450.427
psg0.3050.2830.294
indoorvg0.5330.3460.419

Spatial reasoning (SpatialSense, adversarial true/false; chance = 0.5)

Macro AUC over predicates: 0.6897

Two-graph decomposition (spatial / semantic, type-stratified protocol)

sourcespatial R@50 / mR@50semantic R@50 / mR@50
vg1500.632 / 0.3080.497 / 0.309
psg0.608 / 0.5430.408 / 0.330
indoorvg0.609 / 0.3460.420 / 0.299

Deployment thresholds (per-predicate best-F1, measured on THIS checkpoint)

Score scales are checkpoint-specific (the output head is rank-trained), so these thresholds transfer to no other model. Regime: gt boxes, pair_weight=0, 5000 val images. Top predicates by support:

predicatethresholdbest F1GT support
behind0.9000.3303599
in front of0.8700.3473575
wearing0.9800.6903417
to the right of0.8550.3853198
to the left of0.8600.3723097
resting on0.9750.5792166
on0.9350.4572043
holding0.9750.4561552
beside0.9800.1961406
next to0.9400.2351352
above0.8800.3211280
below0.8950.3171240
part of0.9050.4841134
supporting0.9850.194947
looking at0.9550.256872

Provenance

runrelsgg-vits16plus
gite9ea42aed60f766f12ad19d51709129c50110a3b
backbonefacebook/dinov3-vits16plus-pretrain-lvd1689m
text studentruns/packed/text_student_v2_512/student.pt sha256 e0317830b68ea51e...
ONNX opset / parity17 / max
torch / transformers2.13.0+cu130 / 5.14.1
training mixturemegasg_clean + vg_raw + hicodet, per-image 0.727/0.063/0.210; source-aware negatives: ['hicodet']

License and data notices

Weights are a derivative of Meta DINOv3 pretrained weights and are distributed under the DINOv3 license. Training annotations (RA-4M) were generated by gemma-4-26B and carry the Gemma Terms of Use notice; images are referenced by identifier only (Objects365/COCO/OpenImages). The vg_raw subset derives from Visual Genome (CC BY 4.0). Predicate synonyms are deliberately never collapsed — surface-form diversity is part of the label space. Full notices: THIRD_PARTY_NOTICES.md in the code repository.

Citation

@article{neau2026relateanything,
  title   = {RelateAnything: Real-Time Open-Vocabulary Relation Prediction From Any Inputs},
  author  = {Neau, Ma\"elic},
  journal = {arXiv preprint arXiv:2609.12552},
  eprint  = {2609.12552},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CV},
  url     = {https://arxiv.org/abs/2609.12552},
  year    = {2026}
}

Contributors

maelic

15 commits