Fix segment2box dropping polygon vertices on image border (#24655)

This commit is contained in:
Murat Raimbekov 2026-06-01 21:36:42 +06:00 committed by GitHub
parent ac49087207
commit 510a5f2ebf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,7 +89,7 @@ def segment2box(segment: np.ndarray, width: int = 640, height: int = 640) -> np.
if np.array([x.min() < 0, y.min() < 0, x.max() > width, y.max() > height]).sum() >= 3:
x = x.clip(0, width)
y = y.clip(0, height)
inside = (x > 0) & (y > 0) & (x < width) & (y < height)
inside = (x >= 0) & (y >= 0) & (x <= width) & (y <= height)
x = x[inside]
y = y[inside]
return (