Problemcore
Robust model fitting
Also called outlier-robust estimation, robust geometric estimation.
Fit a model such as a homography or an essential matrix to data that contain a large fraction of outliers, which ordinary least squares cannot tolerate.
Robust model fitting is the problem of finding the parameters of a model, such as a line, a plane, a homography or an essential matrix, from measurements of which a large part are wrong. The wrong measurements, the outliers, do not follow the model at all, and they can be anywhere. In computer vision they come mostly from wrong matches between two images, and it is common that half of the matches or more are wrong. Ordinary least squares cannot handle this: a single outlier that is far enough away can move the fit as far as it likes. A robust method must give the outliers a bounded influence, and usually it must also find out which measurements they are. The best known methods, such as RANSAC, fit the model to many small random samples and keep the model that most of the data agree with. Finding the model with the most agreeing data exactly is NP-hard.
In plain words
Suppose you want to draw the best straight line through a set of dots. If all dots are close to one line, the usual method works: it makes the sum of the squared distances small. Now add a few dots that are far away and have nothing to do with the line. The usual method tries to please them too, and the line tilts toward them. One dot that is far enough can pull the line anywhere.
A robust method asks a different question: which line passes close to the largest number of dots? The far dots then do not count, because no good line passes near them. The hard part is to find that line without trying every possible line.
Definition
The input is data , a set of model parameters and a residual that says how far is from the model . Some unknown subset , the inliers, follows a true model up to noise, and the other items are outliers with no structure. The main forms of the goal are:
- Maximum consensus. With an inlier threshold , find that maximizes , the number of inliers.
- M-estimation with a bounded loss. Find that minimizes for a loss that grows like near 0 and is bounded, such as . Maximum consensus is the case where is 0 up to and 1 after.
- Least median of squares. Find that minimizes the median of . It needs no threshold.
The breakdown point of an estimator is the smallest fraction of the data that, when replaced by arbitrary values, can move the estimate arbitrarily far. Least squares has breakdown point . Least median of squares has breakdown point close to (Rousseeuw, 1984), and maximum consensus can work with more than half outliers when the outliers have no common structure.
Variants
- Known or unknown noise level. Maximum consensus and the truncated quadratic need a threshold , which comes from the noise level. MAGSAC needs only an upper bound on it, and least median of squares needs none.
- One model or several. When the data contain several structures, such as several planes, the problem is to find all of them and their number. J-linkage and the Hough transform solve this form.
- Linear and non-linear models. For a line or a plane the residual is linear in . For a fundamental matrix or a camera pose it is not, which makes exact methods harder.
- Prior information. Matches often come with a quality score, which PROSAC uses to sample good matches first.
- Time limits. In real-time systems the time is fixed in advance, as in preemptive RANSAC.
Examples
Take the 10 points for , which lie exactly on the line , and the 3 outliers , and . The least squares line of the 13 points is . All 10 inliers are 1.05 to 1.87 below it, so with the threshold on the vertical distance it has no inliers at all. Move the outlier to , and the least squares line becomes : one point moves the fit as far as it likes.
Maximum consensus with gives with 10 inliers, and no line has more. Moving an outlier does not change this answer, as long as the outlier does not land within of the line. RANSAC finds it by drawing pairs of points. A pair of two inliers gives the true line, and with of the points inliers the iteration bound asks for pairs to find such a pair with probability 0.99.
Known algorithms
| algorithm | goal | type |
|---|---|---|
| RANSAC | maximum consensus | random sampling, no optimality guarantee |
| MSAC | truncated quadratic | RANSAC loop with a different score |
| MLESAC | likelihood of a mixture of inliers and outliers | RANSAC loop |
| LO-RANSAC | maximum consensus or truncated quadratic | RANSAC loop with local refinement |
| PROSAC | maximum consensus | sampling guided by match quality |
| Preemptive RANSAC | additive score | fixed time budget |
| MAGSAC | loss marginalized over the noise scale | RANSAC loop, no threshold |
| Least median of squares | median squared residual | random sampling in practice |
| M-estimators by IRLS | robust loss | local descent from a start model |
| Hough transform | votes in a parameter grid | exhaustive over the grid |
| J-linkage | several models | random hypotheses and clustering |
Exact methods for maximum consensus, such as branch and bound and tree search, also exist. They find the best model with a guarantee, but their time grows exponentially in the dimension or in the number of outliers.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| J-linkage | Θ(n^3 M) worst | Θ(n M) extra | randomizednot exactofflineiterative | 1 language |
| LO-RANSAC | Θ(k n) worst · average · best | Θ(n) extra | randomizednot exactofflineiterative | 1 language |
| MAGSAC | Θ(k n) worst · average · best | Θ(n) extra | randomizednot exactofflineiterative | 1 language |
| MLESAC | Θ(k m n) worst · average · best | Θ(n) extra | randomizednot exactofflineiterative | 1 language |
| MSAC | Θ(k n) worst · average · best | Θ(n) extra | randomizednot exactofflineiterative | 1 language |
| Preemptive RANSAC | O(M (c + 2B) + M log M + N) worst · average · best | Θ(M + N) extra | randomizednot exactofflineiterative | 1 language |
| PROSAC | Θ(k n + n²) worst · average · best | Θ(n) extra | randomizednot exactofflineiterative | 1 language |
| RANSAC | Θ(k n) worst · average · best | Θ(n) extra | randomizednot exactofflineiterative | 1 language |
Bounds
Chin, Cai and Neumann (2018) studied maximum consensus for linear models, with residuals and . They proved these results:
- The decision version is NP-complete (Theorem 1), by a reduction from the k-SLAB problem. So no algorithm solves maximum consensus in time polynomial in and , unless P = NP.
- The problem is W[1]-hard in the dimension . So no algorithm runs in time for any function , unless FPT = W[1].
- The problem is APX-hard, so it has no polynomial-time approximation scheme, unless P = NP.
- The problem is fixed-parameter tractable in the number of outliers and the dimension : it can be solved in time .
Random sampling has no worst-case guarantee, but its expected cost is simple. If a fraction of the items are inliers and a sample of inliers gives a good model, about samples are needed on average, and the iteration bound gives the number of samples for a confidence . Each sample costs to score, so the time is under these assumptions.
Reductions
- Maximum consensus and k-SLAB. For linear models, maximum consensus with threshold is the same as finding a slab of width that contains the most points, and the minimal width of a slab that holds points is the decision problem k-SLAB. Chin, Cai and Neumann use this to prove NP-hardness.
- Least median of squares and slabs. Least median of squares asks for the thinnest slab that contains half the points, the case of the same geometry.
- From robust fitting to least squares. Once the inliers are known, the problem becomes an ordinary least squares problem on the inliers. This is why most robust methods end with a refit.
- M-estimation to weighted least squares. A robust loss can be minimized by iteratively reweighted least squares, a sequence of weighted least squares problems.
Applications
- Image stitching fits a homography between images from matched features, many of which are wrong (image stitching).
- Two-view geometry estimates the fundamental matrix or the essential matrix from matches, with the five-point or eight-point solvers inside a RANSAC loop.
- Camera pose from 2D-3D matches uses P3P inside a robust loop (perspective-n-point).
- Visual odometry and SLAM estimate the motion between frames in real time (visual odometry).
- Image retrieval checks a match between two images by spatial verification.
- Point clouds are split into planes, cylinders and other shapes (efficient RANSAC for shape detection).
References
- Martin A. Fischler and Robert C. Bolles, Random sample consensus: a paradigm for model fitting with applications to image analysis and automated cartography, Communications of the ACM 24(6), 1981, 381-395, The statement of the fitting problem with gross errors, the argument against least squares and the RANSAC paradigm
- Tat-Jun Chin, Zhipeng Cai and Frank Neumann, Robust fitting in computer vision: easy or hard?, European Conference on Computer Vision (ECCV 2018), arXiv:1802.06464, Section 1.1 (summary of results), Section 2 (Theorem 1, NP-completeness of the decision version of maximum consensus by reduction from k-SLAB), Section 3 (W[1]-hardness in the dimension and the FPT algorithm in the number of outliers) and Section 4 (APX-hardness)
- Peter J. Rousseeuw, Least median of squares regression, Journal of the American Statistical Association 79(388), 1984, 871-880, The breakdown point of least squares and the 50 percent breakdown point of least median of squares
- Richard Hartley and Andrew Zisserman, Multiple View Geometry in Computer Vision, second edition, Cambridge University Press, 2004, Section 4.7, Robust estimation (RANSAC, the distance threshold, the number of samples and the robust cost functions)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 6F92BC Edit this page History Report an error Markdown