Skip to content

GC-RANSAC and MAGSAC++ results aren't reproducible: their samplers are seeded from random_device #72

Closed

Description

@f-dy

GC-RANSAC's samplers seed their generator from std::random_device (uniform_random_generator.h L47-L53), and HomLib can't pass a seed. So the GC-RANSAC and MAGSAC++ results differ from run to run:

danini/graph-cut-ransac#51 (not merged) adds a process-wide seed. Until then, HomLib could use a fixed copy of uniform_random_generator.h that takes a seed, as #68 does for GCRANSAC.h: the samplers include it as "uniform_random_generator.h" from samplers/, a different directory, so the copy is found first. The seed would then be a setting of HomLib's GC-RANSAC and MAGSAC++, as it is for LOMSAC.

Activity

  1. marcusvaltonen commented on Nov 9, 2026

    @marcusvaltonen
    Owner

    SupeRANSAC too right?

  2. f-dy commented on Nov 9, 2026

    @f-dy
    ContributorAuthor

    Yes, partly: SupeRANSAC's samplers use a generator with a fixed seed, so they are reproducible, but HomLib's non-minimal step shuffles the inliers with a generator seeded from std::random_device (solver_utils.h), and GC-RANSAC, MAGSAC++ and SupeRANSAC all use it. So SupeRANSAC runs differ too. I'm preparing a PR with a seed setting; SupeRANSAC's settings are its own struct, so for it the seed would go through HomLib's Python wrapper. #73 changes the same lines, so I'll adapt to whichever lands first.

  3. marcusvaltonen commented on Nov 9, 2026

    @marcusvaltonen
    Owner

    Any outstanding issues with #68 and #70 are merged?

  4. f-dy commented on Nov 10, 2026

    @f-dy
    ContributorAuthor

    Yes, this one is still open: #68 and #70 fixed crashes, not reproducibility. GC-RANSAC and MAGSAC++ still seed their samplers from std::random_device, and HomLib's non-minimal step still shuffles with an unseeded generator (which affects SupeRANSAC too). I have a PR in progress that adds a seed setting to the three backends; since it touches the same lines as #73 and #76, I'll post it once those settle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions