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
|
|
@ -640,10 +640,14 @@ class AutoBackend(nn.Module):
|
|||
y = self.model.predict({"image": im_pil}) # coordinates are xywh normalized
|
||||
if "confidence" in y:
|
||||
raise TypeError(
|
||||
"'model={w}' has an NMS pipeline created by an older version of Ultralytics. "
|
||||
"CoreML inference with NMS is only supported for models exported with latest Ultralytics. "
|
||||
"You may export the model again with latest Ultralytics to resolve this."
|
||||
"Ultralytics only supports inference of non-pipelined CoreML models exported with "
|
||||
f"'nms=False', but 'model={w}' has an NMS pipeline created by an 'nms=True' export."
|
||||
)
|
||||
# TODO: CoreML NMS inference handling
|
||||
# from ultralytics.utils.ops import xywh2xyxy
|
||||
# box = xywh2xyxy(y['coordinates'] * [[w, h, w, h]]) # xyxy pixels
|
||||
# conf, cls = y['confidence'].max(1), y['confidence'].argmax(1).astype(np.float32)
|
||||
# y = np.concatenate((box, conf.reshape(-1, 1), cls.reshape(-1, 1)), 1)
|
||||
y = list(y.values())
|
||||
if len(y) == 2 and len(y[1].shape) != 4: # segmentation model
|
||||
y = list(reversed(y)) # reversed for segmentation models (pred, proto)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue