Define fallback model.names from Predictor (#9439)
This commit is contained in:
parent
7ea2007326
commit
b530a3004e
1 changed files with 4 additions and 1 deletions
|
|
@ -733,7 +733,10 @@ class Model(nn.Module):
|
|||
"""
|
||||
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
|
||||
def device(self) -> torch.device:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue