Elamur Research

MAGSAC: Marginalizing Sample Consensus

Paper · 2019 · Dániel Baráth, Jiřı́ Matas and Jana Noskova

Summary

When two photographs show the same scene, a set of proposed point matches can help recover the geometry connecting the images. Some matches join unrelated features. Even correct matches can miss their predicted positions because the points were located imperfectly. A robust estimator has to distinguish these sources of error well enough to fit the geometry. In ordinary random sample consensus, or RANSAC, a distance cutoff decides which matches support each candidate fit. A cutoff that suits one image pair can reject useful matches in another. MAGSAC addresses that dependence by averaging over a range of possible noise scales during the search.

The authors call the underlying refinement procedure σ-consensus, using σ for the standard deviation of the inlier noise. The procedure starts from a provisional fit and asks how it would change under different assumptions about the amount of noise. For each scale it considers, it fits the geometry again using the points supported at that scale. It then uses the resulting fits to assign weights to the observations and makes a final weighted fit. Full MAGSAC also averages over noise scales when it scores candidates and determines how long to keep sampling. It requires an upper bound for the scale, which the authors set to 10 pixels across their experiments.

MAGSAC had the lowest mean geometric error on kusvod2 and Multi-H for fundamental matrix estimation, on homogr and EVD for homography estimation, and on Strecha for essential matrix estimation. AdelaideRMF was the exception, where it ranked third on mean error. Across the real-image experiments, its reported mean geometric error was 1.80 pixels. Its speed depended on the task. It was the fastest method on average for the Strecha essential matrix experiments, while some competing methods were faster on other datasets. In synthetic homography tests, MAGSAC retained an accuracy advantage when the competitors received the same sampling budget.

The authors also tested σ-consensus as a final refinement after another estimator had finished. This version leaves the search itself in the hands of the original estimator. It improved the reported errors in almost all of the comparisons, with ties in some real-data results and some exceptions in the synthetic tests. Using it once was generally inexpensive compared with the search. The paper thus tests both a replacement for several decisions inside RANSAC and a way to improve a fit that an existing estimator has already found.

Deep dive: MAGSAC: Marginalizing Sample Consensus

MAGSAC improves geometric fitting from noisy image matches by averaging over plausible noise scales instead of choosing a single inlier threshold. · about 34 minutes to read

The problem and its context

How noisy matches affect a geometric fit

A correspondence is a claim that a point in one image matches a point in another. When enough of those claims are correct, the coordinates can determine a geometric relation between the views. The paper studies three such relations. A homography maps image locations from one view of a plane to another. A fundamental matrix describes the epipolar constraint between two images, which restricts a point’s possible partner to a line in the other image. An essential matrix describes the corresponding constraint for calibrated cameras. Each task supplies a different meaning for the distance between an observation and the geometry proposed to explain it.

That distance is called a residual. A large residual may indicate a wrong match, while a correct match can have a positive residual because its image coordinates are imprecise. An inlier is an observation that belongs to the geometric relation being estimated. An outlier falls outside it. During estimation, the distinction has to be inferred from the observations and from a fit that is itself uncertain. The same residual can look large or small depending on how much error is plausible for genuine matches in that scene.

Least squares fits parameters by minimizing a sum of squared residuals. Large errors can carry substantial influence in that sum, so applying it directly to a collection of putative matches may allow false correspondences to pull the fit away from the right geometry. RANSAC, introduced in 1981, limits this influence by repeatedly trying fits based on small samples. The paper situates it in a range of vision tasks, including motion segmentation, stereo matching, image mosaicing, and estimating several geometric structures in one set of observations.

Each draw in RANSAC contains enough observations to propose a fit. A later check asks how many observations in the full collection agree with it. A draw made entirely from good matches can produce a useful hypothesis, even when a considerable fraction of the input is wrong. Agreement with the rest of the data helps distinguish that hypothesis from a geometry that only happens to satisfy the sampled points. Once the search is over, the estimator can fit again using the larger set that supported the winning candidate.

The cutoff enters as soon as the estimator asks what agreement means. If it is too narrow, a plausible fit can lose the support of correct but noisy observations. That can change which candidate wins and how many points are available to refine it. A wide cutoff increases the chance that false correspondences contribute to support and enter the final fit. Even if the same candidate looks promising at both cutoffs, the two refinements can produce different geometry because they use different observations.

The paper shows why a cutoff that performs well in one setting is a weak basis for a universal setting. Its plot of residuals for annotated inliers uses the reference geometry for each scene, so variations in that plot remain even when the residuals are measured against an accepted fit. The horizontal axis enumerates scenes across several datasets. The vertical axis measures root mean square residual in pixels. The scene-to-scene variation motivates treating noise scale as uncertain while the estimator runs.

How earlier estimators used the evidence

Several earlier methods changed which samples RANSAC tries. NAPSAC uses spatial coherence to improve the chances of drawing inliers together. PROSAC exploits a predicted ordering of points by their likelihood of being inliers. EVSAC estimates confidence from the available matching evidence. These approaches address the cost of discovering a promising candidate. A productive sampling order can bring that discovery forward, while the estimator still needs a way to judge what the candidate explains.

Other methods changed the score. The original count gives equal credit to every residual inside the cutoff. MSAC gives more credit to observations that fit closely through a truncated quadratic loss. MLESAC evaluates candidates using likelihood under assumptions about how inliers and outliers are distributed. The authors describe MLESAC as frequently improving on simple counting in practice and as being less sensitive to the chosen cutoff. The sensitivity can diminish when the score distinguishes residuals within the accepted region, even though the estimator still makes assumptions about the scale of those residuals.

Local optimization addresses another part of the process. A candidate estimated from a minimal sample may be imprecise because that small set contains measurement error. LO-RANSAC takes an apparently good candidate and searches within its support to improve it. The paper’s experiments also include LO-RANSAAC, a method that incorporates averaging of fitted parameters into robust estimation. Averaging candidate geometry and averaging over a noise-scale parameter are different operations. In σ-consensus, scale controls which points inform the intermediate fits and how their evidence is combined in the final fit.

The authors identify earlier efforts to reduce direct dependence on a cutoff. MIN-PRAN assumes uniformly distributed outliers and looks for support that would be unlikely to arise by chance. A contrario RANSAC chooses a scale for a candidate according to how plausible its support is under its statistical test. MAGSAC takes a different approach to the uncertain scale. It accumulates evidence across scales, so each candidate can be evaluated without choosing a single scale to represent it.

The cutoff also affects how long a conventional RANSAC search runs. The user supplies a confidence level, and the estimated inlier fraction determines how easily random draws can meet that target. If many points pass the cutoff, the calculation expects to see an all-inlier draw relatively soon. If few pass, it calls for more draws. A change in the cutoff can therefore change the amount of search as well as the score and the refinement. The design of MAGSAC follows these dependencies through the entire loop.

The method, step by step

From a provisional fit to weighted observations

Consider a homography fitted to a small draw of point matches. A narrow tolerance around that fit picks out a core of matches with little discrepancy. A wider tolerance may recover genuine matches displaced by measurement error, and it may also admit unrelated ones. Each group can be used to fit a new homography. The relation between a point and those new fits supplies more information than its distance from the initial homography alone.

σ-consensus uses this process to form a weighted fit. It takes an initial hypothesis, identifies observations that could support it within the allowed range of scales, and orders those observations by residual. A succession of tolerances produces nested support sets around the same starting hypothesis. The procedure refits the geometry as it processes these sets and accumulates a weight for each eligible observation from its residuals to the intermediate fits. The resulting weights govern how much each observation can influence the final parameters.

Full MAGSAC puts this refinement inside a random-sampling search. A generated candidate first goes through validation. The surviving candidate is refined and then scored by averaging its log-likelihood across scales. When that score improves on the best found so far, a scale-averaged calculation updates the sampling budget. A one-pass alternative starts from the output of a completed search and performs only the refinement. The two uses share σ-consensus and differ in when its result can affect the search.

How MAGSAC searches for and refines a fit

The steps in order.

How MAGSAC searches for and refines a fitStep 1: Draw a minimal sample and fit candidate geometry1. Draw a minimal sample and fit candidate geometryStep 2: Validate the candidate before refinement2. Validate the candidate before refinementStep 3: Sort eligible observations by residual3. Sort eligible observations by residualStep 4: Refit using support at successive scales4. Refit using support at successive scalesStep 5: Accumulate weights and perform weighted least squares5. Accumulate weights and perform weighted least squaresStep 6: Score the refined fit across scales6. Score the refined fit across scalesStep 7: Update the best fit and sampling budget7. Update the best fit and sampling budget

The inputs are observations and the fitting machinery associated with a geometric task. The estimator does its work on the current collection of points or matches. The paper’s procedure can be followed without learning weights from a separate dataset. The weights are calculated anew from the geometry and residuals of the current candidate. Data generation, collection, and annotation enter the evaluation, where they supply cases whose geometric errors can be measured.

Observations, residuals, and support

The paper writes the observation set as P and the parameters of a candidate as θ. An observation p can be a point or a correspondence. A correspondence between two image points has k = 4 coordinates in the paper’s notation for observation dimension. Candidate parameters belong to a space Θ, whose dimension depends on the fitting problem. The fitting function F in the derivation produces parameters from a subset of observations. This use of F as a fitting function is separate from the use of F to name a fundamental matrix in the experiments. The function can use a minimal solver on a sample of size m and a least-squares procedure when given a larger set.

The distance function D assigns each observation a residual with respect to θ. The inlier selector uses a distance cutoff τ that depends on the assumed noise scale. One description of its role is the following.

I(θ, σ, P) = {p ∈ P : D(θ, p) < τ(σ)}

Here I is the selected set, θ is the candidate, σ is the noise standard deviation, and P is the full set. The variable p ranges over members of P, as indicated by ∈. The braces collect the observations whose residual D is below the cutoff τ evaluated at σ. In the paper’s plain RANSAC example the cutoff is σ itself. In MAGSAC the scale and the distance cutoff are related through the assumed distribution of inlier residuals.

Q_RANSAC(θ, σ, P) = |I(θ, σ, P)|

Q_RANSAC denotes the ordinary support-count score. The arguments θ, σ, and P give the candidate, the assumed noise scale, and the observation set. I is the support selected for those arguments, and the vertical bars denote its size. A small change in a residual affects this score only when the residual crosses the boundary. The score can therefore stay flat over changes to a candidate and then jump as an observation enters or leaves the support.

Q_MSAC(θ, σ, P) = ∑ᵢ₌₁ⁿ [1 − D(θ, Iᵢ(θ, σ, P))² / ((9/4)σ²)]

Q_MSAC denotes the truncated-quadratic score in the paper’s example. The sum runs from the first inlier to the nth, where n is the size of the support and Iᵢ is its ith member. The squared residual D uses candidate θ and that member from P. For this example, the support consists of points with squared residual below (9/4)σ². The term in brackets gives full credit at zero distance and approaches zero near the cutoff. Only selected points enter the sum. The subtraction from 1 expresses this as a score to maximize.

These expressions expose two choices in a consensus score. One is how a residual earns credit at a given scale. The other is how much the result should depend on that scale. The paper first introduces averaging in a form that leaves the choice of score open. It then chooses a likelihood for the full estimator.

Averaging a score over an unknown scale

Marginalizing means integrating out a variable that affects the calculation but that the procedure need not recover as a separate answer. Here the variable is the noise scale. The paper represents uncertainty about it with a probability density.

Q*(θ, P) = ∫ Q(θ, σ, P) f(σ) dσ

