ATTENTION!

Hello there! I have to admit this is my first "research" project. You might find a lot of gaps here, or things the writer still has doubts about.

I put "research" in quotes on purpose. Yet not a "researcher", ran the experiment myself, hands-on, and I wrote a technical report about what I did and what came out. If something looks wrong, it probably is, and I'd be glad to hear about it (contact me here).


Statue of Pangeran Diponegoro, Monumen Nasional, Jakarta

Reconstructed from a phone video walking around the statue. Frames go into VGGT, single forward pass, no optimization loop. Drag to rotate, scroll to zoom.

Color normalized, 15 frames. Best result.
Plain frames, 30 frames. Second best.

VGGT

VGGT (Visual Geometry Grounded Transformer) is a neural network from Oxford's Visual Geometry Group and Meta AI, published at CVPR 2025. It has about 1.2 billion parameters.

Give it photos of one scene. For every photo it returns the camera, the depth of every pixel, and the 3D position of every pixel.

Background: Why Depth Can Be Recovered

A photo is flat. It loses depth. But if the camera moves, a point close to the camera shifts a lot in the image, and a far point shifts little. [Recall: Parallax]

For two cameras side by side, this becomes one formula:

$$ Z = \frac{f \, B}{d} $$

\(d\) is in the denominator: large shift means close, small shift means far. If the camera only rotates without moving, \(B = 0\) and depth cannot be recovered.

Background: The Classic Pipeline

Structure from Motion (SfM, used by tools like COLMAP) works with a camera model. A 3D point \(\mathbf{X}\) lands in photo \(i\) at pixel:

$$ \mathbf{x} = \pi\big(K_i \, (R_i \mathbf{X} + \mathbf{t}_i)\big), \qquad \pi\!\begin{pmatrix} a \\ b \\ c \end{pmatrix} = \begin{pmatrix} a/c \\ b/c \end{pmatrix} $$

SfM finds distinctive points in every photo, matches them across photos, and makes a first guess of all cameras and 3D points. Then bundle adjustment refines that guess by solving:

$$ \min_{\{R_i,\, \mathbf{t}_i,\, K_i\},\; \{\mathbf{X}_j\}} \; \sum_{i,j} \rho\Big( \big\| \mathbf{x}_{ij} - \pi\big(K_i (R_i \mathbf{X}_j + \mathbf{t}_i)\big) \big\|^2 \Big) $$

The result is cameras plus a sparse set of 3D points (only at matched points). Dense depth for every pixel needs a second stage, Multi-View Stereo (MVS).

VGGT replaces both stages with a single network. The photos pass through it once (feed-forward). No optimization loop is needed, although bundle adjustment can still be added afterwards.

