Views
No views yet
uv add "canvit-mlx[hub] @ git+https://github.com/yberreby/CanViT-MLX.git"1import mlx.core as mx
2from canvit_mlx import load_from_hf_hub, load_and_preprocess, Viewpoint, extract_glimpse_at_viewpoint
3
4model = load_from_hf_hub("canvit/canvitb16-add-vpe-pretrain-g128px-s512px-in21k-dv3b16-2026-02-02-mlx")
5image = load_and_preprocess("path/to/image.jpg", target_size=512)
6
7state = model.init_state(batch_size=1, canvas_grid_size=32)
8vp = Viewpoint.full_scene(batch_size=1)
9glimpse = extract_glimpse_at_viewpoint(image, vp, glimpse_size_px=128)
10out = model(glimpse, state, vp)
11mx.eval(out.state.canvas, out.state.recurrent_cls, out.local_patches)
12
13canvas_spatial = model.get_spatial(out.state.canvas) # [1, G*G, canvas_dim]1@article{berreby2026canvit,
2 title={CanViT: Toward Active-Vision Foundation Models},
3 author={Berreby, Yoha{\"i}-Eliel and Du, Sabrina and Durand, Audrey and Krishna, B. Suresh},
4 year={2026},
5 eprint={2603.22570},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV}
8}