Q* is the quality after averaging. Q is the quality assigned to candidate θ on observations P when the scale is σ, and f is the probability density over scales. The integral adds the contributions across the support of that density, with dσ indicating integration in σ. This construction can change which fit wins. A candidate that scores well at one scale may receive little support elsewhere, while a different candidate can earn favorable scores across a broader part of the range.

The authors use a uniform scale distribution up to a specified bound. The resulting expression is an average over the interval.

Q*(θ, P) = (1/σₘₐₓ) ∫₀^σₘₐₓ Q(θ, σ, P) dσ

The bounds are zero and σₘₐₓ, the largest noise scale considered. The factor 1/σₘₐₓ normalizes the interval’s contribution. The score Q still depends on the candidate θ and data P at each scale σ. The integral and dσ represent the continuous average. Uniform weighting is a choice about scales. Its effect on observations depends on the score and on where their residuals fall.

The authors illustrate the effect with the ordinary RANSAC count. If the assumed scale is itself the cutoff, a residual contributes whenever the cutoff exceeds it. A point close to the fit contributes across nearly the entire range. A point near the upper bound contributes only across a small part of it.

Q*(θ, P) = K − (1/σₘₐₓ) ∑ₖ₌₁ᴷ D(θ, pₖ)

Here pₖ is the observation with index k in ascending residual order, and K is the number of residuals below σₘₐₓ. The sum includes those K observations. Each residual D is measured with respect to θ, and P denotes the complete observation set behind the calculation. The right side gives a full unit of potential support per included point and subtracts the fraction of the scale interval in which its residual would be too large. Points beyond the upper bound contribute no support to this example.

A second illustration uses a likelihood with both residual distributions taken to be uniform. Inlier residuals lie between zero and the current scale. Outlier residuals have a fixed upper bound. Averaging the natural logarithm of this likelihood gives a different residual penalty.

Q*(θ, P) = K[ln(l/σₘₐₓ) + 1] − (1/σₘₐₓ) ∑ₖ₌₁ᴷ D(θ, pₖ)[1 + ln(l/D(θ, pₖ))] − |P| ln(l)

The symbol l is the end of the assumed outlier interval, and ln is the natural logarithm. As in the counting example, pₖ is the kth observation in residual order and K counts the residuals within the upper scale σₘₐₓ. The sum uses the candidate θ in every residual D. The symbol |P| gives the number of observations in the full set. The last term is the contribution that would result from assigning the uniform outlier density throughout. The other terms express the adjustment from observations that can count as inliers at some scale. This example shows how the distributional assumption changes the score even when the integration range stays the same.

The likelihood used in MAGSAC

For MAGSAC, the authors assume that an inlier residual is a Euclidean distance in a space with ρ dimensions. They treat the errors along the individual axes as independent, normal, and subject to a common variance σ². Under those assumptions the squared distance divided by that variance follows a chi-squared distribution with ρ degrees of freedom. The paper uses the corresponding density of the distance itself.

g(r | σ) = 2C(ρ) σ⁻ᵨ exp(−r²/(2σ²)) r^(ρ−1)

The function g is the inlier residual density, evaluated at distance r conditional on scale σ. The vertical bar marks the conditioning. The dimension ρ determines both the shape of the density and the normalization factor C. The function exp is the exponential, σ⁻ᵨ is the inverse scale raised to the dimension, and the last factor carries the power of the distance implied by that dimension. The r here is a residual, separate from the later use of r for an iteration setting.

C(ρ) = 1 / (2^(ρ/2) Γ(ρ/2))

C is the constant determined by dimension ρ, and Γ denotes the gamma function. The powers and the gamma term normalize the density in the preceding equation. They depend on the residual dimension rather than on the particular observation.

Γ(a) = ∫₀^∞ t^(a−1) exp(−t) dt

Γ is evaluated at a positive argument a, and t is the variable of integration. The integral runs from zero to infinity, denoted by ∞. The factors t^(a−1) and exp(−t) define the integrand, and dt specifies integration over t. This t has no connection to the processing-time statistic reported in the experiments.

The remaining assumption concerns observations outside the inlier cutoff. The paper assigns them a uniform density from zero to l and suggests using the image diagonal for l in imaging problems. At each scale it chooses a cutoff at a quantile of the inlier distribution, giving 0.95 or 0.99 as choices. A quantile is a distance below which the stated fraction of the assumed distribution falls. The algorithm discussion gives a cutoff of 3.64σ for its example with a chi-squared distribution with 4 degrees of freedom. As the scale rises, the cutoff rises with it and the same residual may move from the outlier group to the inlier group.

L(θ, P | σ) = l^(−(|P|−|I(θ, σ, P)|)) ∏ₚ∈I(θ, σ, P) g(D(θ, p) | σ)

L is the likelihood assigned to candidate θ for observations P given scale σ. I is the support at that scale. The difference between the sizes |P| and |I| counts observations on the outlier side, each of which supplies a density factor of 1/l. The product symbol ∏ multiplies the inlier density g for each p in I, evaluated at the residual D. The likelihood therefore includes a contribution from observations that fail the cutoff as well as from observations that pass it.

Q*_MAGSAC(θ, P) = (1/σₘₐₓ) ∫₀^σₘₐₓ ln L(θ, P | σ) dσ

Q*_MAGSAC is the refined candidate’s score. Candidate θ and the observation set P remain fixed during this integral. L is evaluated at each σ, ln takes its natural logarithm, and the factor 1/σₘₐₓ turns the integral from zero to the upper scale into an average. The order of the operations matters. The score integrates the log of the scale-specific likelihood.

The calculation can use the fact that, for fixed geometry, the support changes only when a threshold crosses a residual. The paper orders the residuals and associates each with its entry scale. At the ith entry scale, τ evaluated at σᵢ reaches the distance of pᵢ from the candidate. Between successive entry scales, the support used in the likelihood is constant except at the boundary. Evaluating the terms over those intervals gives the paper’s approximation.

