From a6303020e6e4097fdcd425a5c0bf01a9fdd1c707 Mon Sep 17 00:00:00 2001 From: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com> Date: Mon, 13 Jan 2025 20:15:33 +0800 Subject: [PATCH] `ultralytics 8.3.60` Fix CoreML Segment inference (#18649) Signed-off-by: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com> Signed-off-by: Glenn Jocher Co-authored-by: Glenn Jocher --- ultralytics/__init__.py | 2 +- ultralytics/nn/autobackend.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index ec8851ed..d96c5e83 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = "8.3.59" +__version__ = "8.3.60" import os diff --git a/ultralytics/nn/autobackend.py b/ultralytics/nn/autobackend.py index 70962e8e..a89c8cfa 100644 --- a/ultralytics/nn/autobackend.py +++ b/ultralytics/nn/autobackend.py @@ -617,10 +617,9 @@ class AutoBackend(nn.Module): # 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) - elif len(y) == 1: # classification model - y = list(y.values()) - elif len(y) == 2: # segmentation model - y = list(reversed(y.values())) # reversed for segmentation models (pred, proto) + 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) # PaddlePaddle elif self.paddle: