Loading…
Loading…
CanViT-B with a CenterNet head on its canvas, trained end to end for COCO 2017 object detection; it predicts boxes after every glimpse.
CanViT, the Canvas Vision Transformer, is an active-vision foundation model: it sees a scene through a sequence of glimpses and remembers it on a scene-wide canvas.
Paper (NeurIPS 2026) · Code · Project page · All checkpoints
uv add canvit-nnx
import flax.nnx as nnx
import jax
import jax.numpy as jnp
import numpy as np
from PIL import Image
from canvit_nnx import sample_at_viewpoint
from canvit_nnx.detect.data import normalize
from canvit_nnx.detect.decode import decode
from canvit_nnx.detect.model import CanViTForObjectDetection
from canvit_nnx.policies import coarse_to_fine
image = Image.open("scene.jpg").convert("RGB").resize((512, 512), Image.Resampling.BILINEAR)
scene = normalize(jnp.asarray(np.asarray(image))[None])
model = nnx.view(CanViTForObjectDetection.from_pretrained("canvit/canvitb16-add-vpe-detect-g128px-s512px-coco-from-archctrl-2026-07-27-nnx"), use_running_average=True)
state = model.init_state(batch_size=1, canvas_grid_size=32)
for viewpoint in coarse_to_fine(jax.random.key(0), batch_size=1, num_glimpses=5):
glimpse = sample_at_viewpoint(spatial=scene, viewpoint=viewpoint, glimpse_size_px=128)
maps, state = model(glimpse=glimpse, state=state, viewpoint=viewpoint)
detections = decode(maps) # normalized (ymin, xmin, ymax, xmax) boxes, scores and COCO class indices
COCO val2017 (5000 images), C2F viewpoints: means over 5 independent viewpoint draws, with 95% bootstrap intervals over the draws where they vary.
| Glimpse | AP | AP50 | AP75 |
|---|---|---|---|
| 0 | 0.1201 | 0.2445 | 0.1071 |
| 1 | 0.1441 [0.1432, 0.1450] | 0.2823 [0.2805, 0.2841] | 0.1330 [0.1320, 0.1339] |
| 2 | 0.1616 [0.1610, 0.1622] | 0.3114 [0.3102, 0.3127] | 0.1505 [0.1496, 0.1512] |
| 3 | 0.1767 [0.1761, 0.1773] | 0.3376 [0.3366, 0.3388] | 0.1657 [0.1648, 0.1666] |
| 4 | 0.1902 [0.1899, 0.1904] | 0.3606 [0.3596, 0.3615] | 0.1807 [0.1799, 0.1814] |
The paper prints this AP, in percent, at glimpses 0, 1, 2, 3 and 4, in the row "CanViT-B (architecture control)" of its table "COCO val2017 AP by timestep, C2F policy" (appendix "COCO object detection"). python -m canvit_nnx.detect.evaluate (canvit_nnx.detect) scores a detector on val2017; it needs canvit-nnx[train].
| Backend | JAX / Flax NNX |
| Model class | CanViTForObjectDetection |
| Starting checkpoint | https://huggingface.co/canvit/canvitb16-add-vpe-pretrain-g128px-s512px-in1k-dv3b16-archctrl-2026-07-26-nnx |
| Training | step 16000 of 92411, 256 COCO train2017 scenes per step, 5 glimpses per rollout; the recipe is in provenance.json |
| Geometry | 512 px scenes, 128 px glimpses, 32 × 32 canvas |
| Classes | 80 |
MIT. CanViT is pretrained by distillation from DINOv3, which is released under the DINOv3 License.
@inproceedings{berreby2026canvit,
title={CanViT: Toward Active-Vision Foundation Models},
author={Berreby, Yoha{\"i}-Eliel and Du, Sabrina and Durand, Audrey and Krishna, B. Suresh},
booktitle={Advances in Neural Information Processing Systems},
year={2026},
eprint={2603.22570},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2603.22570}
}