Paper Notes: Learning to Solve Nonlinear Least Squares for Monocular Stereo

This paper uses an end-to-end network to tackle direct monocular SLAM. The authors run experiments on several datasets and tasks, and their method outperforms LM in accuracy and speed while using fewer parameters. Although the paper focuses on dense monocular SLAM, it targets the nonlinear least squares component of the back end, so the idea of incorporating learning applies more broadly to SLAM. Much like BA-Net, this is one of the foundational contributions to improving back-end optimization with deep learning.

The paper makes three main contributions:
1) It proposes an end-to-end training framework based on nonlinear least squares optimization.
2) It learns both the priors and the regularization terms directly from the training data.
3) It introduces the first algorithm to use machine learning to optimize photometric error.

1 Background

The approach in this paper builds on much the same ideas as optimization-based direct methods.

1.1 Nonlinear Least Squares Solvers

A typical nonlinear least squares problem takes the following form:

E=\frac{1}{2} \sum_{j} r_{j}^{2}(\mathbf{x})\tag{1}

Here, r_{j} is the residual for the j-th term, \mathbf{x} is the optimization variable, and E is the objective function.

Problems like this are typically solved using numerical optimization methods such as Gauss-Newton (GN) and Levenberg-Marquardt (LM).

The usual approach is to take a first-order expansion of the residual:

\mathbf{r}\left(\mathbf{x}_{i}+\Delta \mathbf{x}_{i}\right) \approx \mathbf{r}_{i}+\mathbf{J}_{i} \Delta \mathbf{x}_{i}\tag{2}

where:

\mathbf{r}_{i}=\mathbf{r}\left(\mathbf{x}_{i}\right), \quad \mathbf{J}_{i}=\left.\frac{d \mathbf{r}}{d \mathbf{x}}\right|_{\mathbf{x}=\mathbf{x}_{i}}\tag{3}

The optimal update is then the step that minimizes the current error function:

\Delta \mathbf{x}_{i}=\underset{\Delta \mathbf{x}_{i}}{\arg \min } \frac{1}{2}\left\|\mathbf{r}_{i}+\mathbf{J}_{i} \Delta \mathbf{x}_{i}\right\|^{2}\tag{4}

In the Gauss-Newton (GN) method, the update is obtained by solving the following equation:

\mathbf{J}_{i}^{T} \mathbf{J}_{i} \Delta \mathbf{x}_{i}=-\mathbf{J}_{i}^{T} \mathbf{r}_{i}\tag{5}

Unlike GN, the Levenberg-Marquardt (LM) method introduces p to improve convergence. Its update is given by:

\Delta \mathbf{x}_{i}=-\left(\mathbf{J}_{i}^{T} \mathbf{J}_{i}+\lambda \operatorname{diag}\left(\mathbf{J}_{i}^{T} \mathbf{J}_{i}\right)\right)^{-1} \mathbf{J}_{i}^{T} \mathbf{r}_{i}\tag{6}

These are the typical steps for iteratively solving a least squares problem using gradient descent.

1.2 Mapping and Photometric Error

A transformation matrix in 3D space can be obtained using the exponential map for the Lie group SE(3), where is the corresponding Lie algebra:

\hat{T}_{t \rightarrow s}=\exp \left(\mathbf{p}^{\times}\right)\tag{7}

The projection relationship (the epipolar constraint) is shown below. Here, p_{s} denotes the coordinates of a point in the source image, and p_{t} denotes the coordinates of the corresponding point in the target image:

p_{s} \sim K \hat{T}_{t \rightarrow s} \hat{D}_{t}\left(p_{t}\right) K^{-1} p_{t}\tag{8}

The mapping gives the following photometric error:

L=\sum_{p}\left\|I_{t}(p)-\hat{I}_{s}(p)\right\|_{2}\tag{9}

Here, \hat{I}_{s}(p) is obtained by bilinear interpolation. Once we define the photometric residual as:

\mathbf{r}_{p}=I_{t}(p)-\hat{I}_{s}(p)\tag{10}

its Jacobian is easy to compute with autodiff in various frameworks, including the derivative through bilinear interpolation. For example, in TensorFlow you can use tf.gradients(res[i],x)). There’s no need to write it out here.

2 LS-Net Model Design

This section covers the three main modules, each described below.

2.1 Initialization Network

This part mainly handles feature extraction. The authors use three convolutional layers with stride=2 as the backbone. They follow the backbone with an upsampling layer and a conv1x1 layer to produce a depth estimate at one-quarter of the original image size. A separate fully connected layer takes the backbone output and produces a 6-dimensional vector representing the pose. There’s nothing particularly unusual about this part.

To better represent greater depths, the authors have the network output inverse depth, z=\frac{1}{d}.

2.2 Optimizing Nonlinear Least Squares with LS-Net

This is the nonlinear optimization layer, which the authors call LS-Net. The algorithm works as follows:

As noted earlier, the objective is the sum of the per-pixel photometric errors. The variables to estimate are inverse depth z and pose, \mathbf{x} = (\mathbf{z}, \mathbf{p}):

E(\mathbf{x})=\frac{1}{2}\|\mathbf{r}(\mathbf{x})\|^{2}\tag{11}

The updates still follow a typical gradient descent procedure:

\mathbf{x}_{i+1}=\mathbf{x}_{i}+\Delta \mathbf{x}_{i}\tag{12}

The key difference in this paper is that a recurrent neural network (LSTM-RNN) estimates the update step \Delta x_i:

\left[\begin{array}{c}\Delta x_{i} \\h_{i+1}\end{array}\right]=\operatorname{LSTM}_{c e l l}\left(\Phi\left(\mathbf{J}_{i}, \mathbf{r}_{i}\right), h_{i}, \mathbf{x}_{i} ; \theta\right)\tag{13}

Here, \theta denotes the network parameters, and h_{i} is the hidden state. This is a standard LSTM cell. The input \Phi\left(\mathbf{J}_{i}, \mathbf{r}_{i}\right) is described in the next subsection.

2.3 The Jacobian input structure

The authors follow the GN optimization procedure, namely \mathbf{J}_{i}^{T} \mathbf{J}_{i} \Delta \mathbf{x}_{i}=-\mathbf{J}_{i}^{T} \mathbf{r}_{i}, but they obtain the Jacobian by automatic differentiation with respect to depth and pose. (I’m not sure this step is appropriate, since automatic differentiation treats the variables as lying in Euclidean space, whereas the pose is represented in a Lie algebra.) To simplify the Jacobian, the authors apply the transformation shown below and use a compressed version of \mathbf{J}_{i}^{T} \mathbf{J}_{i} as input to the network:

This also takes advantage of the sparsity of the Jacobian: there are typically far fewer poses than depth values to estimate, which makes this compression possible. In practice, it removes unnecessary inputs and speeds up network computation.

The compressed \mathbf{J}_{i}^{T} \mathbf{J}_{i} is concatenated with the corresponding r_i to form the LSTM input:

\Phi(\mathbf{J}, \mathbf{r})=\left[\mathbf{J}^{\mathrm{T}} \mathbf{J}, \mathbf{r}\right]\tag{14}

The authors avoid using \left(\mathbf{J}^{T} \mathbf{J}\right)^{-1} \mathbf{J} as a network input because it would add substantial computation without providing any new information.

2.4 Upscaling Network

The iterative optimization network in the previous step takes the sampled output of the initialization network as input. A final upsampling network is therefore needed to restore the optimized depth map to the original image size. The authors use bilinear interpolation for upsampling.

3 Loss

The network’s loss has two terms: depth error and pose error. Both use the L1 norm.

The depth error term is defined as:

L_{d e p t h}(\mathbf{x})=\frac{1}{w h}\|\mathbf{z}-\tilde{\mathbf{z}}\|_{1}\tag{15}

The pose error term is defined as:

L_{\text {pose}}(\mathbf{x})=\sum_{s}\left\|\boldsymbol{\alpha}_{t \rightarrow s}-\tilde{\boldsymbol{\alpha}}_{t \rightarrow s}\right\|_{1}+\left\|\mathbf{t}_{t \rightarrow s}-\tilde{\mathbf{t}}_{t \rightarrow s}\right\|_{1}\tag{16}

Here, \tilde{\mathbf{p}}=\left(\tilde{\mathbf{t}}_{t \rightarrow s}, \tilde{\boldsymbol{\alpha}}_{t \rightarrow s}\right) consists of the translation vector \tilde{\mathbf{t}}_{t \rightarrow s} and the rotation vector \tilde{\boldsymbol{\alpha}}_{t \rightarrow s}.

The final loss is a weighted sum of the two terms:

L_{t o t}(\theta)=\sum_{i} w_{p o s e} L_{p o s e}\left(\mathbf{x}_{i}(\theta)\right)+w_{d e p t h} L_{d e p t h}\left(\mathbf{x}_{i}(\theta)\right)\tag{17}

4 Experiments

The authors compare methods in both simulated and real-world experiments. This is just a brief summary; see the original paper for details.

4.1 Comparison on Simulated Data

For the simulations, the authors ran simple curve-fitting experiments to compare convergence speed and error against LM. They fitted the following curves:

\begin{array}{c}y=x \exp (a t)+x \exp (b t)+\epsilon \\y=\sin (a t+b)+\epsilon \\y=\operatorname{sinc}(a t+b)+\epsilon \\y=\mathcal{N}(t \mid \mu=a, \sigma=b) \text { (fitting a Gaussian) }\end{array}\tag{18}

The results are shown below:

Here’s what the plots show:

In panel (a), after just five iterations, the LS-Net fit is noticeably closer to the ground truth than the LM fit.

In panel (b), LS-Net (solid line) converges noticeably faster than LM (dashed line).

Panel (c) plots LM error on the x-axis against LS-Net error on the y-axis for the same number of iterations. LM consistently has much higher error than LS-Net at matching iteration counts. This shows that LS-Net converges faster and produces a better fit.

4.2 Two-View Depth Estimation

The authors used two-view depth estimation to show that LS-Net can still produce reliable depth estimates even in extreme cases where the viewpoints are very far apart or very close together:

4.3 Comparison with DeMoN

LS-Net performs better in some cases than DeMoN, which also uses deep learning:

4.4 Comparison with Other Methods

MVS : uses oracle with known poses
SIFT : uses sparse features for correspondences
FF : uses optical flow
Matlab : uses KLT tracker in Matlab

Download the Paper

Paper:


PPT:
1604908422-05_LS-Net

Add a Comment

Your email address will not be published. Required fields are marked *