Q*_MAGSAC(θ, P) ≈ −|P| ln(l) + (1/σₘₐₓ) ∑ᵢ₌₁ᴷ i(ln(2C(ρ)l) − ρ ln(σᵢ)) − Rᵢ/σᵢ² + (ρ−1)Lrᵢ

The sign ≈ marks an approximation. The index i runs over K entry scales within the allowed range, with the lower boundary σ₀ at zero in the paper’s sum. The width σᵢ−σᵢ₋₁ determines the contribution of each evaluated interval. The expression uses the size |P| of the whole collection, the outlier limit l, the dimension ρ, and the normalization C. Rᵢ stores half the sum of squared residuals for the first i observations, and Lrᵢ stores the sum of their log residuals. Those residuals depend on θ and on the ordered points in P. The factor i multiplies the log terms that are common to the inlier observations included in that contribution.

The ordered sums connect the statistical expression to the mechanics of the implementation. When the scale passes another observation’s entry point, the score can use residual information accumulated from the observations already inside the cutoff. The log-likelihood groups together quantities shared by all inliers at a scale and quantities that depend on their individual distances. This scoring calculation concerns a single fixed candidate. The refinement uses a related calculation in which the geometry itself changes with the scale.

How σ-consensus produces a new fit

Refinement starts with the geometry obtained from a minimal sample or supplied by a completed robust search. The authors first take its support at the largest allowed cutoff. They sort the eligible observations according to residual so that points can be added as the scale grows. For the cutoff example with the multiplier 3.64, a candidate observation’s entry scale is its residual divided by 3.64. In the pseudocode, the effective end of the range for the refinement is set to the largest entry scale in the retained set after the initial upper-bound check.

θ_σ = F(I(θ, σ, P))

The left side, θ_σ, is the fit induced by scale σ. The fitting function F receives the selected support I from all observations P around the original geometry θ. For a usable support larger than the minimal sample, F can use a least-squares fit. The sets are selected around the starting geometry, which fixes the residual ordering. Each refit provides a separate geometry against which the observations can be measured.

At a given scale, the weight calculation uses the inlier density on residuals to this new fit. In the paper, the value obtained by integration is termed a point’s inlier likelihood and serves as its weight in the fit.

L(p | θ) ≈ (2C(ρ)/σₘₐₓ) ∑ᵢ₌₁ᴷ (σᵢ−σᵢ₋₁) σᵢ⁻ᵨ D(θ_σᵢ, p)^(ρ−1) exp(−D(θ_σᵢ, p)²/(2σᵢ²))

L(p | θ) is the weight expression for observation p given the starting fit θ. The terms inside the sum correspond to evaluated scales σᵢ and carry the interval widths σᵢ−σᵢ₋₁. The upper scale σₘₐₓ normalizes the average. The notation θ_σᵢ denotes the geometry refitted at scale σᵢ. Its residual D for p enters the chi-derived density with dimension ρ and normalization C. The exponential is written as exp. K gives the number of terms in this expression before the paper’s refinement shortcut groups the range into coarser partitions.

There are two distinct uses of the residual in this process. The initial residual determines when a point can participate in constructing a scale-specific fit. Its residual to an intermediate fit determines its contribution to the weight calculation at that scale. A point whose initial residual is substantial may have a much smaller residual after a broader support allows the geometry to move. Conversely, a point that helped define the minimal hypothesis may fit the geometry less closely once other observations influence it.

A final fit uses one weight per eligible observation. The calculation yields one set of parameters, with each weight reflecting evidence accumulated from multiple scale-specific fits.

θ* = F(I, {wᵢ}ᵢ₌₁^|I|)

The result θ* is the refined fit. In this expression I is the set retained at the initial upper cutoff, |I| is its size, and wᵢ is the accumulated weight for its ith observation. The braces collect all these weights, and F now denotes the weighted least-squares version of the fitting function. Giving the weights to the solver preserves differences in support that a final fit on one accepted set would discard.

How the search ends and where computation is saved

A conventional RANSAC iteration calculation starts with the fraction of the observations accepted by the incumbent fit. The probability used for a minimal draw depends on that fraction and on the number of points the solver needs. The paper writes the iteration calculation as follows.

k(θ, σ, P) = ln(1−η) / ln(1−(|I(θ, σ, P)|/|P|)^m)

Here k is the iteration requirement, θ is the current best fit, and σ is the scale defining the support I within observations P. Dividing the two set sizes gives the support fraction. The exponent m is the size of a minimal sample. The parameter η is the requested confidence, and ln takes natural logarithms. The denominator uses the complement of the estimated probability of an all-inlier minimal draw. Repeated draws motivate the logarithmic count. The authors qualify the probability interpretation of confidence for the ordinary binary scoring rule.

MAGSAC has several scale-specific supports, so the authors average the iteration requirement over the possible scales.

k*(P, θ) = (1/σₘₐₓ) ∫₀^σₘₐₓ k(θ, σ, P) dσ

The symbol k* denotes the adjusted sampling budget for incumbent θ and data P. The integral averages the RANSAC iteration calculation k from zero to the maximal scale σₘₐₓ. The differential dσ signifies an integral over noise scales. The integrand is an iteration requirement at each scale, so a scale with weak support can call for a large contribution to that budget.

k*(P, θ) ≈ (1/σₘₐₓ) ∑ᵢ₌₁ᴷ (σᵢ−σᵢ₋₁) ln(1−η) / ln(1−(|I(θ, σᵢ, P)|/|P|)^m)

Here the sum approximates the average using the K ordered scale entries. The width σᵢ−σᵢ₋₁ weights the iteration requirement obtained from the support I of θ at scale σᵢ. The set-size ratio is evaluated within P. The confidence η, minimal sample size m, logarithm ln, and normalizing upper bound σₘₐₓ have the same meanings as in the earlier expressions. The algorithm recalculates this quantity when a refined candidate becomes the best scored fit.

Repeated fitting is the main extra work inside refinement. The paper limits that work by replacing a potential refit at every entry scale with refits at the boundaries of a smaller number of equal scale partitions. If the point ordering stays fixed and several entries fall within one partition, a single refit represents that part of the range. The experimental partition count was d = 10, where d denotes the number of scale intervals for this procedure. The tradeoff is between the cost of extra fits and how finely the implementation represents changes in support.

The candidates also go through validation. The paper includes checks for degenerate samples, whose geometry cannot give a useful estimate, and a sequential probability ratio test, or SPRT, for rejecting unpromising candidates early. The latter uses a reference threshold of 1 pixel in the experiments. Its role is to decide whether the rest of the evaluation is worth doing. The scale-averaged score and the supports used for refinement are governed by the scale range. The authors describe using the early rejection test while calculating the residuals in the refinement procedure as well.

Computing the contributions from different scales also offers scope for parallel work. The authors’ C++ implementation uses multiple CPU cores, and the paper describes distributing scale evaluations across threads. The authors make their implementation available under the name magsac. In the one-pass variant, the implementation only incurs the cost of scale-based refinement once, after a baseline finishes. The full variant incurs that work on candidates that survive validation and can use the resulting fit and score to steer the search.

Experiments and results

What was compared and measured

The experiments compare plain RANSAC and MSAC, their locally optimized versions, and the full MAGSAC procedure. The real-image comparison also includes LO-RANSAAC and AC-RANSAC. A separate set of rows applies σ-consensus after the baseline has finished. These rows use the same sampling iterations as their unrefined counterparts. They answer whether the final fit improves when the proposed procedure works with the output of an otherwise completed estimator.

The authors used a common random seed across methods. The baseline procedure includes a final least-squares fit on its selected support. In the local optimization variants the inner RANSAC used r = 20 iterations. A minimum of 20 iterations was required before the first local optimization and before termination. The reported setting for the threshold in the baseline RANSAC loop was σ = 0.3, and the requested confidence for the standard comparisons was η = 0.95. Across the tested problems the σ-consensus scale bound was 10 pixels, with d = 10 partitions. The confidence used to set the sampling budget and the quantile used to choose a scale-specific cutoff serve separate purposes.

Geometric error is measured against reference inlier correspondences. For homography, the relevant discrepancy is reprojection error, which compares a location predicted by the fitted mapping with its observed partner. For fundamental and essential matrices, the paper uses Sampson distance. In the essential matrix case it evaluates the fundamental matrix implied by the estimate on the correspondences. The real-image table reports root mean square geometric error in pixels and gives separate columns for mean processing time, mean samples drawn, and the proportion of failures. Its aggregate block also reports a median geometric error. These statistics distinguish how closely the returned geometry fits the reference matches, how frequently the sought fit is found, and how much work the method used.

Controlled homography tests

The synthetic experiment generates two camera views of a plane. The first camera is placed at the origin with its image plane parallel to the XY plane. The second is placed at a random point inside a unit sphere around the first and given a random orientation composed from rotations about the principal axes. Both cameras share focal lengths of 600 and a principal point with coordinates [300, 300]. The plane has a randomly chosen orientation and an origin at [0, 0, 5]. Points sampled near that origin are projected into the two cameras to make genuine correspondences.

The authors draw the random scene parameters uniformly. They add zero-mean Gaussian noise of standard deviation σ to the projected coordinates. They then add false correspondences drawn uniformly at random. The experiment uses 200 correspondences per case and presents mean results from 500 runs. For the condition with an outlier ratio of 0.8, the paper reports 160 outliers and 40 inliers. The experimenter thus knows the noise and the outlier proportion while the estimators work from the noisy observations.

The principal accuracy plots vary the coordinate noise separately at outlier ratios of 0.2, 0.5, and 0.8. MAGSAC delivers the lowest errors among the compared methods across those outlier-ratio conditions. Applying σ-consensus once also improves the baseline errors in most of these comparisons. For example, the authors report that the locally optimized MSAC fit benefited at every plotted noise scale in the comparison they highlight.

The time plot shows the cost of polishing candidates when a search is already easy. MAGSAC is slowest for the synthetic scenes with σ < 0.3 pixels. The reported ordering reverses beyond that low-noise region. The authors attribute the faster processing there to the method using fewer iterations. The result illustrates how a cost paid for individual candidate fits can be offset by a shorter search, depending on how difficult the input is.

The authors also ran the competitors with common iteration budgets derived from the known inlier ratios and confidence 0.999. For an outlier ratio of 0.8, the budget was 4,314 iterations. For an outlier ratio of 0.9, it was 69,074 iterations. MAGSAC still returned appreciably more accurate homographies and found the sought fit in most cases even at high outlier ratios. This comparison gives the baselines the sampling opportunity associated with the known contamination level and tests whether their accuracy catches up under that allowance.

Fundamental matrices

The fundamental matrix experiments use kusvod2, AdelaideRMF, and Multi-H. Kusvod2 contains 24 image pairs of differing sizes, with correspondences and reference geometry from manually selected inliers. For AdelaideRMF and Multi-H, the available point matches have assignments to a homography or to an outlier class. The experiment counts any match assigned to a homography as a reference inlier for the fundamental matrix. This uses the planar assignments as evidence about the validity of the correspondence for the two views.

The paper reports 19 AdelaideRMF pairs. Its dataset description says Multi-H contains 5 pairs, while the results table lists 4 Multi-H pairs. The prose reports 48 fundamental matrix pairs in total, and the table caption reports 545 image pairs across the real-image evaluation. The paper does not explain the difference in Multi-H counts. The accuracy values below are the dataset-level means as reported in the results table.

The methods use the seven-point solver for minimal hypotheses. Final least-squares fitting for the conventional pipeline uses the normalized eight-point algorithm on the chosen support. The authors also discard fundamental matrices that fail an oriented epipolar constraint. The reported dataset results average 100 runs on each image pair. Sharing the minimal solver and geometry check makes the comparisons about the robust estimation procedure around those steps.

