Python Interface
Using YOLO models
This is the simplest way of simply using yolo models in a python environment. It can be imported from the ultralytics
module.
Usage
Export and Deployment
More functionality coming soon
To know more about using YOLO
models, refer Model class Reference
Using Trainers
YOLO
model class is a high-level wrapper on the Trainer classes. Each YOLO task has its own trainer that inherits from BaseTrainer
.
Detection Trainer Example
from ultralytics.yolo import v8 import DetectionTrainer, DetectionValidator, DetectionPredictor
# trainer
trainer = DetectionTrainer(overrides={})
trainer.train()
trained_model = trainer.best
# Validator
val = DetectionValidator(args=...)
val(model=trained_model)
# predictor
pred = DetectionPredictor(overrides={})
pred(source=SOURCE, model=trained_model)
# resume from last weight
overrides["resume"] = trainer.last
trainer = detect.DetectionTrainer(overrides=overrides)
You can easily customize Trainers to support custom tasks or explore R&D ideas.
Learn more about Customizing Trainers
, Validators
and Predictors
to suit your project needs in the Customization Section.