revert(find_model): drop plane filter — pass full SAM21 cluster to Open3DModel

The pre-SAM21 depth filter and post-SAM21 partition_by_plane were
fighting each other and drowning the actual object cluster. Per
operator request, send Open3DModel the raw SAM21 cluster and let
RANSAC handle outliers itself. The accepted/excluded/SAM21 overlays
in the GUI continue to work; excluded is now always empty and
accepted == SAM21 cluster.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adriano Dal PastroandClaude Opus 4.7 committed 2026-05-13 11:59:15 +02:00
1 parent b0a2d7141d
commit 491d1b60aa
1 file changed
+7 -13
+7 -13
View File
@@ -232,26 +232,20 @@ def find_model(req: FindModelReq) -> dict[str, Any]:
top = dets[0]
bbox = _bbox_to_roi(top["bbox"])
# 2. SAM21, with depth pre-filter so the segmentation cannot leak onto
# the table around the object: pixels whose back-projection sits below
# the plane have their depth zeroed BEFORE SAM21 sees them, so they
# never end up in the cloud regardless of the mask outline.
# 2. SAM21 — full cluster, no plane filtering at all.
try:
seg = segment_with_sam21(nuwa, sam21, bbox, sw,
pre_filter_plane=get_work_plane())
seg = segment_with_sam21(nuwa, sam21, bbox, sw)
except Sam21Fallback as e:
raise HTTPException(status_code=422, detail=f"SAM21 fail: {e}")
# 3. Partition by plane
with sw.step("partition_plane"):
accepted_m, excluded_m, plane_info = partition_by_plane(
seg.points_cv_m, get_work_plane()
)
accepted_m = seg.points_cv_m
excluded_m = np.empty((0, 3), dtype=np.float64)
plane_info = {"plane_applied": False,
"n_points_before_plane": int(accepted_m.shape[0])}
if accepted_m.shape[0] < 10:
raise HTTPException(
status_code=422,
detail=f"too few accepted points after plane filter: {accepted_m.shape[0]}"
f" (before plane: {plane_info['n_points_before_plane']})"
detail=f"too few SAM21 points: {accepted_m.shape[0]}"
)
# 4. Open3DModel pose