Mean fundamental matrix geometric error on kusvod2

MAGSAC has the lowest mean error, and the baseline refinements improve on their corresponding original fits.

Mean fundamental matrix geometric error on kusvod2RANSAC: 0.73RANSAC0.73RANSAC + σ-consensus: 0.60RANSAC + σ-consensus0.60MSAC: 0.75MSAC0.75MSAC + σ-consensus: 0.64MSAC + σ-consensus0.64LO-RANSAC: 0.56LO-RANSAC0.56LO-RANSAC + σ-consensus: 0.52LO-RANSAC + σ-consensus0.52LO-MSAC: 0.58LO-MSAC0.58LO-MSAC + σ-consensus: 0.50LO-MSAC + σ-consensus0.50AC-RANSAC: 0.63AC-RANSAC0.63MAGSAC (this paper): 0.38MAGSAC (this paper)0.38
The numbers
System or settingpixels
RANSAC0.73
RANSAC + σ-consensus0.60
MSAC0.75
MSAC + σ-consensus0.64
LO-RANSAC0.56
LO-RANSAC + σ-consensus0.52
LO-MSAC0.58
LO-MSAC + σ-consensus0.50
AC-RANSAC0.63
MAGSAC (this paper)0.38

The kusvod2 result combines a mean error of 0.38 pixels for MAGSAC with a reported failure proportion of 0.00. The fundamental matrix failure proportions for the other listed methods on that dataset were 0.06. MAGSAC took 31 milliseconds on average on kusvod2. LO-MSAC took 17 milliseconds, and the row with its final σ-consensus step also reports 17 milliseconds. Thus the lowest geometric error and lowest mean time belong to different methods on this dataset.

On Multi-H, MAGSAC had a mean geometric error of 0.47 pixels. Both LO-MSAC and its σ-consensus variant report 0.50 pixels there. On AdelaideRMF, MAGSAC had a mean of 0.30 pixels, compared with 0.28 for LO-RANSAC and 0.27 for LO-RANSAC with σ-consensus. The authors report that MAGSAC ranked third on this dataset by a margin of 0.03 pixels from the best result. MAGSAC also used 939 milliseconds on average there, compared with 394 milliseconds for the most accurate AdelaideRMF configuration. The paper estimates a reduction of approximately 8% in fundamental matrix error when the baselines received the final σ-consensus step, with improvements in almost all of those tests.

Homographies

The homography evaluation uses 16 image pairs from homogr and 15 from EVD, with manually selected inliers. The image sizes range from 329 × 278 to 1712 × 1712. Homogr is chiefly a small-baseline stereo collection. EVD contains larger changes in viewpoint or zoom. Objects or surfaces that cover corresponding regions in both images can therefore look substantially different, even where a homography describes the geometric relation. The methods use the normalized four-point algorithm in hypothesis generation and local optimization.

On homogr, MAGSAC reports a mean reprojection error of 1.37 pixels. AC-RANSAC reports 1.83 pixels, with mean times of 131 milliseconds for MAGSAC and 37 milliseconds for AC-RANSAC. The failure proportions on homogr are 0.06 and 0.00 respectively. The average geometric error and the proportion of failures describe different properties of these results. The paper reports both, which allows the methods’ standings on each measure to be read directly.

Mean homography reprojection error on EVD

MAGSAC gives the lowest mean error on the image pairs with extreme view changes.

Mean homography reprojection error on EVDRANSAC: 5.73RANSAC5.73RANSAC + σ-consensus: 4.08RANSAC + σ-consensus4.08MSAC: 5.15MSAC5.15MSAC + σ-consensus: 3.57MSAC + σ-consensus3.57LO-RANSAC: 5.42LO-RANSAC5.42LO-RANSAC + σ-consensus: 4.07LO-RANSAC + σ-consensus4.07LO-MSAC: 4.78LO-MSAC4.78LO-MSAC + σ-consensus: 3.55LO-MSAC + σ-consensus3.55AC-RANSAC: 5.05AC-RANSAC5.05MAGSAC (this paper): 1.76MAGSAC (this paper)1.76
The numbers
System or settingpixels
RANSAC5.73
RANSAC + σ-consensus4.08
MSAC5.15
MSAC + σ-consensus3.57
LO-RANSAC5.42
LO-RANSAC + σ-consensus4.07
LO-MSAC4.78
LO-MSAC + σ-consensus3.55
AC-RANSAC5.05
MAGSAC (this paper)1.76

The EVD table records a failure proportion of 0.29 for MAGSAC. AC-RANSAC reports 0.33, and the final σ-consensus variant of LO-MSAC reports 0.43. MAGSAC also uses fewer draws and less time than those methods on EVD. Its mean sampling count is 2,239 and its mean processing time is 162 milliseconds. AC-RANSAC reports 3,463 draws and 291 milliseconds. Across the homography comparisons with and without the final σ-consensus procedure, the paper reports an average improvement of 1.42 pixels.

The figure with individual examples illustrates the range of scenes behind the means. In a homogr example, the caption gives 2.9 pixels for MAGSAC and 4.3 pixels for the next most accurate estimate, from LO-MSAC. For an EVD example, MAGSAC has 4.4 pixels against 9.1 for runner-up LO-RANSAC. Those are selected image pairs for which the improvement was pronounced. The mean errors measure performance over the datasets, including pairs that provide less separation between the methods.

Essential matrices and the combined results

The essential matrix evaluation uses Strecha image sequences of buildings. The images are 3072 × 2048, and the supplied projection matrices specify the reference cameras. The authors take the possible pairs within each sequence and obtain correspondences using the SIFT detector. To form the reference inlier set for each pair, they calculate a fundamental matrix from the projection matrices and keep matches whose symmetric epipolar distance falls below 1.0 pixel. They discard pairs with fewer than 50 such inliers. The resulting evaluation contains 467 image pairs.

