Revert "Support CoreML NMS export for Segment, Pose and OBB" (#19273)
Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com>
This commit is contained in:
parent
7397aa7079
commit
e981fc629d
6 changed files with 167 additions and 20 deletions
|
|
@ -441,9 +441,12 @@ def xywh2xyxy(x):
|
|||
y (np.ndarray | torch.Tensor): The bounding box coordinates in (x1, y1, x2, y2) format.
|
||||
"""
|
||||
assert x.shape[-1] == 4, f"input shape last dimension expected 4 but input shape is {x.shape}"
|
||||
y = empty_like(x) # faster than clone/copy
|
||||
xy = x[..., :2] # centers
|
||||
wh = x[..., 2:] / 2 # half width-height
|
||||
return (np.concatenate if isinstance(x, np.ndarray) else torch.cat)((xy - wh, xy + wh), -1)
|
||||
y[..., :2] = xy - wh # top left xy
|
||||
y[..., 2:] = xy + wh # bottom right xy
|
||||
return y
|
||||
|
||||
|
||||
def xywhn2xyxy(x, w=640, h=640, padw=0, padh=0):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue