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:
1 parent
b0a2d7141d
commit
491d1b60aa
1 file changed
+7
-13
@@ -232,26 +232,20 @@ def find_model(req: FindModelReq) -> dict[str, Any]:
|
|||||||
top = dets[0]
|
top = dets[0]
|
||||||
bbox = _bbox_to_roi(top["bbox"])
|
bbox = _bbox_to_roi(top["bbox"])
|
||||||
|
|
||||||
# 2. SAM21, with depth pre-filter so the segmentation cannot leak onto
|
# 2. SAM21 — full cluster, no plane filtering at all.
|
||||||
# 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.
|
|
||||||
try:
|
try:
|
||||||
seg = segment_with_sam21(nuwa, sam21, bbox, sw,
|
seg = segment_with_sam21(nuwa, sam21, bbox, sw)
|
||||||
pre_filter_plane=get_work_plane())
|
|
||||||
except Sam21Fallback as e:
|
except Sam21Fallback as e:
|
||||||
raise HTTPException(status_code=422, detail=f"SAM21 fail: {e}")
|
raise HTTPException(status_code=422, detail=f"SAM21 fail: {e}")
|
||||||
|
|
||||||
# 3. Partition by plane
|
accepted_m = seg.points_cv_m
|
||||||
with sw.step("partition_plane"):
|
excluded_m = np.empty((0, 3), dtype=np.float64)
|
||||||
accepted_m, excluded_m, plane_info = partition_by_plane(
|
plane_info = {"plane_applied": False,
|
||||||
seg.points_cv_m, get_work_plane()
|
"n_points_before_plane": int(accepted_m.shape[0])}
|
||||||
)
|
|
||||||
if accepted_m.shape[0] < 10:
|
if accepted_m.shape[0] < 10:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=422,
|
status_code=422,
|
||||||
detail=f"too few accepted points after plane filter: {accepted_m.shape[0]}"
|
detail=f"too few SAM21 points: {accepted_m.shape[0]}"
|
||||||
f" (before plane: {plane_info['n_points_before_plane']})"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# 4. Open3DModel pose
|
# 4. Open3DModel pose
|
||||||
|
|||||||
Reference in new issue
Block a user