Fix segment2box dropping polygon vertices on image border (#24655)
This commit is contained in:
parent
ac49087207
commit
510a5f2ebf
@ -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 (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user