Update usage for custom Predictor (#16771)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
pull/16751/head
Laughing 2 months ago committed by GitHub
parent 6509757879
commit 67683a87f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      ultralytics/engine/model.py

@ -543,9 +543,7 @@ class Model(nn.Module):
prompts = args.pop("prompts", None) # for SAM-type models prompts = args.pop("prompts", None) # for SAM-type models
if not self.predictor: if not self.predictor:
self.predictor = predictor or self._smart_load("predictor")(overrides=args, _callbacks=self.callbacks) 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.setup_model(model=self.model, verbose=is_cli) self.predictor.setup_model(model=self.model, verbose=is_cli)
else: # only update args if predictor is already setup else: # only update args if predictor is already setup
self.predictor.args = get_cfg(self.predictor.args, args) self.predictor.args = get_cfg(self.predictor.args, args)

Loading…
Cancel
Save