DiffusionSfM: Predicting Structure and Motion via Ray Origin and Endpoint Diffusion

Qitao Zhao, Amy Lin, Jeff Tan, Jason Y. Zhang, Deva Ramanan, Shubham Tulsiani

Abstract

Current Structure-from-Motion (SfM) methods typically follow a two-stage pipeline, combining learned or geometric pairwise reasoning with a subsequent global optimization step. In contrast, we propose a data-driven multi-view reasoning approach that directly infers 3D scene geometry and camera poses from multi-view images. Our framework, DiffusionSfM, parameterizes scene geometry and cameras as pixel-wise ray origins and endpoints in a global frame and employs a transformer-based denoising diffusion model to predict them from multi-view inputs. To address practical challenges in training diffusion models with missing data and unbounded scene coordinates, we introduce specialized mechanisms that ensure robust learning. We empirically validate DiffusionSfM on both synthetic and real datasets, demonstrating that it outperforms classical and learning-based approaches while naturally modeling uncertainty.

Introduction

Recovering 3D structure and camera motion from images (SfM) is a cornerstone of computer vision. However, most existing methods—from classical tools like COLMAP to recent deep-learning models like DUSt3R—rely on a two-stage process. First, they estimate pairwise relationships, such as matching points between two images, and then they run a computationally expensive "global optimization" (Bundle Adjustment) to align these observations into a single 3D coordinate system.

This traditional approach suffers from several drawbacks. Global optimization is memory-intensive and often fails to converge if initial pairwise matches contain even slight errors. Furthermore, most regression-based models provide only a single "best guess," failing to represent the inherent geometric uncertainty present in sparse or ambiguous image sets.

The DiffusionSfM Framework

DiffusionSfM reimagines SfM as a generative task, replacing the multi-stage pipeline with a single, end-to-end denoising diffusion model.

Ray-Based Scene Representation

Instead of predicting abstract rotation matrices or standard XYZ coordinates, DiffusionSfM predicts two values for every pixel in every input image:

  • Ray Origin ($O$): The 3D location of the camera center.
  • Ray Endpoint ($E$): The 3D location of the point on the object's surface that the pixel "sees."

By predicting these values in a shared global frame, the model implicitly solves for both camera positions and scene geometry simultaneously. This over-parameterization—predicting a camera center for every pixel—actually acts as an implicit regularizer, helping the model maintain consistency across the entire image.

DiffusionSfM pipeline: Input images are processed through a denoising diffusion transformer that iteratively refines ray origins and endpoints to recover 3D point clouds and camera poses.

Denoising Diffusion Transformer

The core architecture is a Diffusion Transformer (DiT). It begins with a "noisy" map of ray origins and endpoints and iteratively refines them into a coherent 3D scene. This process is conditioned on deep image features extracted via a pre-trained DINOv2 encoder.

To make training feasible on real-world data, the authors introduced several key innovations:

  1. Homogeneous Coordinates: To handle "unbounded" scenes (e.g., distant backgrounds), the model uses a unit-norm homogeneous coordinate system, keeping values within a learnable range.
  2. GT Mask Conditioning: Real-world training data often contains missing depth information. By feeding a ground-truth mask into the diffusion process, the model learns to ignore invalid data during training while maintaining the ability to predict complete geometry during inference.
  3. Sparse-to-Dense Training: A low-resolution "sparse" model is trained first, providing a robust initialization for the final full-resolution "dense" model.

Experimental Evaluation

The model was evaluated across diverse benchmarks, including CO3D (object-centric), Habitat, and RealEstate10k (indoor/outdoor scenes).

Key Results

  • Accuracy and Robustness: DiffusionSfM consistently outperforms baseline methods like DUSt3R and RayDiffusion in camera center accuracy. Its homogeneous coordinate strategy proves particularly effective for capturing distant background elements, leading to significantly better Chamfer Distance scores on the CO3D dataset.
  • Modeling Ambiguity: As a generative model, DiffusionSfM can sample multiple plausible 3D layouts for a single set of images. This is crucial for symmetric objects or sparse views where multiple geometric interpretations are valid.
  • Efficiency: By skipping the separate global alignment step, DiffusionSfM is remarkably fast. Using "early stopping" (10 denoising steps), it can reconstruct an 8-image scene in approximately 1.91 seconds, compared to over 8 seconds for the full DUSt3R pipeline.
Qualitative results on diverse scenes. The model reconstructs complex geometry (cave, bathroom) and recovers camera trajectories from a sparse set of input images.

Discussion and Future Work

While DiffusionSfM represents a significant step toward unified 3D reconstruction, some limitations remain. Operating directly in pixel space can occasionally lead to "noisy" 3D points at object boundaries. Future iterations might utilize Latent Diffusion Models (LDMs) to produce smoother results. Additionally, the current Transformer architecture scales quadratically with the number of images, presenting a challenge for reconstructing very large-scale environments. Nonetheless, DiffusionSfM demonstrates the power of generative modeling in solving complex geometric problems end-to-end.

Summary updated

BibTeX
@inproceedings{zhao2025diffusionsfm,
  author = {Qitao Zhao and Amy Lin and Jeff Tan and Jason Y. Zhang and Deva Ramanan and Shubham Tulsiani},
  title = {{DiffusionSfM: Predicting Structure and Motion via Ray Origin and Endpoint Diffusion}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  url = {https://openreview.net/forum?id=aTEbZmPqn7},
}
Figure