flowchart LR
    subgraph S["Classic pipeline"]
        direction TB
        S1["Find distinctive points
in each photo"] --> S2["Match them
between photos"] S2 --> S3["First guess:
cameras + 3D points"] S3 --> S4["Bundle adjustment
(refine the guess)"] S4 -.-> S4 S4 --> S5["Sparse points + cameras"] S5 --> S6["Multi-View Stereo"] S6 --> S7["Dense depth + point cloud"] end subgraph V["VGGT"] direction TB V1["All photos"] --> V2["One pass through
the network"] V2 --> V3["Cameras + dense depth
+ point cloud"] end S ~~~ V

What VGGT Computes

VGGT is one function \(f\) that maps all photos to four outputs per photo:

$$ f\big( (I_i)_{i=1}^{N} \big) = \big( \mathbf{g}_i,\; D_i,\; P_i,\; T_i \big)_{i=1}^{N} $$
Output Shape Meaning
\(\mathbf{g}_i\)\(\mathbb{R}^{9}\)camera of photo \(i\)
\(D_i\)\(\mathbb{R}^{H \times W}\)depth map: how far in front of the camera each pixel is, along the viewing axis (z)
\(P_i\)\(\mathbb{R}^{3 \times H \times W}\)point map: 3D position per pixel, in photo 1's coordinates
\(T_i\)\(\mathbb{R}^{C \times H \times W}\)tracking features, used by the track head

Inside, three stages: tokenize, mix with attention, read out with heads.

flowchart TB
    A["N photos"] --> B["Tokenize
DINO patch tokens
+ 1 camera token + 4 register tokens"] B --> C["Backbone
24 × (frame attention → global attention)"] C --> D["Camera head
reads camera tokens"] C --> E["Dense head (DPT)
reads patch tokens"] D --> F["g: rotation, translation,
field of view"] E --> G["D, P + confidence
per pixel"] E --> H["Track head
reads T"] H --> I["2D position of a point
in every photo"]

Tokenize

A transformer reads tokens: vectors of \(C\) numbers, each describing one small piece of the input.

Each photo is resized to a longest side of 518 px and cut into small square patches. A pretrained image model, DINO, turns every patch into a token:

$$ \mathbf{t}^{I}_i = \text{DINO}(I_i) \in \mathbb{R}^{m \times C} $$

\(m\) is the number of patches; it depends on image size. Then two kinds of learned tokens are added in front:

$$ \mathbf{X}_i = \big[\; \mathbf{t}^{g}_i \;,\; \mathbf{t}^{R}_i \;,\; \mathbf{t}^{I}_i \;\big] \in \mathbb{R}^{n \times C}, \qquad n = 1 + 4 + m $$

Photo 1 gets its own learned camera and register tokens. Photos 2 to \(N\) share a second set. This tells the model which photo is the reference: all 3D output is in photo 1's frame. Photos 2 to \(N\) start with identical extra tokens and only become distinct through attention, so their order does not matter.

Attention

Attention lets each token pull information from other tokens. Given tokens \(\mathbf{X}\), three learned matrices make three views of them:

$$ Q = \mathbf{X} W_Q, \qquad K = \mathbf{X} W_K, \qquad V = \mathbf{X} W_V $$ $$ \text{Attn}(\mathbf{X}) = \text{softmax}\!\left( \frac{Q K^{\top}}{\sqrt{C}} \right) V $$

Example: the token for the statue's nose in photo 2 gives a high score to the nose token in photo 5, and a low score to a sky token. It then absorbs mostly the nose information.

Alternating Attention

All tokens together form a tensor of shape \(N \times n \times C\). VGGT applies the same attention operation to two different groupings of it:

Frame attention Global attention
Grouping \(N\) separate sequences of shape \(n \times C\) 1 sequence of shape \(Nn \times C\)
A token sees tokens of its own photo tokens of all photos
Learns each image alone: edges, shapes, what is in front of what the same spot across photos, which is what parallax needs
Score pairs \(N \cdot n^2\) \((Nn)^2 = N^2 n^2\)

The backbone has \(L = 24\) layers. Each layer runs one of each, in order:

$$ \mathbf{X} \;\leftarrow\; \text{GlobalAttn}\big( \text{FrameAttn}(\mathbf{X}) \big) \qquad \text{repeated } 24 \text{ times} $$

Global attention costs \(N\) times more than frame attention, because it compares every token with every token in every photo. This is why memory grows quickly with more photos.

There are no cross-attention layers and no hand-written 3D rules. All geometry is learned from data.

flowchart LR
    subgraph FA["Frame attention: N × (n × C)"]
        direction TB
        F1["Photo 1 ↔ Photo 1"]
        F2["Photo 2 ↔ Photo 2"]
        F3["Photo 3 ↔ Photo 3"]
    end
    subgraph GA["Global attention: (Nn) × C"]
        direction TB
        G1["Photo 1 ↔ Photo 2 ↔ Photo 3
every token sees every token"] end FA --> GA GA -- "repeat × 24" --> FA

Camera Head

A head is a small network that turns tokens into one kind of answer. The camera head reads each photo's camera token after the backbone, passes it through 4 more self-attention layers and one linear layer:

$$ \hat{\mathbf{g}}_i = \text{Linear}\big( \text{SelfAttn}^{\times 4}(\hat{\mathbf{t}}^{g}_i) \big) = \big[\, \mathbf{q}_i \in \mathbb{R}^4,\; \mathbf{t}_i \in \mathbb{R}^3,\; \mathbf{f}_i \in \mathbb{R}^2 \,\big] $$

Rotation \(\mathbf{q} = (x, y, z, w)\). A quaternion: four numbers that encode a 3D rotation. It converts to a rotation matrix:

$$ R(\mathbf{q}) = \begin{pmatrix} 1 - 2(y^2 + z^2) & 2(xy - zw) & 2(xz + yw) \\ 2(xy + zw) & 1 - 2(x^2 + z^2) & 2(yz - xw) \\ 2(xz - yw) & 2(yz + xw) & 1 - 2(x^2 + y^2) \end{pmatrix} $$

Quaternions are used instead of 9 matrix entries because 4 numbers are enough and they avoid invalid rotations.

Translation \(\mathbf{t}\). Together with \(R\), it maps a world point into this camera's view: \(\mathbf{X}_{\text{cam}} = R\,\mathbf{X} + \mathbf{t}\).

Field of view \(\mathbf{f} = (\theta_w, \theta_h)\). How wide the lens sees, horizontally and vertically. It gives the lens matrix:

$$ f_x = \frac{W}{2 \tan(\theta_w / 2)}, \qquad f_y = \frac{H}{2 \tan(\theta_h / 2)}, \qquad K = \begin{pmatrix} f_x & 0 & W/2 \\ 0 & f_y & H/2 \\ 0 & 0 & 1 \end{pmatrix} $$

Dense Head (DPT)

Patch tokens are coarse: one token covers a whole patch of pixels. DPT (Dense Prediction Transformer) rearranges the patch tokens back into an image-shaped grid and upsamples it step by step to full resolution, producing a feature map \(F_i\). A final 3×3 convolution turns \(F_i\) into:

$$ F_i \;\longrightarrow\; \hat{D}_i,\; \Sigma^{D}_i,\; \hat{P}_i,\; \Sigma^{P}_i,\; T_i $$

Track Head

Follows one point across all photos. Built on the CoTracker2 design.

  1. Pick a query pixel \(\mathbf{y}_q\) in one photo.
  2. Read its feature from \(T_q\) by bilinear sampling (it may fall between pixels): \(\mathbf{h} = T_q(\mathbf{y}_q)\).
  3. Compare \(\mathbf{h}\) with every pixel feature of every other photo \(i\). High similarity marks likely matches.
  4. Self-attention layers refine these matches into a 2D position \(\hat{\mathbf{y}}_i\) and a visibility score for each photo.

It does not assume the photos are in time order, so it works on unordered photos, not just video.

From Output to Point Cloud

The point map \(\hat{P}\) already holds 3D points. But the paper reports a more accurate route: build the points from depth and camera instead (unprojection). For pixel \((u, v)\) of photo \(i\):

$$ \mathbf{X}_{\text{cam}} = \hat{D}_i(u, v) \cdot K_i^{-1} \begin{pmatrix} u \\ v \\ 1 \end{pmatrix} \qquad\qquad \mathbf{X}_{\text{world}} = R_i^{\top} \big( \mathbf{X}_{\text{cam}} - \mathbf{t}_i \big) $$

Then keep only confident pixels:

$$ \text{keep } (u, v) \;\text{ if }\; \Sigma^{D}_i(u, v) \ge \tau $$
flowchart TB
    A["Pixel (u, v)"] --> C
    B["Depth D(u, v)"] --> C
    C["Point relative to camera
X_cam = D · K⁻¹ · [u, v, 1]"] --> D D["Point in shared frame
X_world = Rᵀ · (X_cam − t)"] --> E E{"Confidence ≥ τ ?"} -- yes --> F["Keep → point cloud"] E -- no --> G["Drop"]

Repeat for every pixel of every photo. The result is a point cloud: colored dots in 3D, not a solid surface. In this experiment the point cloud is turned into a mesh afterwards (see Experiment).

The threshold \(\tau\) is a trade-off: higher gives a cleaner but emptier cloud, lower gives a fuller but noisier one.

Training Objective

Training shows the network scenes where the true cameras, depths, points, and tracks are known. A loss measures how wrong the predictions are. Training lowers it.

$$ \mathcal{L} = \mathcal{L}_{\text{camera}} + \mathcal{L}_{\text{depth}} + \mathcal{L}_{\text{pmap}} + \lambda\, \mathcal{L}_{\text{track}}, \qquad \lambda = 0.05 $$

The first three are on similar scales, so they get equal weight. Tracking gets a low weight.

Camera loss.

$$ \mathcal{L}_{\text{camera}} = \sum_{i=1}^{N} \big\| \hat{\mathbf{g}}_i - \mathbf{g}_i \big\|_{\epsilon} $$

\(\|\cdot\|_{\epsilon}\) is the Huber loss. For an error \(r\):

$$ \rho_\epsilon(r) = \begin{cases} \tfrac{1}{2} r^2 & |r| \le \epsilon \\[4pt] \epsilon \big( |r| - \tfrac{1}{2}\epsilon \big) & |r| > \epsilon \end{cases} $$

Squared for small errors (smooth), linear for large ones (a few bad samples cannot dominate).

Depth loss.

$$ \mathcal{L}_{\text{depth}} = \sum_{i=1}^{N} \underbrace{\big\| \Sigma^{D}_i \odot (\hat{D}_i - D_i) \big\|}_{\text{(1) error}} + \underbrace{\big\| \Sigma^{D}_i \odot (\nabla \hat{D}_i - \nabla D_i) \big\|}_{\text{(2) gradient error}} - \underbrace{\alpha \log \Sigma^{D}_i}_{\text{(3) uncertainty cost}} $$

Point-map loss. Same form as depth, with \(\hat{P}_i, P_i, \Sigma^{P}_i\).

Track loss.

$$ \mathcal{L}_{\text{track}} = \sum_{j=1}^{M} \sum_{i=1}^{N} \big\| \mathbf{y}_{j,i} - \hat{\mathbf{y}}_{j,i} \big\| $$

For \(M\) query points and \(N\) photos: distance between true and predicted 2D position. A visibility term (binary cross-entropy) is added, following CoTracker2.

Normalization. Ground truth is expressed in photo 1's frame, then scaled by:

$$ s = \frac{1}{|\mathcal{X}|} \sum_{\mathbf{x} \in \mathcal{X}} \|\mathbf{x}\|, \qquad \mathbf{t} \leftarrow \mathbf{t}/s,\quad P \leftarrow P/s,\quad D \leftarrow D/s $$

\(\mathcal{X}\) is the set of all true 3D points of the scene. After scaling, the average point is at distance 1 from the origin. Predictions are not rescaled; the network learns this convention. This is why VGGT output has no real-world units.


Experiment

Three subjects in Jakarta, each filmed as a walk-around video on a phone: Bundaran HI (the Selamat Datang Monument), Monumen Nasional (the Monas obelisk), and the Pangeran Diponegoro statue at Monas. The videos, sampled frames, external photos, and all notebooks are in the experiment repository.

Pipeline

flowchart TB
    A["Walk-around video"] --> B["Frame sampling
sharpest frame per interval"] B --> C["Color normalization
(optional)"] C --> D["Sky removal
(optional, Monas only)
paint sky white"] D --> E["VGGT
single forward pass:
depth + camera"] E --> F["Unproject
keep top 50% confidence
(+ drop sky pixels)"] F --> G["Clean
downsample + remove outliers"] G --> H["Poisson mesh"] H --> I["GLB"]

1. Frame sampling video360_ke_foto.ipynb

A walk-around video has thousands of nearly identical frames, many blurred by motion. I split the video into N equal intervals and keep only the sharpest frame of each.

jarak = total // JUMLAH                     # frames per interval

for i in range(total):
    ok, frame = cap.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    skor = cv2.Laplacian(gray, cv2.CV_64F).var()   # sharpness score

    if skor > skor_terbaik:                      # remember the sharpest so far
        terbaik, skor_terbaik = frame, skor

    if (i + 1) % jarak == 0:                     # interval ends: keep the winner
        cv2.imwrite(f"{OUT}/{n:03d}.png", terbaik)
        terbaik, skor_terbaik = None, 0
  • The Laplacian highlights edges. A sharp frame has many strong edges, so the variance of the Laplacian is high; a blurry frame scores low.
  • Bundaran HI: 13,923 frames (232 s at 60 fps). For 15 photos, one pick per 928 frames.

2. Stitching the Monas video append_monas.ipynb

Monas was filmed in three clips. I join them into one video before sampling.

tulis("monas-1.mp4")
tulis("monas-2.mp4")
tulis("monas-3-reversed.mp4", balik=True)   # written back to front
# every frame is resized to 1080 × 1920 (portrait)

3. Color normalization 01_color_normalization.ipynb

Exposure and white balance drift while filming, so the same surface can look different between frames. I reshape every frame's colors to match one reference frame.

reference = frames[len(frames) // 2]           # middle frame of the set
result = match_histograms(image, reference, channel_axis=-1)
  • Histogram matching: for each channel (R, G, B), pixel values are remapped so their distribution matches the reference.
  • It changes color only. Geometry, shadows, and lighting direction stay the same.

4. VGGT forward pass vggt_to_mesh.ipynb

model = VGGT.from_pretrained("facebook/VGGT-1B").to("cuda").eval()
model.track_head = None        # not needed for a 3D model
model.point_head = None        # use depth + camera instead (more accurate)

images = load_and_preprocess_images(paths, mode="pad")   # (S, 3, H, W)
with torch.autocast("cuda", dtype=torch.bfloat16):
    pred = model(images)                                  # the single forward pass

extr, intr = pose_encoding_to_extri_intri(pred["pose_enc"], images.shape[-2:])
depth = pred["depth"]          # D, per pixel
conf  = pred["depth_conf"]     # Σ^D, per pixel (≥ 1)
  • S is the number of photos (\(N\) in the formulas above).
  • mode="pad": the longest side becomes 518 px and the short side is padded to a square, so nothing is cropped.
  • bfloat16 halves memory with little loss in accuracy.
  • pose_enc holds the 9 camera numbers, ordered translation (3), quaternion (4), field of view (2). pose_encoding_to_extri_intri turns them into \([R \mid \mathbf{t}]\) and \(K\), using the image size.

5. Depth to points, filtered by confidence

pts  = unproject_depth_map_to_point_map(depth, extr, intr)   # (S, H, W, 3)
keep = conf > np.percentile(conf, 50)                         # top 50% most confident
points, colors = pts[keep], rgb[keep]                         # flat list of (x, y, z)
  • unproject_depth_map_to_point_map is the formula in "From Output to Point Cloud": \(\mathbf{X} = R^{\top}(D \cdot K^{-1}[u, v, 1]^{\top} - \mathbf{t})\) for every pixel.
  • Instead of a fixed \(\tau\), I keep the most confident half of all pixels across all photos.

6. Sky removal vggt_to_mesh.ipynb (Monas runs only)

A sky segmentation model marks which pixels are sky. Those pixels are painted white before VGGT, so the model never sees the sky, and they are dropped again from the point cloud afterwards.

sky_session = onnxruntime.InferenceSession("skyseg.onnx")   # from huggingface: JianyuanWang/skyseg

def not_sky(img):
    x = cv2.resize(img, (320, 320))                            # model input size
    x = (x - [0.485, 0.456, 0.406]) / [0.229, 0.224, 0.225]     # ImageNet normalization
    out = sky_session.run(None, {"input": x})[0]               # sky score per pixel
    out = (out - out.min()) / (out.max() - out.min()) * 255    # rescale to 0..255
    return cv2.resize(out, (w, h)) < 32                        # True = not sky

# before VGGT: paint the sky white
sky = ~np.stack([not_sky(im) for im in images.permute(0, 2, 3, 1).cpu().numpy()])
images = images.masked_fill(torch.from_numpy(sky).to(images.device)[:, None], 1.0)

pred = model(images)                                         # VGGT sees white instead of sky

# after VGGT: drop sky pixels from the point cloud too
keep &= ~sky
  • The mask is computed on the already resized input (518 px), so it lines up pixel for pixel with the depth map. No extra resizing needed.
  • A pixel counts as sky when its rescaled score is 32 or higher (out of 255).
  • White is a neutral choice: with mode="pad", VGGT already fills the padding with a plain color.

7. Remember which camera saw each point

cams = -np.einsum("sji,sj->si", R, t)      # camera centers: C = −Rᵀ t
view = (cams[:, None, None] - pts)[keep]     # direction: point → its camera
  • A camera's center is where \(\mathbf{X}_{\text{cam}} = \mathbf{0}\). Solving \(R\mathbf{C} + \mathbf{t} = \mathbf{0}\) gives \(\mathbf{C} = -R^{\top}\mathbf{t}\).
  • This direction is needed later to decide which side of the surface faces outward.

8. Clean the point cloud

pcd = pcd.voxel_down_sample(size / 1000)          # merge points inside small cubes
pcd, _ = pcd.remove_statistical_outlier(20, 2.0)    # drop floating points
  • Voxel downsampling: space is cut into cubes 1/1000 of the scene size; points in one cube become one point. Millions of points shrink to hundreds of thousands without losing the shape.
  • Statistical outlier removal: a point is dropped if its average distance to its 20 nearest neighbors is more than 2 standard deviations above normal.

9. Build the mesh

pcd.estimate_normals()
n[(n * view).sum(1) < 0] *= -1                # flip normals that point away from the camera

mesh, dens = create_from_point_cloud_poisson(pcd, depth=9)
mesh.remove_vertices_by_mask(dens < np.quantile(dens, 0.05))   # drop invented surface
mesh = mesh.crop(pcd.get_axis_aligned_bounding_box())
  • A normal is the direction a surface faces. Estimated from neighbors, it can point in or out at random. A surface seen by a camera must face that camera, so if the normal and the point-to-camera direction disagree (dot product < 0), it is flipped.
  • Poisson surface reconstruction wraps one closed surface around the points. depth=9 means a 2⁹ = 512 grid per side.
  • Poisson also fills areas with no data. dens counts how many real points support each vertex; the weakest 5% are removed, then the mesh is cut to the point cloud's bounding box.

10. Export

vertices * [1, -1, -1]      # OpenCV (y down, z forward) → glTF (y up, z back)

Without this flip the model opens upside down in model-viewer, three.js, or Blender.

Runs

Numbers are frame counts. Green marks a usable model; darker is better.

Plain 153060 120240360
Bundaran HI✗✗✗✗✗✗
Monumen Nasional✗✗✗✗✗✗
Diponegoro statue✓✓ good✓✓✓✓
Color normalized 153060 120240360
Bundaran HI✗✗✗✗––
Monumen Nasional✗✗✗✗––
Diponegoro statue✓ best✓✓✓––
Color normalized + sky removal 153060 120
Monumen Nasional✗✗✗✗
Sky removal + external photos 4 + 5960 + 5960 + 59 N 4 + 59 N
Monumen Nasional✗✗✗✗

Failures: Bundaran HI and Monas

Every run on these two scenes failed. Some examples:

Bundaran HI, plain, 30 frames
Bundaran HI, color normalized, 120 frames
Monas, plain, 30 frames
Monas, color normalized, 15 frames

Why It Likely Failed

These are my guesses, not tested causes. Each one links back to how VGGT works.

Why Diponegoro Worked

The statue is close, fills most of the frame, has rich texture, and the walk around it creates strong parallax. The best run used only 15 frames, inside the 2 to 24 range VGGT was trained on.

Symbol Glossary

Symbol Meaning
Sizes and indices
\(N\)number of photos
\(i\)photo index, \(1 \dots N\). Photo 1 is the reference
\(j\)3D point index (bundle adjustment) or query point index (tracking)
\(H, W\)image height and width, in pixels
\(m\)patch tokens per photo (depends on image size)
\(n\)all tokens per photo: \(n = 1 + 4 + m\)
\(C\)channels: how many numbers make up one token or one feature vector
\(L\)number of backbone layers (24)
\(M\)number of query points in the track loss
Points and pixels
\(I_i\)photo \(i\), shape \(3 \times H \times W\) (RGB)
\((u, v)\)pixel position: column, row. Origin at the top-left corner
\(\mathbf{X}\)a 3D point \((x, y, z)\)
\(\mathbf{X}_{\text{cam}}\)a 3D point relative to one camera; \(z\) is how far in front of it
\(\mathbf{X}_{\text{world}}\)a 3D point in the shared frame (photo 1's camera)
\(\mathbf{x}\), \(\mathbf{x}_{ij}\)a 2D pixel position; \(\mathbf{x}_{ij}\) is where point \(j\) was found in photo \(i\)
\(\mathcal{X}\)set of all true 3D points of a scene (used for normalization)
Camera
\(\mathbf{g}_i\)camera of photo \(i\): 9 numbers \([\mathbf{q}_i, \mathbf{t}_i, \mathbf{f}_i]\)
\(\mathbf{q}\)rotation as a quaternion \((x, y, z, w)\), 4 numbers
\(R\)rotation as a 3×3 matrix, built from \(\mathbf{q}\)
\(R^{\top}\)transpose of \(R\); for a rotation it equals the inverse (undoes the rotation)
\(\mathbf{t}\)translation, 3 numbers. \(\mathbf{X}_{\text{cam}} = R\mathbf{X} + \mathbf{t}\)
\(\mathbf{f} = (\theta_w, \theta_h)\)field of view: how wide the lens sees, horizontally and vertically
\(f\), \(f_x, f_y\)focal length in pixels (how zoomed in). Large \(f\) = narrow view
\(c_x, c_y\)principal point; VGGT assumes the image center \((W/2, H/2)\)
\(K\), \(K_i\)lens matrix (intrinsics), built from \(f_x, f_y, c_x, c_y\). Turns a camera-relative point into pixels
\(K^{-1}\)inverse of \(K\). Turns a pixel into a viewing direction
\(\pi\)perspective division: divide by depth \(z\), so far things appear smaller
Parallax
\(Z\)distance of a point from the camera
\(B\)baseline: distance between two cameras
\(d\)disparity: how far a point shifted between two photos, in pixels
Network
\(f(\cdot)\)the whole VGGT network, as one function
\(\mathbf{t}^{I}_i\)patch tokens of photo \(i\), from DINO
\(\mathbf{t}^{g}_i\)camera token of photo \(i\)
\(\mathbf{t}^{R}_i\)the 4 register tokens of photo \(i\)
\(\mathbf{X}_i\) (in attention)all \(n\) tokens of photo \(i\), stacked: shape \(n \times C\)
\(Q, K, V\) (in attention)query, key, value: what a token looks for, what it offers, what it passes on. This \(K\) is not the lens matrix
\(W_Q, W_K, W_V\)learned matrices that make \(Q, K, V\) from the tokens
\(F_i\)full-resolution feature map inside the dense head
Outputs
\(D_i\)depth map: per pixel, how far in front of the camera (along \(z\))
\(P_i\)point map: per pixel, 3D position in photo 1's frame
\(\Sigma^{D}_i, \Sigma^{P}_i\)per-pixel confidence for the depth map and the point map
\(T_i\)tracking features: one feature vector per pixel
\(\mathbf{y}_q\)query pixel chosen for tracking
\(\mathbf{h}\)feature read from \(T_q\) at \(\mathbf{y}_q\)
\(\mathbf{y}_{j,i}\)2D position of query point \(j\) in photo \(i\)
\(\tau\)confidence threshold for keeping a point
Loss
\(\mathcal{L}\)total loss: how wrong the predictions are
\(\lambda\)weight of the track loss (0.05)
\(\alpha\)weight of the uncertainty cost in the depth and point-map loss
\(\rho\), \(\rho_\epsilon\), \(\|\cdot\|_\epsilon\)robust function; here the Huber loss with threshold \(\epsilon\)
\(s\)scale factor: average distance of the true 3D points from the origin
Notation
\(\hat{\ }\) (hat)a prediction. \(\hat{D}\) = predicted depth, \(D\) = true depth
\(\mathbb{R}^{a \times b}\)a grid of real numbers with shape \(a \times b\)
\(\|\cdot\|\)length (size) of a vector, i.e. distance
\(\odot\)multiply element by element (pixel by pixel)
\(\nabla\)gradient: change between neighboring pixels
\(^{\top}\)transpose: swap rows and columns
\(\leftarrow\)replace the left side with the right side

References