Skip to content

Report executed RANSAC trials - #4974

Merged
ahojnnes merged 2 commits into
colmap:mainfrom
aswanth-07:fix/ransac-reported-trial-count
Nov 8, 2026
Merged

ahojnnes merged 2 commits into
colmap:mainfrom
aswanth-07:fix/ransac-reported-trial-count

Conversation

@aswanth-07

Copy link
Copy Markdown
Contributor

RANSAC::Report::num_trials currently includes reservations that fail the trial-budget or abort check before sampling. For example, a one-trial budget reports two iterations with one thread and five with four threads. A zero-trial budget also reports work that never ran. LORANSAC shares the same reporting error.

I count the iterations that pass both checks with an OpenMP reduction. The reservation counter, sampling, stopping conditions and model selection remain unchanged. This also gives accurate trial totals to the existing fundamental-matrix benchmark.

The two regression tests cover zero, one and five trials with one and four threads. All 12 count assertions fail on pristine production; all 12 tests across both native modules pass with the fix, both with OpenMP and with it disabled. A separate 900-call counting matrix confirms that each report equals the actual minimal-estimator calls. All 108 seeded similarity-transform model, mask and support controls match pristine output exactly.

I validated MSVC Release on Windows. Six alternating timing rounds show median changes from -3.4% to +5.8% across the serial paths, including a +4.4 us/call no-OpenMP LORANSAC diagnostic. The per-round timings are noisy; this is a reporting correction without a speed claim. Changed-file formatting, scoped Clang-Tidy and whitespace checks pass. Full application, reconstruction-dataset, GPU and other-platform validation remain unrun.

AI assistance disclosure: AI-assisted development tools were used during investigation and implementation. The reported tests were run against the final diff.

@aswanth-07
aswanth-07 marked this pull request as ready for review November 8, 2026 12:25
Replace the OpenMP reduction counter with an undo of the reservation: if a thread's fetch_add fails the trial-budget or abort check, it decrements trial_counter before breaking, so the counter counts only executed trials. A reused index fails the gate again, since the abort flag is never cleared and a budget failure means max_num_trials was already reached.

Also add a dynamic-stopping test asserting the reported count never exceeds the trial budget.
@ahojnnes ahojnnes added the full-ci Run Windows and remaining pycolmap CI label Nov 8, 2026
@ahojnnes
ahojnnes enabled auto-merge (squash) November 8, 2026 15:04
@ahojnnes
ahojnnes merged commit b5ff5c3 into colmap:main Nov 8, 2026
18 of 21 checks passed
fringehush-gif added a commit to fringehush-gif/colmap that referenced this pull request Nov 8, 2026
Report RANSAC trials that actually passed the budget and abort checks, rather
than reservations that never reached sampling. The upstream correction leaves
sampling, stopping conditions and model-selection logic unchanged.

## Upstream commits

- b5ff5c3 — Report executed RANSAC trials (colmap#4974)

## Validation

- The maintained suites passed all 8 RANSAC and 11 LO-RANSAC tests. Both new
  counter regressions fail with the original fork headers.
- An instrumented estimator matched reported totals to actual calls for budgets
  of 0, 1, 5 and 2,000 with one and four requested threads. A four-thread OpenMP
  team and participation by all four workers were observed.
- Reused nine source/header-matched SDK archive members in private incremental
  test builds. Runtime dependencies resolved; configured clang-tidy 18 and
  clang-format 23 checks passed, with recorded suppressions.
- Local qualification used OpenMP. It did not exercise a separate no-OpenMP
  build or prove a dynamic-abort interleaving occurred.

AI disclosure: Totally vibe coded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Run Windows and remaining pycolmap CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants