Single-Backbone Depth-Ray Representation for Arbitrary-View Visual Geometry Recovery
This article explains how to recover depth, camera poses, point clouds, and scene surfaces from images or video using one standard Transformer backbone and a depth-ray representation. It covers the underlying principles, training objectives, engineering implementation, evaluation methods, and risk controls, and it shows how this design reduces the number of task-specific branches.
Visual geometry recovery aims to infer geometric structures from images or video that can be verified in 3D space. These structures include depth, camera poses, point clouds, and scene surfaces. Traditional pipelines split depth estimation, pose estimation, and multi-view reconstruction into separate subproblems, each with its own network head, loss function, and post-processing. This approach works in practice, but it causes module coupling, error propagation, scale inconsistency, and complex deployment. A recent trend uses a more unified representation to carry several geometric outputs. The model learns on a single backbone how pixels map to spatial rays, then recovers spatial structure by combining rays and depth. This article focuses on a single Transformer vision backbone with a depth-ray representation. It covers the principles, training methods, engineering implementation, evaluation and diagnosis, and risk control.
1. Background: Where the Complexity of Multi-Task Geometry Modeling Comes From
Three factors drive the complexity of multi-task geometry modeling.
First, the task objectives differ. Depth estimation measures the distance from each pixel to the camera. Pose estimation measures the relative transform between cameras. Point cloud reconstruction focuses on the position and density of spatial points. Mesh reconstruction focuses on surface topology. Each task requires a different output space, supervision signal, and error metric. A shared backbone can easily produce gradient conflicts.
Second, the system depends heavily on camera parameters. Converting a depth map into 3D space requires intrinsic parameters, and multi-view fusion also requires extrinsic parameters. If camera poses are unknown at test time, the system must estimate them, and errors accumulate at each stage.
Third, scale and consistency are hard to guarantee. Monocular depth has scale ambiguity, and multi-view predictions can drift between views. Without unified constraints in post-processing, a result may look plausible in a single frame but fail to align across frames.
The minimal modeling approach reduces the number of task branches. It puts geometry predictions into one interpretable intermediate representation. A standard Transformer encoder extracts visual features. The decoder outputs ray-related geometric quantities, and a unified post-processing step recovers depth, point clouds, or view relations. This approach does not reject multi-task learning. It turns multiple tasks into multiple supervision signals over a unified representation, which lowers the complexity of both the model structure and the engineering pipeline.
2. Core Idea: Single Backbone and Depth-Ray Representation
A single backbone means the model has one visual encoder. The input can be a single image, multiple images, or video frames. The encoder splits each image into visual tokens and processes them with standard Transformer layers for global modeling. Compared with separate branches for each task, a single backbone shares cues such as texture, edges, occlusion, and semantics more easily. It also transfers better across input types. “Standard Transformer” means the model does not depend on highly specialized geometry modules. A general visual representation does most of the feature extraction.
The depth-ray representation is the key to a unified geometric output. For each pixel, the model predicts the parameters of the spatial ray that corresponds to that pixel. These parameters include the ray origin, the ray direction, the depth along the ray, and a confidence value. A ray links pixel coordinates directly to 3D space. When camera parameters are known, the camera model determines the ray, so the model mainly learns depth. When camera parameters are unknown, the model can learn a view-dependent ray field or relative ray relations. It then recovers spatial structure using multi-view consistency constraints. This representation makes the relation between camera, pixel, and spatial point explicit, so depth, pose, and point clouds can be interpreted within one framework.
In abstract terms, the depth-ray representation is a conditional mapping. Given a pixel location and its visual features, it predicts the spatial ray for that pixel and the forward distance along that ray. With multiple views, rays from different viewpoints should intersect or nearly intersect in 3D space. Training uses reprojection, photometric consistency, and geometric consistency constraints to align the ray predictions in space. Compared with training separate depth, pose, and point cloud heads, a unified ray representation reduces the information lost when converting between output spaces. It also makes post-processing easier to control.
3. Architecture: Encoding, Decoding, and Unified Output
A practical architecture usually has four parts: input organization, visual encoding, geometric decoding, and spatial recovery. Input organization arranges single images, multiple images, or video frames into a uniform batch and can optionally attach camera parameters. Visual encoding uses a standard Transformer and outputs single-scale or multi-scale features. Geometric decoding outputs ray parameters, depth, and confidence for each pixel or query position. Spatial recovery selects a path based on whether camera parameters are known. With known parameters, it back-projects directly. With unknown parameters, it combines relative rays, reprojection constraints, or a lightweight pose solver.
The following pseudocode illustrates the flow:
Input: image set I, optional camera parameters CEncoding: F = single Transformer visual encoder(I)Decoding: for each pixel p:Ray parameters R(p) = ray head(F, p) # origin, direction, depth, confidenceDepth value D(p) = depth head(F, p)Confidence W(p) = confidence head(F, p)Loss: L = L_ray + L_depth + L_reprojection + L_smoothness + L_confidenceOutput: spatially consistent ray, depth, and point cloud representation
The architecture involves several key trade-offs. The first is output density versus memory cost. Per-pixel ray parameters carry a lot of information, but high resolution increases memory and compute demands. Multi-scale decoding, sparse queries, or chunked inference can reduce this cost. The second is global modeling versus local detail. Transformers capture global relations well, but geometric edges and fine structures need local constraints. Edge-aware smoothing can be added to the loss or to post-processing. The third is confidence modeling. Geometric predictions often fail in low-texture, occluded, transparent, and reflective regions. An explicit confidence value helps later fusion and filtering, but the model must be calibrated during training to avoid high-confidence errors.
4. Training Objectives: Aligning Rays Across Views
Whether a unified representation works depends on whether the training objectives enforce spatial consistency. Common supervision falls into five groups.
- Ray or depth supervision. If depth or ray ground truth is available, the predicted values can be supervised directly. Without dense ground truth, sparse points, relative depth, or synthetic data can be used.
- Photometric consistency. Reproject predicted 3D points into another view and compare the colors or features of the corresponding pixels. This forces the geometric predictions for different views to agree.
- Geometric consistency. Constrain the agreement of multi-view ray intersections, surface normals, or local planes to reduce drift between views.
- Smoothness and edge preservation. Apply smoothing to weak-texture regions while avoiding smoothing across object boundaries.
- Confidence calibration. Make the model lower its confidence in unreliable regions instead of forcing it to output incorrect geometry.
Unknown camera pose is the hardest part of training. If poses are completely unknown, the model must learn relative view relations or estimate poses during training through joint optimization. Common engineering strategies include the following. Pretrain on data with known poses, then fine-tune with self-supervision on data with unknown poses. Perturb relative poses in multi-view samples to improve robustness. Constrain both pixel-level rays and view-level transforms in the loss, so the model does not memorize single-frame appearance. Scale ambiguity cannot be fully removed from monocular appearance alone. It must be reduced through multi-view constraints, camera motion priors, or external scale signals.
5. Engineering: From Data Pipeline to Inference Service
In practice, the data pipeline and inference path matter as much as the model. On the data side, image size, color
