Overview
RansacScoringDoneRight is the scoring package of the paper RANSAC Scoring Done Right: the scale-free marginal score and its sort-and-sweep, Student-t posterior weighting, the threshold-based baselines it is compared against, and CPU/GPU grid evaluators that score a stored hypothesis pool at every value of a hyperparameter grid. It is problem-agnostic: a consumer supplies residuals, or a problem implementing AbstractScoreableProblem.
It sits in a stack of Julia packages:
| package | role |
|---|---|
| VisualGeometryCore | geometric types, Uncertain/whiten, the robust-loss shapes, the shared robust-estimation interfaces, and the benchmark pool record PoolPair |
| RansacScoringDoneRight | scoring: the marginal score, the baselines, posterior weighting, the pool scorers and grid evaluators, the scale-prior vocabulary |
| RobustVisualGeometry | the RANSAC loop, the concrete problems (homography, fundamental and essential matrix, …) and local optimization |
| VisualGeometryEval | pool IO, statistics, tuning artifacts, rendering |
Scoring versus selection
A RANSAC score assigns a value to one model hypothesis from its residuals; selection keeps the hypothesis with the best score. This package does both, at two granularities:
- one hypothesis:
score_residuals!(from residuals) orscore_sq_residuals!(from a problem and a model) returns the score and the inlier count of the best partition; - a pool of hypotheses:
best_pool_modelselects the best stored model of one benchmark pair, andgrid_evaluatedoes so for every pair of a staged pool at every width of a grid, which is what tuning and the paper's evaluation consume.
The scale-free marginal score also selects an inlier partition: the sweep returns the inlier count k it maximized over, and the scale of that partition (posterior_scale) follows in closed form. That partition and scale seed local optimization (RobustVisualGeometry), through the posterior weighting layer (PosteriorWeightState).
The scorers
The scale-free marginal score. For a fixed inlier partition the Gaussian inlier scale is integrated out under a conjugate inverse-gamma prior, leaving a closed form in the residual sum of squares, the inlier count and the outlier half-width a of the uniform outlier component. Sorting the residuals once lets one sweep score every partition, so a hypothesis costs O(N log N). MarginalScoring is the spec, ScoringWorkspace the sweep buffers; JeffreysMarginal and InverseGammaMarginal name the two prior choices. PredictiveMarginalScoring adds the model's estimation covariance to every point's residual covariance; it is an option, not the default (see Conventions).
The threshold-based family. RANSAC, MSAC, MLESAC (the paper's GaU) and MAGSAC++ are singleton types (RansacScoring, MsacScoring, MlesacScoring, MagsacScoring), together with three robust costs (Welsch, smooth TLS, Geman–McClure). They form the LossWidthScoring union: each takes a loss width, and each scores through one per-residual scalar, residual_quality. Every scoring carries its constraint codimension DG, because a loss width means a different multiple of the scale at each codimension.
The mixture's decision boundary. GauInlier is the Gaussian-uniform mixture; decision_threshold and its inverse decision_width are the one map between an outlier half-width and the residual at which the MAP inlier/outlier decision flips, so a grid of outlier half-widths is never confused with a grid of thresholds.
Scale priors
IGPrior(α₀, β₀) is the inverse-gamma prior on σ²; IGPrior() (also spelled JeffreysPrior()) is its α₀ = β₀ = 0 limit, the non-informative Jeffreys prior, which needs no validation data. In the conjugate update the prior acts as 2α₀ pseudo-residuals carrying 2β₀ of pseudo-RSS, so where a pair has many inliers the data dominate and the informative priors approach the Jeffreys limit.
The paper's empirical-Bayes variants fit the prior from per-pair noise-variance estimates on a validation set (PriorSpec, fit_prior):
| variant | prior | fit |
|---|---|---|
| Jeffreys | IGPrior(0, 0) | none (JeffreysPriorSpec) |
| IG-MLE | IG(α₀, β₀) | type-II maximum likelihood: a Gamma fit to 1/σ̂² |
| IG-Robust | IG(1, median(σ̂²)) | fixed α₀ = 1, median-anchored β₀ (IGRobustSpec) |
IG-Robust trades the dispersion information of IG-MLE for robustness to the heavy σ̂² tails of pairs with few inliers, the regime where the prior matters.
Widths and native units
Every scorer has one hyperparameter, a width, and each family's width lives on its own axis: the outlier half-width for the marginal scores, the loss width for the threshold-based family. native_axis names a scorer's axis (VisualGeometryCore's OutlierHalfwidth or LossWidth); to_native maps a scale multiple onto it and native_map is that map curried, so that grids for different families can be laid out over comparable neighbourhoods of the same noise scale. The vocabulary is fixed: loss_width is a loss's scale parameter, outlier_halfwidth the half-width of the uniform outlier support, decision_threshold the residual at which the MAP rule flips, s2 a variance and ŝ/s_hat_sq the scale estimate and its square.
The pool frame
The benchmark pool — VisualGeometryCore's PoolPair record together with its num_points × num_models Float32 residual matrix — stores correspondences, models and residuals in NormalizedImageFrame: the image centre at the origin, scaled by half the image diagonal so the corners lie at unit radius. It is the one declared exception to the stack's rule that a public function returns results in the frame its inputs came in. Every width applied to pool data (outlier half-width, loss width, IG prior, every grid_evaluate grid) is in that frame's unit, and pixel_residuals is the one exit to pixels. Conventions states the rule and what it demands of this package.
Where the paper's experiments live
This repository holds the package and two follow-up scoring studies (Experiments). It does not contain the drivers that produced the paper's Profile and Sensitivity figures. The bootstrap evaluation harness that once lived in this package moved to the evaluation layer (RobustVisualGeometryEval, now VisualGeometryEval), and a reproduction package for the paper is not part of this release.