[Docs]: Add customization tutorial and address feedback (#155)
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
c985eaba0d
commit
d387359f74
8 changed files with 133 additions and 74 deletions
|
|
@ -30,7 +30,7 @@ class YOLO:
|
|||
|
||||
def __init__(self, model='yolov8n.yaml', type="v8") -> None:
|
||||
"""
|
||||
Initializes the YOLO object.
|
||||
> Initializes the YOLO object.
|
||||
|
||||
Args:
|
||||
model (str, Path): model to load or create
|
||||
|
|
@ -57,7 +57,7 @@ class YOLO:
|
|||
|
||||
def _new(self, cfg: str, verbose=True):
|
||||
"""
|
||||
Initializes a new model and infers the task type from the model definitions.
|
||||
> Initializes a new model and infers the task type from the model definitions.
|
||||
|
||||
Args:
|
||||
cfg (str): model configuration file
|
||||
|
|
@ -73,7 +73,7 @@ class YOLO:
|
|||
|
||||
def _load(self, weights: str):
|
||||
"""
|
||||
Initializes a new model and infers the task type from the model head
|
||||
> Initializes a new model and infers the task type from the model head.
|
||||
|
||||
Args:
|
||||
weights (str): model checkpoint to be loaded
|
||||
|
|
@ -88,7 +88,7 @@ class YOLO:
|
|||
|
||||
def reset(self):
|
||||
"""
|
||||
Resets the model modules .
|
||||
> Resets the model modules.
|
||||
"""
|
||||
for m in self.model.modules():
|
||||
if hasattr(m, 'reset_parameters'):
|
||||
|
|
@ -98,7 +98,7 @@ class YOLO:
|
|||
|
||||
def info(self, verbose=False):
|
||||
"""
|
||||
Logs model info
|
||||
> Logs model info.
|
||||
|
||||
Args:
|
||||
verbose (bool): Controls verbosity.
|
||||
|
|
@ -129,7 +129,7 @@ class YOLO:
|
|||
@smart_inference_mode()
|
||||
def val(self, data=None, **kwargs):
|
||||
"""
|
||||
Validate a model on a given dataset
|
||||
> Validate a model on a given dataset .
|
||||
|
||||
Args:
|
||||
data (str): The dataset to validate on. Accepts all formats accepted by yolo
|
||||
|
|
@ -148,7 +148,7 @@ class YOLO:
|
|||
@smart_inference_mode()
|
||||
def export(self, **kwargs):
|
||||
"""
|
||||
Export model.
|
||||
> Export model.
|
||||
|
||||
Args:
|
||||
**kwargs : Any other args accepted by the predictors. To see all args check 'configuration' section in docs
|
||||
|
|
@ -164,7 +164,7 @@ class YOLO:
|
|||
|
||||
def train(self, **kwargs):
|
||||
"""
|
||||
Trains the model on given dataset.
|
||||
> Trains the model on a given dataset.
|
||||
|
||||
Args:
|
||||
**kwargs (Any): Any number of arguments representing the training configuration. List of all args can be found in 'config' section.
|
||||
|
|
@ -189,6 +189,12 @@ class YOLO:
|
|||
self.trainer.train()
|
||||
|
||||
def to(self, device):
|
||||
"""
|
||||
> Sends the model to the given device.
|
||||
|
||||
Args:
|
||||
device (str): device
|
||||
"""
|
||||
self.model.to(device)
|
||||
|
||||
def _guess_ops_from_task(self, task):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue