xsponenta Claude Opus 4.7 commited on
Commit
50e27b8
·
1 Parent(s): dec2057

2D gestalt-edge consistency filter: drop edges with no view support

Browse files

For each predicted 3D edge, project both endpoints into every COLMAP view
and walk the 2D segment. Count how many sampled pixels fall on a gestalt
edge-class pixel (eave, ridge, rake, valley, hip, flashing, step_flashing)
after a 4px dilation of the mask. If at least 2 views show >=25% of the
projected segment overlapping the edge mask, keep the edge; otherwise drop
it as a hallucination with no 2D evidence.

Precision-only operation: can drop bad edges but cannot add new geometry,
so it can't repeat the plane_wireframe failure mode of polluting predictions.
Uses the same COLMAP cameras + gestalt masks that triangulation tracks
already rely on (validated machinery).

Conservative thresholds chosen for first-evaluation safety:
- min_views_support=2 (needs 2-view agreement to KEEP, not 1)
- min_pixel_frac=0.25 (a truly hallucinated edge projects to random pixels,
~5-10% mask overlap; a real edge after dilation should be >=80%, so 0.25
is a wide margin from both extremes)
- dilate_px=4 (9px-thick edge tolerance)
- sample_steps=20

Applied after hybrid_merge so both learned edges AND triangulation track
edges are filtered uniformly. Floor: never returns an empty graph.

DIAG output extended with `2dfilt=N->M` so we can see drop rates per
sample in the HF Space logs and tune thresholds based on real data.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

2 files changed +185 -1
Files changed (2)
edge_2d_filter.pyAdded+164
script.py+21-1