CodeVIO: Visual-Inertial Odometry with Learned Optimizable Dense Depth

Xingxing Zuo, Nathaniel Merrill, Wei Li, Yong Liu, Marc Pollefeys, Guoquan Huang

TL;DR

CodeVIO is a lightweight, real-time system that combines Visual-Inertial Odometry (VIO) with a deep learning-based dense depth estimator. By representing dense depth as a compact "code" within a Kalman Filter, the system achieves state-of-the-art pose accuracy and provides metric-scale dense 3D maps of a robot's surroundings using only a single-thread CPU for the estimator and a GPU for the neural network.

What Problem Does This Paper Address?

Robots need two things to navigate safely: they need to know where they are (localization) and what the world looks like around them (mapping).

  1. The Scale Problem: Monocular cameras alone can't easily determine the "metric scale" (is that wall 1 meter away or 10?). While IMUs (Inertial Measurement Units) provide this scale, integrating them with dense depth networks has historically been computationally heavy.
  2. The Bottleneck Problem: Previous "Code-based" SLAM systems (like CodeSLAM) used a Conditional Variational Autoencoder (CVAE) to compress dense depth into a small vector (a "code"). However, updating these codes in real-time was nearly impossible because calculating the "Jacobian" (how the depth changes relative to the code) using standard deep learning libraries is incredibly slow.

Methods

CodeVIO tackles these issues through a tightly-coupled EKF (Extended Kalman Filter) framework:

  • Lightweight CVAE Architecture: The authors designed a two-stream network. One stream (a modified FastDepth/UNet) extracts features from an RGB image and sparse VIO points. The second stream (the VAE) encodes and decodes dense depth maps conditioned on those features.
  • Optimizable Depth Codes: The "depth code" is added directly into the VIO state vector. This means the system doesn't just predict depth once; it continuously refines the depth map as the robot moves, using sparse geometric and consistency constraints.
  • The Finite Difference Trick: Instead of using standard backpropagation to find the Jacobian—which can take 300ms—the authors use a finite difference approximation. By running a small batch of forward passes (32 in this case) with slight perturbations to the code, they calculate the Jacobian in just 10ms, a 30x speedup.
  • Sparse-to-Dense Fusion: Unlike previous works that use every pixel for updates, CodeVIO uses only sparse, high-quality feature points to update the depth code, significantly reducing the computational load.

Datasets

  • NYU Depth V2: Used for training and initial evaluation of the depth prediction network.
  • EuRoC MAV Dataset: Used to evaluate the full system's performance in real-world drone flight scenarios. The authors used the LiDAR ground truth from this dataset to verify their depth accuracy.

Key Insights and Ideas

  • Sparse Points are Enough: One of the most surprising findings is that you don't need dense photometric residuals (comparing every pixel) to get a good dense map. Updating the depth code using only sparse VIO features is enough to significantly "correct" the initial learned depth.
  • Jacobians Don't Need Backprop: In the context of small latent codes (like the 32-dimensional code used here), finite difference is actually more efficient than the highly-optimized autograd systems found in PyTorch or TensorFlow.
  • Scale from IMU: By putting the depth network inside a VIO framework, the system recovers true metric scale naturally, something purely vision-based CVAE systems struggle with.

Key Results

  • Speed: The system runs in real-time (~44ms per loop), making it suitable for actual robotic hardware.
  • Accuracy: CodeVIO achieved better pose estimation accuracy than the standard OpenVINS baseline on the EuRoC dataset, proving that dense depth information actually helps localization.
  • Jacobian Efficiency: Their finite difference method achieved a 10x to 30x speedup over traditional chain-rule Jacobians with "near-perfect" accuracy.
  • Generalization: Even though the network was trained on indoor room data (NYUv2), it generalized well to the different environments in the EuRoC dataset.

Limitations and Future Work

  • Local vs. Global: Currently, CodeVIO focuses on "local" dense mapping (the immediate vicinity). It does not yet build a persistent, global dense map of an entire building.
  • Optimization: While the authors achieved real-time performance, they note that the current implementation is not fully optimized and could be made even faster.
  • Future Direction: The authors aim to extend this work into a full SLAM (Simultaneous Localization and Mapping) system that maintains a global dense depth map over time.

Summary updated

BibTeX
@inproceedings{zuo2021codevio,
  author = {Xingxing Zuo and Nathaniel Merrill and Wei Li and Yong Liu and Marc Pollefeys and Guoquan Huang},
  title = {{CodeVIO: Visual-Inertial Odometry with Learned Optimizable Dense Depth}},
  booktitle = {IEEE International Conference on Robotics and Automation},
  year = {2021},
  doi = {10.1109/icra48506.2021.9560792},
}
Figure