Fix model names docstring type to dict (#15726)

Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
This commit is contained in:
yuefanhao 2024-08-22 19:11:36 +08:00 committed by GitHub
parent 98a39f594c
commit 5f93df6fca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View file

@ -900,7 +900,7 @@ class Model(nn.Module):
initialized, it sets it up before retrieving the names.
Returns:
(List[str]): A list of class names associated with the model.
(Dict[int, str]): A dict of class names associated with the model.
Raises:
AttributeError: If the model or predictor does not have a 'names' attribute.
@ -908,7 +908,7 @@ class Model(nn.Module):
Examples:
>>> model = YOLO('yolov8n.pt')
>>> print(model.names)
['person', 'bicycle', 'car', ...]
{0: 'person', 1: 'bicycle', 2: 'car', ...}
"""
from ultralytics.nn.autobackend import check_class_names