CodeSLAM
Bloesch 2018 · Paper
One-line summary — CodeSLAM (CVPR 2018) represents each keyframe’s dense depth map as a small latent code from an image-conditioned variational autoencoder, making dense geometry compact enough to optimize jointly with camera poses.
Problem
The representation of geometry in real-time 3D perception remains a critical open issue. Dense maps capture complete surface shape but their high dimensionality makes them costly to store and process, and unsuitable for rigorous probabilistic inference; sparse feature-based representations allow joint probabilistic inference of structure and motion, but capture only partial scene information and are mainly useful for localisation. Yet natural scene geometry is highly ordered — neighbouring depth values are strongly correlated — so a dense representation should not actually need a large number of parameters. CodeSLAM seeks a representation that is dense yet compact and optimisable: full surface geometry in few enough parameters to sit inside joint probabilistic optimization.
Method & architecture
Intensity-conditioned depth auto-encoding. A variational autoencoder compresses a keyframe’s depth map, but conditioned on the intensity image so the code only retains what the image alone cannot predict:
where is the intensity image and the latent code (128-D in the reference network). A U-Net decomposes into multi-scale features that are concatenated into the depth encoder/decoder at matching resolutions; the variational bottleneck (two 512-channel fully connected layers, KL-regularised) keeps the code-to-depth mapping smooth. Setting yields the most likely single-view depth prediction .
Uncertainty-aware training. The network predicts a per-pixel mean and uncertainty , trained with the negative log-likelihood of a Laplace distribution over observed depth at four pyramid levels:
Depths are re-parametrised as proximity (average depth ), mapping to . Training uses SceneNet RGB-D with ADAM (lr , 6 epochs). A linear decoder is used so the Jacobian (otherwise up to ~1 s to evaluate) can be pre-computed once per keyframe.
Dense warping and joint optimization. With pose between views, each pixel warps as
with the projection/inverse-projection operators and a pixel lookup. An N-frame structure-from-motion back-end assigns every frame an unknown code (init 0) and pose (init identity) and minimizes photometric and geometric residuals over all overlapping pairs,
where the losses mask invalid correspondences, weight the two error types, apply Huber weighting, and down-weight slanted or occluded pixels. A damped Gauss–Newton solver updates all codes and poses. Tracking aligns the current frame to the last keyframe with the same machinery (photometric cost only, coarse-to-fine); the full PTAM-style system alternates tracking and mapping, marginalising old keyframes into a linear prior.
Results
- Code size: reconstruction accuracy saturates at a code size of 128; colour input and nonlinear decoding gave no significant gain. Code-entry Jacobians show entries controlling semantically coherent image regions.
- N-frame SfM (SceneNet RGB-D): RMS proximity error of the master keyframe drops monotonically as frames are added — (1 frame) to (6 frames), demonstrating genuine multi-view refinement of dense geometry.
- Generalisation: two-frame reconstructions on real EuRoC and NYU V2 images despite purely synthetic training; the EuRoC result used 50 optimisation steps at ~100 ms each.
- VO on EuRoC MH_02: run as sliding-window (4-keyframe) visual odometry, error is roughly 1 m after 9 m traveled — not competitive with visual-inertial systems, but respectable for vision-only with a synthetic-trained prior; map update rate ~5 Hz.
Why it matters for SLAM
CodeSLAM answered a question that had blocked dense SLAM since DTAM: how to include dense geometry inside joint probabilistic optimization instead of fusing it after the fact. Its core lesson — put a learned low-dimensional parameterization between the optimizer and the dense map — is one of the most influential ideas in learned SLAM (CVPR 2018 best paper honourable mention), spawning SceneCode, DeepFactors, NodeSLAM and CodeMapping, and conceptually anticipating neural-implicit SLAM (iMAP, NICE-SLAM) where network parameters again serve as compact optimizable geometry.