Views
No views yet
torch.hub.load. The Hub entry points download ViT-Up weights from Hugging Face and load the matching DINOv3 backbone.1import torch
2
3device = "cuda" if torch.cuda.is_available() else "cpu"
4
5# Available entry points:
6# - vit_up_dinov3_splus
7# - vit_up_dinov3_base
8model = torch.hub.load(
9 "krispinwandel/vit-up",
10 "vit_up_dinov3_splus",
11 pretrained=True,
12 trust_repo=True,
13 device=device,
14).eval()
15
16images = torch.randn(1, 3, 448, 448, device=device)
17query_coords = torch.rand(1, 100, 2, device=device) # normalized (x, y) in [0, 1]
18
19with torch.no_grad():
20 features = model(images, query_coords)
21
22print(features.shape) # (B, N_queries, D)
23
24# Alternative API
25model.set_images(images)
26features = []
27query_chunk_size = 10
28for i in range(0, query_coords.shape[1], query_chunk_size):
29 chunk_coords = query_coords[:, i : i + query_chunk_size]
30 chunk_features = model(query_coords=chunk_coords)
31 features.append(chunk_features)
32features = torch.cat(features, dim=1)
33print(features.shape) # (B, N_queries, D)1@misc{wandel2026vitupfaithfulfeatureupsampling,
2 title={ViT-Up: Faithful Feature Upsampling for Vision Transformers},
3 author={Krispin Wandel and Jingchuan Wang and Hesheng Wang},
4 year={2026},
5 eprint={2606.14024},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2606.14024},
9}