MAGSAC: Marginalizing Sample Consensus

Dániel Baráth, Jiřı́ Matas, Jana Noskova

Abstract

Standard RANSAC algorithms require a manually tuned inlier-outlier threshold, which is notoriously difficult to set because noise varies from scene to scene. This paper introduces MAGSAC, a novel approach that eliminates this threshold by marginalizing over a range of possible noise scales. This results in a highly accurate, threshold-free robust estimator that can also be used as a plug-and-play post-processing step for existing RANSAC variants.

Introduction

In computer vision, the RANdom SAmple Consensus (RANSAC) algorithm is the standard method for robust model fitting, such as finding the fundamental matrix between two images while ignoring mismatched keypoints. However, RANSAC's performance is heavily dependent on a user-defined inlier noise scale ($\sigma$). This parameter acts as a hard threshold separating "good" data points (inliers) from "bad" ones (outliers).

Robust model fitting involves identifying correct matches (inliers) among many potential mismatches (outliers) across different perspectives.

In real-world applications, noise is rarely uniform. The optimal $\sigma$ varies significantly based on camera resolution, lighting conditions, and perspective changes. Setting the threshold too low discards valid data, while setting it too high allows outliers to corrupt the model. MAGSAC addresses this "Achilles' heel" by removing the need for a fixed threshold.

Methodology

The core of the proposed approach is $\sigma$-consensus, a method that marginalizes over a continuous range of possible noise scales rather than selecting a single $\sigma$.

Key Components

  • Marginalized Quality Function: Instead of a binary inlier count, MAGSAC evaluates model quality by integrating the likelihood of the model over a range of $\sigma$ values up to a loose upper bound ($\sigma_{max}$).
  • Probabilistic Model Fitting: The final model is refined using weighted least-squares, where each point's weight is its marginalized probability of being an inlier.
  • Adaptive Termination: The algorithm adapts the standard RANSAC termination criterion to work without a hard inlier count by marginalizing the criterion itself over the noise scale range.
  • Efficiency: To maintain computational tractability, the integral over $\sigma$ is discretized, and early-rejection tests (SPRT) are employed to skip poor model candidates.

MAGSAC can function as a standalone estimator or be applied as a post-processing "polishing" step to the output of any existing robust estimator (e.g., MSAC or LO-RANSAC).

Experimental Evaluation

The authors evaluated MAGSAC across several challenging datasets, including kusvod2, AdelaideRMF, homogr, and EVD, covering fundamental matrix and homography estimation.

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

Performance Highlights

  • Accuracy: Across 545 real-world image pairs, MAGSAC achieved the lowest mean geometric error in nearly every category. For instance, on the homogr dataset, MAGSAC reduced error to 1.37 pixels, compared to 2.12 pixels for standard RANSAC.
  • Robustness: In synthetic tests, MAGSAC successfully recovered models at outlier ratios as high as 90%, where traditional methods failed.
  • Post-Processing Benefit: Applying $\sigma$-consensus as a post-processing step reduced errors by approximately 8% across various existing methods with negligible computational overhead.

Conclusion

MAGSAC represents a significant advancement in robust estimation by replacing hard thresholds with a marginalized probability distribution. This "soft boundary" approach naturally handles varying noise levels and extreme outlier ratios. While it still requires a loose upper bound for the noise scale, its performance gains and ease of integration as a post-processing step make it a powerful tool for modern computer vision pipelines.

Summary updated

BibTeX
@inproceedings{barath2019magsac,
  author = {Dániel Baráth and Jiřı́ Matas and Jana Noskova},
  title = {{MAGSAC: Marginalizing Sample Consensus}},
  booktitle = {CVPR},
  year = {2019},
  url = {https://openreview.net/forum?id=rsLDCX7x_Tr},
}
Figure