Update docs (#71)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Ayush Chaurasia 2022-12-12 09:21:00 +05:30 committed by GitHub
parent e629335f6d
commit d85b44f259
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 286 additions and 35 deletions

View file

@ -1,11 +1,70 @@
# Python SDK
## 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.
We provide 2 pythonic interfaces for YOLO models:
!!! example "Usage"
=== "Training"
```python
from ultralytics import YOLO
<b> Model Interface </b> - To simply build, load, train or run inference on a model in a python application
model = YOLO()
model.new("n.yaml") # pass any model type
model.train(data="coco128.yaml", epochs=5)
```
<b> Trainer Interface </b> - To customize trainier elements depending on the task. Suitable for R&D ideas like architecutres.
=== "Training pretrained"
```python
from ultralytics import YOLO
______________________________________________________________________
model = YOLO()
model.load("n.pt") # pass any model type
model(...) # inference
model.train(data="coco128.yaml", epochs=5)
```
### Model Interface
=== "Resume Training"
```python
from ultralytics import YOLO
model = YOLO()
model.resume(task="detect") # resume last detection training
model.resume(task="detect", model="last.pt") # resume from a given model
```
More functionality coming soon
To know more about using `YOLO` models, refer Model class refernce
[Model reference](#){ .md-button .md-button--primary}
---
### Customizing Tasks with Trainers
`YOLO` model class is a high-level wrapper on the Trainer classes. Each YOLO task has its own trainer that inherits from `BaseTrainer`.
You can easily cusotmize Trainers to support custom tasks or explore R&D ideas.
!!! tip "Trainer Examples"
=== "DetectionTrainer"
```python
from ultralytics import yolo
trainer = yolo.DetectionTrainer(data=..., epochs=1) # override default configs
trainer.train()
```
=== "SegmentationTrainer"
```python
from ultralytics import yolo
trainer = yolo.SegmentationTrainer(data=..., epochs=1) # override default configs
trainer.train()
```
=== "ClassificationTrainer"
```python
from ultralytics import yolo
trainer = yolo.ClassificationTrainer(data=..., epochs=1) # override default configs
trainer.train()
```
Learn more about Customizing `Trainers`, `Validators` and `Predictors` to suit your project needs in the Customization Section. More details about the base engine classes is available in the reference section.
[Customization tutorials](#){ .md-button .md-button--primary}