Views
No views yet
demo.py:1conda create -n 3dpt python=3.10.12 -y
2conda activate 3dpt
3conda install pytorch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 pytorch-cuda=12.1 -c pytorch -c nvidia -y
4pip install -r https://raw.githubusercontent.com/ethz-vlg/mvtracker/refs/heads/main/requirements.txt
5
6# Optional, speeds up the model
7pip install --upgrade --no-build-isolation flash-attn==2.5.8 # Speeds up attention
8pip install "git+https://github.com/ethz-vlg/pointcept.git@2082918#subdirectory=libs/pointops" # Speeds up kNN search; may require gcc 11.3.0: conda install -c conda-forge gcc_linux-64=11.3.0 gxx_linux-64=11.3.0 gcc=11.3.0 gxx=11.3.01import torch
2import numpy as np
3from huggingface_hub import hf_hub_download
4
5device = "cuda" if torch.cuda.is_available() else "cpu"
6mvtracker = torch.hub.load("ethz-vlg/mvtracker", "mvtracker", pretrained=True, device=device)
7
8# Example input from demo sample (downloaded automatically)
9sample = np.load(hf_hub_download("ethz-vlg/mvtracker", "data_sample.npz"))
10rgbs = torch.from_numpy(sample["rgbs"]).float()
11depths = torch.from_numpy(sample["depths"]).float()
12intrs = torch.from_numpy(sample["intrs"]).float()
13extrs = torch.from_numpy(sample["extrs"]).float()
14query_points = torch.from_numpy(sample["query_points"]).float()
15
16with torch.no_grad():
17 results = mvtracker(
18 rgbs=rgbs[None].to(device) / 255.0,
19 depths=depths[None].to(device),\
20 intrs=intrs[None].to(device),
21 extrs=extrs[None].to(device),
22 query_points_3d=query_points[None].to(device),
23 )
24
25pred_tracks = results["traj_e"].cpu() # [T,N,3]
26pred_vis = results["vis_e"].cpu() # [T,N]
27print(pred_tracks.shape, pred_vis.shape)1@inproceedings{rajic2025mvtracker,
2 title = {Multi-View 3D Point Tracking},
3 author = {Raji{\v{c}}, Frano and Xu, Haofei and Mihajlovic, Marko and Li, Siyuan and Demir, Irem and G{\"u}ndo{\u{g}}du, Emircan and Ke, Lei and Prokudin, Sergey and Pollefeys, Marc and Tang, Siyu},
4 booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
5 year = {2025}
6}