Mean essential matrix geometric error on Strecha

MAGSAC has the lowest mean error, and a final σ-consensus pass improves each paired baseline in the chart.

Mean essential matrix geometric error on StrechaRANSAC: 7.05RANSAC7.05RANSAC + σ-consensus: 6.91RANSAC + σ-consensus6.91MSAC: 7.32MSAC7.32MSAC + σ-consensus: 7.13MSAC + σ-consensus7.13LO-RANSAC: 9.61LO-RANSAC9.61LO-RANSAC + σ-consensus: 9.48LO-RANSAC + σ-consensus9.48LO-MSAC: 10.62LO-MSAC10.62LO-MSAC + σ-consensus: 10.23LO-MSAC + σ-consensus10.23AC-RANSAC: 15.56AC-RANSAC15.56MAGSAC (this paper): 6.51MAGSAC (this paper)6.51
The numbers
System or settingpixels
RANSAC7.05
RANSAC + σ-consensus6.91
MSAC7.32
MSAC + σ-consensus7.13
LO-RANSAC9.61
LO-RANSAC + σ-consensus9.48
LO-MSAC10.62
LO-MSAC + σ-consensus10.23
AC-RANSAC15.56
MAGSAC (this paper)6.51

On Strecha, MAGSAC also has the shortest mean processing time, at 2,398 milliseconds, and a mean of 2,183 samples. The locally optimized MSAC baseline reports 2,535 milliseconds and 2,770 samples. The failure proportion is 0.00 for MAGSAC, while the plain RANSAC row reports 0.24 and its final σ-consensus variant reports 0.22. One selected Strecha example gives 2.5 pixels for MAGSAC and 4.2 for MSAC, the next most accurate result on that pair. A second example gives 3.9 pixels for MAGSAC and 5.6 for MSAC.

The combined block of the real-image table gives MAGSAC a mean geometric error of 1.80 pixels and a median of 0.92 pixels. Plain RANSAC reports a mean of 3.07 pixels and a median of 2.17. With σ-consensus applied at the end, those RANSAC statistics are 2.47 and 1.36 pixels, respectively. The combined failure proportions are 0.03 for MAGSAC, 0.19 for RANSAC, and 0.16 for RANSAC with the final refinement. Mean processing times for those configurations are 688, 727, and 730 milliseconds respectively. The aggregate combines different geometric tasks and residual definitions, so the dataset-level measurements give the context for each of those overall values.

What the ablations show

Refining the same search output

The clearest component comparison is the use of σ-consensus after an otherwise completed run. The baseline and its refined version have the same sample counts because the extra pass comes after termination. Their recorded errors can therefore show what changes when refinement is added to the output, without giving the refined baseline a different sampling history. The comparison is relevant even when a baseline already uses a local optimization step and performs a final least-squares fit.

On kusvod2, all the paired baseline means drop with the extra pass. The reduction in the mean from 0.58 pixels to 0.50 for locally optimized MSAC comes with the same reported mean of 160 draws. On Multi-H, the same baseline stays at 0.50 pixels with the additional pass at the reported precision. On AdelaideRMF, its value stays at 0.31 pixels, while the locally optimized RANSAC variant moves from 0.28 to 0.27 pixels. These comparisons give empirical support for the refinement while showing that a measurable gain depends on the fit and the dataset.

The homography comparisons show larger changes in the reported mean errors. The plain MSAC fit goes from 3.64 to 2.18 pixels on homogr and from 5.15 to 3.57 pixels on EVD. For homogr, its reported mean time goes from 64 to 65 milliseconds, and the mean sample count remains 1,395. For EVD, the mean time goes from 379 to 380 milliseconds, and the mean sample count remains 6,106. These paired measurements demonstrate the practical distinction between adding weight-based refinement once and adopting the full algorithm’s candidate loop.

The final pass affects the returned parameters and can influence whether a run meets the failure criterion. It works from the initial solution delivered by the baseline, so it has no opportunity to generate a fundamentally different candidate by drawing a fresh minimal sample. The smallest improvements and ties show why the effect is best described over reported comparisons. Even when a systematic reduction appears in the mean, that statistic does not establish an improvement for every run.

Holding the sampling budget fixed

The synthetic fixed-budget test controls a different source of improvement. Full MAGSAC changes the score and the stopping rule together with the candidate refinement. If its advantage came completely from having more opportunities to draw a good sample, supplying the competitors with the same budget could remove that advantage. The experiment computes the budget from the known outlier ratio and uses the same allowance across methods.

The accuracy gap remains under that control. This supports attributing some of the gain to what MAGSAC does with the hypotheses available under a fixed budget. The experiment leaves several changes active at once. A better result may come from making a stronger fit from a promising sample, from ranking the improved fits more effectively, or from an interaction between the two. The paired final-pass comparisons provide separate evidence for weighted refinement after the fact. They do not measure how much the same refinement contributes when applied repeatedly inside the full search.

The two synthetic experiments can also be read together. In the normal run, changes in runtime reflect both the cost per candidate and the number of candidates considered. In the fixed-budget run, the accuracy comparison limits the effect of stopping differences. The paper gives no isolated comparison in which only the stopping criterion is swapped while scoring and refinement stay fixed. It likewise gives no separate error curve for substituting the marginal score alone. Its evidence is strongest for the complete estimator and for the post-processing pass as independent use cases.

Varying noise and outliers

The authors generate synthetic inliers and outliers separately, which allows them to raise coordinate noise while holding the outlier ratio fixed. The error curves trace how each estimator responds as genuine matches become less precise. Repeating that comparison at different outlier ratios exposes the estimator to more false matches without changing what the noise parameter means. MAGSAC performs well across these conditions, and the extra refinement on baseline outputs typically reduces their errors.

