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-2026-08-01-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=21):
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.1931 | 0.3517 | 0.1881 |
| 1 | 0.2208 [0.2204, 0.2212] | 0.3868 [0.3861, 0.3874] | 0.2185 [0.2172, 0.2201] |
| 2 | 0.2437 [0.2430, 0.2446] | 0.4197 [0.4183, 0.4210] | 0.2434 [0.2412, 0.2448] |
| 3 | 0.2643 [0.2637, 0.2648] | 0.4489 [0.4483, 0.4496] | 0.2653 [0.2633, 0.2672] |
| 4 | 0.2839 [0.2837, 0.2842] | 0.4753 [0.4747, 0.4759] | 0.2875 [0.2872, 0.2878] |
| 5 | 0.2870 [0.2866, 0.2873] | 0.4788 [0.4782, 0.4793] | 0.2914 [0.2910, 0.2917] |
| 6 | 0.2895 [0.2892, 0.2899] | 0.4822 [0.4814, 0.4830] | 0.2939 [0.2933, 0.2946] |
| 7 | 0.2929 [0.2924, 0.2934] | 0.4870 [0.4861, 0.4880] | 0.2974 [0.2964, 0.2987] |
| 8 | 0.2951 [0.2946, 0.2955] | 0.4901 [0.4894, 0.4907] | 0.2999 [0.2992, 0.3007] |
| 9 | 0.2978 [0.2974, 0.2982] | 0.4943 [0.4937, 0.4950] | 0.3027 [0.3015, 0.3038] |
| 10 | 0.3005 [0.3003, 0.3009] | 0.4979 [0.4968, 0.4991] | 0.3061 [0.3050, 0.3073] |
| 11 | 0.3029 [0.3024, 0.3034] | 0.5015 [0.5007, 0.5024] | 0.3087 [0.3072, 0.3105] |
| 12 | 0.3053 [0.3051, 0.3056] | 0.5058 [0.5050, 0.5071] | 0.3115 [0.3108, 0.3121] |
| 13 | 0.3076 [0.3073, 0.3080] | 0.5092 [0.5082, 0.5106] | 0.3145 [0.3136, 0.3154] |
| 14 | 0.3100 [0.3094, 0.3106] | 0.5128 [0.5115, 0.5144] | 0.3171 [0.3161, 0.3181] |
| 15 | 0.3126 [0.3117, 0.3135] | 0.5165 [0.5150, 0.5180] | 0.3200 [0.3183, 0.3217] |
| 16 | 0.3146 [0.3138, 0.3154] | 0.5198 [0.5181, 0.5215] | 0.3228 [0.3218, 0.3240] |
| 17 | 0.3170 [0.3163, 0.3175] | 0.5233 [0.5223, 0.5245] | 0.3254 [0.3247, 0.3262] |
| 18 | 0.3194 [0.3190, 0.3197] | 0.5263 [0.5250, 0.5276] | 0.3281 [0.3272, 0.3289] |
| 19 | 0.3216 [0.3213, 0.3219] | 0.5297 [0.5288, 0.5307] | 0.3304 [0.3297, 0.3310] |
| 20 | 0.3242 [0.3241, 0.3244] | 0.5334 [0.5329, 0.5339] | 0.3337 [0.3330, 0.3344] |
The paper prints this AP, in percent, at glimpses 0, 1, 2, 3, 4, 9 and 20, in the row "CanViT-B (flagship)" 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-in21k-dv3b16-2026-02-02-nnx |
| Training | step 16172 of 16172, 1024 COCO train2017 scenes per step, 10 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}
}