Theoremcore
RANSAC iteration bound
Also called RANSAC stopping criterion.
If a sample of s items is all inliers with probability w^s, independently, then ceil(log(1-p)/log(1-w^s)) samples give one with probability at least p. With noise the count is optimistic.
The RANSAC iteration bound gives the number of random samples that RANSAC must draw so that, with a chosen probability , at least one sample contains only inliers. If a fraction of the data are inliers and a sample has items, a sample is all inliers with probability about , and samples are enough. For , and , this is 72 samples. The count grows like , so it grows exponentially in the size of the sample, which is why small minimal solvers matter. The bound is the stopping rule of RANSAC and of most of its variants. It assumes that the samples are independent and that every all-inlier sample gives a good model. Noise makes the second assumption false, so in practice the count is optimistic.
Statement
Let one random sample be "good" with probability , and let the samples be independent.
Theorem. The probability that at least one of samples is good is . For , this is at least if and only if
so the least such integer is . The number of samples up to and including the first good one has the geometric distribution , with mean and standard deviation .
Corollary (RANSAC). Let have items, of which are inliers, and let a good sample be a sample of items that are all inliers. If the items are drawn independently and uniformly with replacement, then and . If the items of a sample are distinct, as in RANSAC, then , and the count with is a lower bound on the count needed.
In plain words
Each sample is like the throw of a loaded coin that shows "good" with a small chance. To be almost sure of at least one good throw, you need enough throws that the chance of all bad throws is small. The chance of all bad throws drops by the same factor at every throw, so the number of throws you need grows only with the logarithm of how sure you want to be. It grows much faster when a good throw is rare: halving the share of good data items multiplies the work by two for each item in a sample.
Proof
The samples are independent, and each is bad with probability , so all samples are bad with probability . At least one is good with probability . This is at least if and only if . Both sides are positive, and is increasing, so this holds if and only if . Since , , and dividing by it reverses the inequality: . The least integer with this property is the ceiling.
For the distribution of : exactly when the first samples are bad and sample is good, which has probability . This is the geometric distribution with success probability , with mean and variance .
For the corollary, with replacement each of the draws is an inlier with probability , independently, so . Without replacement, a uniform -subset of lies inside with probability . Each factor is at most , because is the same as , which holds for . So . Since does not increase as grows, the count with is at most the count for the true .
Consequences
The table gives for and :
| sample size | 2 | 3 | 4 | 5 | 7 | 8 |
|---|---|---|---|---|---|---|
| 17 | 35 | 72 | 146 | 588 | 1177 |
With and , . With , and , .
- Small samples. For , the five-point algorithm for the essential matrix needs 146 samples, but the eight-point algorithm needs 1177. This is the main reason to use minimal solvers inside RANSAC.
- Logarithm in the confidence. For small , , so . Going from to only doubles the count.
- Adaptive stopping. The true is not known. RANSAC uses the inlier ratio of the best model so far. If that model's inliers are true inliers, this ratio is at most , and the count it gives is at least , so the rule stops late, not early.
- Spread. For and , the mean number of samples to the first good one is and the standard deviation is . The standard deviation is close to the mean, so a run can take several times the mean. This is why the stopping rule uses a confidence and not the mean.
- Without replacement. For small the bound with is optimistic. With , and , the true probability is , not , and , not 72. With 72 samples the probability of success is about , not .
Tightness
The bound on is exact for its model: is the probability of success, not a lower bound, so no smaller gives probability . For example, with ( and ), 16 samples succeed with probability , just below , and 17 samples succeed with probability .
In practice the guarantee is weaker than the theorem, for three reasons.
- Noise. The theorem assumes that every all-inlier sample gives a model that finds the inliers. With noisy inliers, a minimal sample of nearby points can give a poor model that misses many inliers. Chum, Matas and Kittler (2003) observed that RANSAC therefore runs longer than the formula predicts, and they proposed LO-RANSAC to close the gap.
- Degenerate samples. Some all-inlier samples, such as collinear points for a homography, give no model or a wrong one.
- Dependence. The samples of RANSAC are independent, but guided samplers such as PROSAC draw from a changing set, and the theorem does not apply to them as stated.
History
Fischler and Bolles introduced RANSAC in 1981 in Communications of the ACM. They analyzed the number of trials needed to find a sample of inliers, gave its mean and its standard deviation , and the number of trials for a given probability of success. Hartley and Zisserman (2004) gave the formula with a table and the adaptive algorithm that updates the count from the best model so far, which is the form that most implementations use. Chum, Matas and Kittler (2003) showed that the count is optimistic with noise and used it as a target for LO-RANSAC. Later work, such as PROSAC and the USAC framework, kept the same kind of stopping rule with other sampling schemes.
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 discussion of the RANSAC parameters: the expected number of trials w^(-n) and its standard deviation, and the number of trials for a given probability of success
- Richard Hartley and Andrew Zisserman, Multiple View Geometry in Computer Vision, second edition, Cambridge University Press, 2004, Section 4.7, Robust estimation (the number of samples N = log(1 - p)/log(1 - (1 - e)^s), its table for sample sizes and outlier proportions, and the adaptive algorithm that updates N)
- Ondrej Chum, Jiri Matas and Josef Kittler, Locally optimized RANSAC, Pattern Recognition, DAGM 2003, Lecture Notes in Computer Science 2781, 236-243, The observation that the number of samples in practice is larger than the count the formula predicts, because not every all-inlier sample gives a good model
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 | W4 complete |
|
Tag D1ZTNC Edit this page History Report an error Markdown