vggt 动态追踪 实时重建

https://github.com/facebookresearch/vggt

import torch
from vggt.models.vggt import VGGT
from vggt.utils.load_fn import load_and_preprocess_images

device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = torch.bfloat16  # or torch.float16

# Initialize the model and load the pretrained weights.
# This will automatically download the model weights the first time it's run, which may take a while.
model = VGGT.from_pretrained("facebook/VGGT-1B").to(device)

# Load and preprocess example images (replace with your own image paths)
image_names = ["path/to/imageA.png", "path/to/imageB.png", "path/to/imageC.png"]  
images = load_and_preprocess_images(image_names).to(device)

with torch.no_grad() and torch.cuda.amp.autocast(dtype=dtype):
    # Predict attributes including cameras, depth maps, and point maps.
    predictions = model(images)

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