Skip to content

PointCloud.segment_plane results vary with a fixed seed when probability < 1.0 #7640

Backlog

Description

@0525gus

Checklist

Describe the issue

Even with o3d.utility.random.seed(0) called before every run, PointCloud.segment_plane returns different planes and inlier lists across runs when probability < 1.0, including the default.

Reproduced on 0.19.0, 0.20.0, and 0.20.0+2ce4f7e. Setting probability=1.0 works around this as suggested in #5647, but disables early stopping and is about 6x slower at 1,000 iterations. #6308 and #6580 fixed the sampling side, but not early termination.

Steps to reproduce the bug

import open3d as o3d

pcd = o3d.io.read_point_cloud(o3d.data.PCDPointCloud().path)


def distinct_results(n_runs=30, **kwargs):
    seen = set()
    for _ in range(n_runs):
        o3d.utility.random.seed(0)
        plane, inliers = pcd.segment_plane(distance_threshold=0.01,
                                           ransac_n=3, **kwargs)
        seen.add((tuple(plane), tuple(inliers)))
    return len(seen)


print("default probability:", distinct_results(num_iterations=1000))
print("probability=1.0    :", distinct_results(num_iterations=1000,
                                               probability=1.0))

Error message

No error. Running the script above three times on 0.20.0+2ce4f7e with 12 threads:

Run default probability probability=1.0
1 3 1
2 4 1
3 2 1

Pinning the process to one logical CPU before importing open3d (e.g., psutil.Process().cpu_affinity([0])) gives 1 distinct result in both cases.

Expected behavior

The same random seed produces the same plane and inlier indices regardless of thread count.

Open3D, Python and System information

  • Operating system: Windows 11 Pro (x64)
  • Python version: 3.12
  • Open3D version: 0.20.0+2ce4f7e (also reproduced on 0.20.0 and 0.19.0)
  • System architecture: x86_64
  • Is this a remote workstation?: no
  • How did you install Open3D?: pip
  • CPU: AMD Ryzen 5 5600 (6 cores / 12 threads)

Additional information

In PointCloud::SegmentPlane, workers stop checking samples once iteration_count > break_iteration. Because iteration_count increments in thread completion order and break_iteration is updated concurrently from whichever best model finishes first, the evaluated sample set depends on scheduling. The existing PointCloud.SegmentPlaneDeterministic test only checks probability=1.0.

Opened #7641 with a fix.

Activity

  1. added
    bug
    on Nov 30, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions