No jobs
Advanced 11 min 3 of 3

Nonlinear least squares

Gauss–Newton, damping, and robust kernels — three answers to "the linearisation was optimistic".

What this repairs

Using an optimiser as a black box and having no model of why it diverged, stalled, or was dragged off by one bad correspondence.

Almost every batch estimation problem in robotics is

x=argminxiri(x)Σi2,\mathbf{x}^\star = \arg\min_{\mathbf{x}} \sum_i \lVert \mathbf{r}_i(\mathbf{x}) \rVert^2_{\Sigma_i},

a sum of squared residuals weighted by their covariances. Maximum likelihood under Gaussian noise gives exactly this, which is where the squares come from — and also where their fragility comes from, since a Gaussian assigns vanishing probability to large errors and therefore an enormous cost to explaining one.

Linearise r(x+Δ)r+JΔ\mathbf{r}(\mathbf{x} + \Delta) \approx \mathbf{r} + J\Delta and the minimiser of the linearised problem solves the normal equations

(JΣ1J)Δ=JΣ1r.\left(J^\top \Sigma^{-1} J\right)\Delta = -J^\top \Sigma^{-1}\mathbf{r}.

The matrix on the left is the information matrix of the estimate. The same object as in the filter, arrived at from the optimisation side.

Robust kernels address a different failure. One wrong data association produces a residual of a hundred pixels; squared, it dominates the sum, and the optimiser distorts the entire solution to reduce it. A robust kernel ρ()\rho(\cdot) grows sub-quadratically — Huber is quadratic near zero and linear beyond a threshold δ\delta — so a large residual contributes a bounded gradient.

The implementation is one line in an IRLS loop: multiply each residual's information by wi=ρ(ri)/riw_i = \rho'(\lVert r_i\rVert)/\lVert r_i \rVert and re-solve. For Huber, wi=1w_i = 1 inside the band and δ/ri\delta/\lVert r_i \rVert outside. So a robust kernel is literally down-weighting suspicious measurements, and δ\delta is the statement "residuals beyond this are probably not noise".

Check yourself

Your bundle adjustment converges to a low cost but the reconstruction is visibly wrong. What are the two most likely explanations?

Show answer

First, a local minimum: the initialisation was poor, and the linearised model was only ever valid in a basin containing the wrong answer. Low cost is not evidence of global optimality; nothing in Gauss–Newton offers that.

Second, outliers accepted as inliers: if wrong correspondences were fitted rather than down-weighted, the optimiser found a consistent explanation for inconsistent data. Check the residual histogram — a clean fit has a roughly Gaussian bulk, and a heavy tail means the kernel threshold was set too loosely, or was not applied at all.

Euler View - ML Experiment Monitor