This design helps distinguish failure to pick a clean sample from imprecision after a usable fit has been found. More outliers make clean draws harder to obtain. More noise can make an all-inlier draw a poor estimate of the underlying geometry and can make its broader support hard to recognize. The error curves reflect both challenges when they occur together. The fixed-budget comparison and the once-only refinement comparison address parts of that joint effect. Neither supplies a decomposition of the errors into separate contributions from sampling, ranking, and weighted fitting.

The real-image examples complement those controls by showing outcomes on particular scenes. The selected kusvod2 fundamental matrix example gives 0.5 pixels for MAGSAC and 14.3 pixels for second-place MSAC. Such a pair illustrates how much estimates can diverge even within the same task and dataset. The dataset means and failure proportions are needed to judge how representative that kind of separation is. AdelaideRMF and the runtime differences across datasets show that the strongest example pairs are only part of the performance picture.

Limitations

Limits the authors identify

The method replaces the need to specify a single precise noise scale with a requirement to specify its upper bound. The authors choose 10 pixels for their experiments and suggest increasing the bound and repeating the calculation if the residual distribution appears concentrated near the upper end. Their account makes the bound part of the estimator’s working assumptions. If the admissible region is too narrow around an initial candidate, observations outside it will be missing from the weight calculation. A larger bound admits a wider range of explanations and may expose the refinement to more false matches.

The paper also identifies computational cost. Marginalization by successive refits can be expensive. The practical procedure uses a partitioned approximation, early rejection, and parallel scale processing. In the easy synthetic conditions the cost is still visible in the measured processing time. Applying the method once at the end reduces that cost and keeps the original search and its settings in use. The full version can gain accuracy from refining and rescore each promising candidate during the search, with a cost that depends on how many reach that stage.

The authors explicitly condition the inlier density on independent, normally distributed coordinate errors with common variance in the residual space. They use a uniform outlier density. These assumptions determine both the score and the contributions to refinement. Real false matches can be structured, and real inlier precision can vary across observations. The fitted weights summarize evidence under the paper’s density assumptions. There is no calibration result showing that those weights correspond to empirical probabilities of correctness for arbitrary observations.

The authors note that the usual probabilistic interpretation of the RANSAC confidence parameter applies to the ordinary binary score. Their proposed termination rule averages iteration counts while candidate quality comes from a marginalized log-likelihood. The confidence parameter still controls the calculation. The paper does not establish that the requested value has the same probability interpretation for the entire MAGSAC procedure.

Limits of what the experiments establish

The paper evaluates a single upper-bound choice and partition setting across its reported tasks. That is evidence that those choices can serve several geometric problems in the tested data. The experiments do not map how results change as the upper bound moves or as the partitioning grows coarser or finer. They also do not isolate the effect of varying the validation threshold. Such a sensitivity comparison would require changes to those parameters while holding the other parts of the estimator fixed.

The synthetic evidence comes from correspondences generated for a plane, with Gaussian coordinate perturbation and independently generated uniform false matches. This gives the authors exact control over the noise and outlier fraction. It also supplies errors of a kind related to the assumptions used in the estimator. The experiments establish performance as those particular sources of difficulty vary. They cannot show the same behavior under different error distributions, ambiguous matches concentrated on competing structures, or different patterns of localization error.

The real-image evaluations broaden the evidence and define reference inliers in different ways. In the fundamental matrix tasks, the use of assignments to homographies treats every correspondence on an annotated plane as valid for the epipolar geometry of the image pair. The Strecha procedure obtains reference inliers by thresholding their distance to geometry derived from camera projections. It also excludes pairs with fewer than 50 such matches. The reported essential matrix results apply to the remaining pairs with that correspondence and reference construction. They leave open performance on the excluded pairs and on data with very little verified support.

The table includes failures, mean error, and runtime, but the text gives no interval estimates for differences between methods. A mean error ranks performance under the chosen aggregation. It gives limited information about variation across image pairs and repeated draws, especially when considering a small gap such as the AdelaideRMF result. The paper also leaves the difference between its two Multi-H pair counts unresolved. Its stated dataset means can be reported while keeping the exact test count uncertain for that collection.

The timing results describe the paper’s implementations and workloads. The full method uses a multi-core implementation of σ-consensus, and the baseline tests keep a particular set of stopping and optimization parameters. The paper shows that MAGSAC can be faster when a reduction in the search outweighs its refinement cost. It also shows longer processing times on some datasets and in the easy synthetic regime. The results do not imply a single runtime ordering across implementations, hardware, or the distribution of candidate quality.

Finally, the paper’s broad descriptions of the final refinement include both universal and qualified language about improvements. The actual paired results support the qualified conclusion. Some configurations tie at the reported precision, and the synthetic discussion describes improvement in almost all comparisons. Applying σ-consensus to a baseline output gives it a chance to improve the geometry using scale-dependent evidence. Its success remains tied to the quality of the starting fit, the residuals available within the bound, and the relevance of those residuals to the assumed distribution.

What came after

The paper closes with two concrete uses of σ-consensus. An estimator can apply it to promising hypotheses while the search is in progress, as MAGSAC does, or use it once after selecting a fit. The experiments document both uses within the paper. No subsequent work is documented here, so specific later adoptions and extensions remain outside the scope of the account.

Cite

Cite as Dániel Baráth, Jiřı́ Matas and Jana Noskova. 2019. MAGSAC: Marginalizing Sample Consensus. IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings - IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.1109/cvpr.2019.01044 · arXiv 1803.07469

@inproceedings{barath2019magsac,
  title = {{MAGSAC: Marginalizing Sample Consensus}},
  author = {Dániel Baráth, Jiřı́ Matas and Jana Noskova},
  booktitle = {IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings - IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings},
  year = {2019},
  doi = {10.1109/cvpr.2019.01044},
  eprint = {1803.07469},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.1109/cvpr.2019.01044}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/barath-2019-magsac-marginalizing-sample-consensus/