From 67683a87f11d97ae2f0fb706e223d2b6bdc07aff Mon Sep 17 00:00:00 2001 From: Laughing <61612323+Laughing-q@users.noreply.github.com> Date: Wed, 9 Oct 2024 02:57:47 +0800 Subject: [PATCH] Update usage for custom Predictor (#16771) Co-authored-by: UltralyticsAssistant --- ultralytics/engine/model.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ultralytics/engine/model.py b/ultralytics/engine/model.py index 43b7ccfae3..4f8209c6bc 100644 --- a/ultralytics/engine/model.py +++ b/ultralytics/engine/model.py @@ -543,9 +543,7 @@ class Model(nn.Module): prompts = args.pop("prompts", None) # for SAM-type models if not self.predictor: - self.predictor = predictor or self._smart_load("predictor")(overrides=args, _callbacks=self.callbacks) - if predictor: - self.predictor.args = get_cfg(self.predictor.args, args) + self.predictor = (predictor or self._smart_load("predictor"))(overrides=args, _callbacks=self.callbacks) self.predictor.setup_model(model=self.model, verbose=is_cli) else: # only update args if predictor is already setup self.predictor.args = get_cfg(self.predictor.args, args)