Define fallback `model.names` from Predictor (#9439)

pull/9435/head^2
Glenn Jocher 11 months ago committed by GitHub
parent 7ea2007326
commit b530a3004e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      ultralytics/engine/model.py

@ -733,7 +733,10 @@ class Model(nn.Module):
""" """
from ultralytics.nn.autobackend import check_class_names from ultralytics.nn.autobackend import check_class_names
return check_class_names(self.model.names) if hasattr(self.model, "names") else None if hasattr(self.model, "names"):
return check_class_names(self.model.names)
elif self.predictor:
return self.predictor.model.names
@property @property
def device(self) -> torch.device: def device(self) -> torch.device:

Loading…
Cancel
Save