MAGSAC: Marginalizing Sample Consensus.

Daniel Barath, Jiri Matas, Jana Noskova

Abstract

A method called, sigma-consensus, is proposed to eliminate the need for a user-defined inlier-outlier threshold in RANSAC. Instead of estimating the noise sigma, it is marginalized over a range of noise scales. The optimized model is obtained by weighted least-squares fitting where the weights come from the marginalization over sigma of the point likelihoods of being inliers. A new quality function is proposed not requiring sigma and, thus, a set of inliers to determine the model quality. Also, a new termination criterion for RANSAC is built on the proposed marginalization approach. Applying sigma-consensus, MAGSAC is proposed with no need for a user-defined sigma and improving the accuracy of robust estimation significantly. It is superior to the state-of-the-art in terms of geometric accuracy on publicly available real-world datasets for epipolar geometry (F and E) and homography estimation. In addition, applying sigma-consensus only once as a post-processing step to the RANSAC output always improved the model quality on a wide range of vision problems without noticeable deterioration in processing time, adding a few milliseconds.

Introduction

Robust estimation is a cornerstone of computer vision, used to fit geometric models—such as planes or camera motions—to data containing "outliers" (incorrect matches). Since 1981, RANSAC (Random Sample Consensus) has been the standard tool for this task. However, RANSAC has a major "Achilles' heel": it requires a user-defined noise threshold ($\sigma$) to decide which points are inliers.

Example of feature matching between two images of a scene, illustrating the challenge of robust estimation in the presence of outliers.

If the threshold is too tight, valid data is ignored; if it is too loose, the model becomes imprecise. In practice, the optimal threshold varies from scene to scene based on sensor noise, resolution, and texture, making it nearly impossible to choose a single $\sigma$ that works universally. MAGSAC (Marginalizing Sample Consensus) eliminates the need for this manually tuned parameter, providing a robust, "off-the-shelf" estimator for fundamental computer vision tasks.

The $\sigma$-consensus Framework

The authors introduce $\sigma$-consensus, a framework that treats the noise scale $\sigma$ not as a fixed constant, but as a random variable to be marginalized out.

  1. Marginalization over $\sigma$: Instead of picking one threshold, the algorithm considers all possible thresholds up to a reasonable upper bound ($\sigma_{max}$). The quality of a model is calculated by integrating its likelihood over this range of noise scales.
  2. Weighted Least Squares: To refine a model, MAGSAC uses weighted least-squares fitting, where each point’s weight is its probability of being an inlier across the entire range of marginalized noise scales. This "soft" inlier approach captures more information than binary thresholding, as points that are "almost inliers" still contribute meaningfully to the model's refinement.
  3. New Quality Function and Termination: The paper proposes a new quality function and a RANSAC termination criterion (the "stopping rule") that are both marginalized over $\sigma$, making the entire pipeline independent of a specific noise threshold.
  4. Computational Efficiency: To prevent the marginalization from becoming too slow, the authors use a partitioned approach (dividing the $\sigma$ range into discrete bins) and apply the Sequential Probability Ratio Test (SPRT) to quickly discard poor model hypotheses.

Experimental Evaluation

The method was evaluated on several standard, publicly available real-world datasets for various geometric tasks, including homography estimation (homogr, EVD) and fundamental matrix estimation (kusvod2, AdelaideRMF).

RMSE of inliers across four major datasets: (a) homogr, (b) EVD, (c) AdelaideRMF, and (d) kusvod2.

MAGSAC consistently outperformed state-of-the-art methods (such as MLESAC and LO-RANSAC) across all datasets. For example, on the Strecha dataset for Essential Matrix estimation, MAGSAC achieved a mean error of 6.51 px, compared to 10.62 px for LO-MSAC. In synthetic tests with a 90% outlier ratio, MAGSAC remained stable while other methods' errors spiked significantly. Furthermore, MAGSAC showed a near-zero failure rate on datasets where other robust estimators frequently failed to find the correct model.

Conclusion

MAGSAC eliminates the most sensitive parameter in traditional RANSAC by marginalizing over noise scales. This approach achieves significantly higher geometric accuracy and robustness to outliers. While MAGSAC requires an upper bound $\sigma_{max}$ (e.g., 10 pixels), this parameter is far less sensitive than the precise threshold required by standard RANSAC. Additionally, the authors found that applying $\sigma$-consensus just once as a post-processing step to the output of any other RANSAC variant consistently improved model quality with only a few milliseconds of overhead.

Summary updated

BibTeX
@inproceedings{barath2019magsac,
  author = {Daniel Barath and Jiri Matas and Jana Noskova},
  title = {{MAGSAC: Marginalizing Sample Consensus.}},
  booktitle = {CVPR},
  year = {2019},
  url = {https://openreview.net/forum?id=rsLDCX7x_Tr},
}
Figure