Docstrings arguments cleanup (#3229)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocher
2023-06-17 16:17:07 +02:00
committed by GitHub
parent 62916b3b0a
commit bd0f7ecf6f
93 changed files with 1104 additions and 1102 deletions

View File

@ -54,8 +54,8 @@ class AutoBackend(nn.Module):
Args:
weights (str): The path to the weights file. Default: 'yolov8n.pt'
device (torch.device): The device to run the model on.
dnn (bool): Use OpenCV's DNN module for inference if True, defaults to False.
data (str), (Path): Additional data.yaml file for class names, optional
dnn (bool): Use OpenCV DNN module for inference if True, defaults to False.
data (str | Path | optional): Additional data.yaml file for class names.
fp16 (bool): If True, use half precision. Default: False
fuse (bool): Whether to fuse the model or not. Default: True
verbose (bool): Whether to run in verbose mode or not. Default: True

View File

@ -124,7 +124,8 @@ class AutoShape(nn.Module):
class Detections:
# YOLOv8 detections class for inference results
""" YOLOv8 detections class for inference results"""
def __init__(self, ims, pred, files, times=(0, 0, 0), names=None, shape=None):
"""Initialize object attributes for YOLO detection results."""
super().__init__()

View File

@ -190,7 +190,7 @@ class BaseModel(nn.Module):
"""Load the weights into the model.
Args:
weights (dict) or (torch.nn.Module): The pre-trained weights to be loaded.
weights (dict | torch.nn.Module): The pre-trained weights to be loaded.
verbose (bool, optional): Whether to log the transfer progress. Defaults to True.
"""
model = weights['model'] if isinstance(weights, dict) else weights # torchvision models are not dicts
@ -701,7 +701,7 @@ def guess_model_scale(model_path):
which is denoted by n, s, m, l, or x. The function returns the size character of the model scale as a string.
Args:
model_path (str) or (Path): The path to the YOLO model's YAML file.
model_path (str | Path): The path to the YOLO model's YAML file.
Returns:
(str): The size character of the model's scale, which can be n, s, m, l, or x.
@ -717,7 +717,7 @@ def guess_model_task(model):
Guess the task of a PyTorch model from its architecture or configuration.
Args:
model (nn.Module) or (dict): PyTorch model or model configuration in YAML format.
model (nn.Module | dict): PyTorch model or model configuration in YAML format.
Returns:
(str): Task of the model ('detect', 'segment', 'classify', 'pose').