Abstract
We consider the inverse problem of reconstructing the spatial layout of a place, such as a home floorplan, from a user's movements. Direct inversion is ill-posed as many floorplans can explain the same trajectories. We adopt a diffusion-based posterior sampler to generate layouts consistent with measurements. However, the path-planning process is a non-invertible, non-differentiable function, causing instability in likelihood score optimization. We reformulate the likelihood score in a smoother embedding space trained with a contrastive loss. This surrogate likelihood score approximates the true likelihood, steering the denoising process towards the posterior. Our model, CoGuide, produces more consistent floorplans and is more robust than differentiable-planner baselines.
Introduction: Reconstructing Walls from Footsteps
Reconstructing the layout of an indoor environment from a sequence of sensor coordinates—a spatial inverse problem—is inherently challenging. The "forward operator," which maps a floorplan to a trajectory via path planning, is non-differentiable and highly sensitive to small structural changes. For instance, a single pixel representing a closed door can force a path planner to generate a drastically different route. This lack of smoothness breaks traditional Diffusion Posterior Sampling (DPS) methods that rely on stable gradients to guide the denoising process.
Methodology
CoGuide addresses these challenges by sidestepping the non-differentiable path planner through a contrastive learning framework.
Score Decomposition and Guidance
The core of the approach lies in the decomposition of the posterior score, which guides the diffusion model's reverse process. As shown in Equation (4), the posterior score is the sum of the prior score (learned from a dataset of valid floorplans) and the likelihood score (which ensures consistency with the observed trajectory).
Contrastive Embedding Space
Instead of calculating errors in the raw image space, CoGuide projects floorplans ($x$) and trajectories ($y$) into a shared, high-dimensional embedding space. Two encoders are trained using a contrastive InfoNCE loss, ensuring that matching pairs are pulled together while mismatched pairs are pushed apart. The authors demonstrate that the distance in this smooth embedding space serves as a valid surrogate for the true likelihood score, enabling stable backpropagation where traditional planners fail.
Sampling and Refinement
During reverse diffusion, the model uses the gradient of the distance in this embedding space to steer generation. To further improve physical plausibility, an intersection penalty is added to prevent paths from crossing walls, and the Adam optimizer is employed within the sampling steps to navigate the complex optimization landscape more robustly than standard gradient descent.
Experiments and Results
The model was evaluated using the HouseExpo dataset, featuring over 35,000 floorplans. Synthetic trajectories were generated at varying densities (sparse, moderate, dense) using the A* algorithm.
CoGuide was compared against several baselines, including DPS combined with differentiable planners like Neural A and TransPath. In sparse trajectory scenarios—the most difficult case—CoGuide achieved an IoU of 0.84, significantly outperforming DPS+Neural A (0.67) and Classifier-Free Guidance (0.76). Qualitatively, CoGuide produces cleaner, more architecturally consistent floorplans compared to CFG, which often introduces "hallucinated" artifacts.
Conclusion and Future Work
CoGuide demonstrates that contrastively learned embedding spaces can provide the necessary smoothness to solve inverse problems involving non-differentiable forward operators. While currently limited to $64 \times 64$ resolutions and optimal A* path assumptions, future work aims to scale the model to high-resolution blueprints and incorporate more realistic, sub-optimal human movement patterns. The approach also holds promise for "blind" inverse problems where the forward operator is partially or entirely unknown.
Summary updated