From dbdea249557e75b595f20e92f4a89c9c89fe6fb8 Mon Sep 17 00:00:00 2001 From: Laughing <61612323+Laughing-q@users.noreply.github.com> Date: Sat, 29 Jul 2023 22:37:59 +0800 Subject: [PATCH] `ultralytics 8.0.144` fix SAM `predict()` results (#4027) Co-authored-by: Glenn Jocher --- ultralytics/__init__.py | 2 +- ultralytics/models/sam/model.py | 2 +- ultralytics/models/sam/predict.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index d1648f7..30e238b 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = '8.0.143' +__version__ = '8.0.144' from ultralytics.hub import start from ultralytics.models import RTDETR, SAM, YOLO diff --git a/ultralytics/models/sam/model.py b/ultralytics/models/sam/model.py index b941f7b..44b3268 100644 --- a/ultralytics/models/sam/model.py +++ b/ultralytics/models/sam/model.py @@ -29,7 +29,7 @@ class SAM(Model): overrides = dict(conf=0.25, task='segment', mode='predict', imgsz=1024) kwargs.update(overrides) prompts = dict(bboxes=bboxes, points=points, labels=labels) - super().predict(source, stream, prompts=prompts, **kwargs) + return super().predict(source, stream, prompts=prompts, **kwargs) def __call__(self, source=None, stream=False, bboxes=None, points=None, labels=None, **kwargs): """Calls the 'predict' function with given arguments to perform object detection.""" diff --git a/ultralytics/models/sam/predict.py b/ultralytics/models/sam/predict.py index ebd072a..396b3be 100644 --- a/ultralytics/models/sam/predict.py +++ b/ultralytics/models/sam/predict.py @@ -294,7 +294,7 @@ class Predictor(BasePredictor): def setup_model(self, model, verbose=True): """Set up YOLO model with specified thresholds and device.""" - device = select_device(self.args.device) + device = select_device(self.args.device, verbose=verbose) if model is None: model = build_sam(self.args.model) model.eval()