Reformat Markdown code blocks (#12795)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
2af71d15a6
commit
fceea033ad
128 changed files with 1067 additions and 1018 deletions
|
|
@ -56,12 +56,12 @@ Train YOLOv8n-cls on the MNIST160 dataset for 100 epochs at image size 64. For a
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-cls.yaml') # build a new model from YAML
|
||||
model = YOLO('yolov8n-cls.pt') # load a pretrained model (recommended for training)
|
||||
model = YOLO('yolov8n-cls.yaml').load('yolov8n-cls.pt') # build from YAML and transfer weights
|
||||
model = YOLO("yolov8n-cls.yaml") # build a new model from YAML
|
||||
model = YOLO("yolov8n-cls.pt") # load a pretrained model (recommended for training)
|
||||
model = YOLO("yolov8n-cls.yaml").load("yolov8n-cls.pt") # build from YAML and transfer weights
|
||||
|
||||
# Train the model
|
||||
results = model.train(data='mnist160', epochs=100, imgsz=64)
|
||||
results = model.train(data="mnist160", epochs=100, imgsz=64)
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
|
@ -93,13 +93,13 @@ Validate trained YOLOv8n-cls model accuracy on the MNIST160 dataset. No argument
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-cls.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
model = YOLO("yolov8n-cls.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom model
|
||||
|
||||
# Validate the model
|
||||
metrics = model.val() # no arguments needed, dataset and settings remembered
|
||||
metrics.top1 # top1 accuracy
|
||||
metrics.top5 # top5 accuracy
|
||||
metrics.top1 # top1 accuracy
|
||||
metrics.top5 # top5 accuracy
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -120,11 +120,11 @@ Use a trained YOLOv8n-cls model to run predictions on images.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-cls.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
model = YOLO("yolov8n-cls.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom model
|
||||
|
||||
# Predict with the model
|
||||
results = model('https://ultralytics.com/images/bus.jpg') # predict on an image
|
||||
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -147,11 +147,11 @@ Export a YOLOv8n-cls model to a different format like ONNX, CoreML, etc.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-cls.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom trained model
|
||||
model = YOLO("yolov8n-cls.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom trained model
|
||||
|
||||
# Export the model
|
||||
model.export(format='onnx')
|
||||
model.export(format="onnx")
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ Train YOLOv8n on the COCO8 dataset for 100 epochs at image size 640. For a full
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n.yaml') # build a new model from YAML
|
||||
model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training)
|
||||
model = YOLO('yolov8n.yaml').load('yolov8n.pt') # build from YAML and transfer weights
|
||||
model = YOLO("yolov8n.yaml") # build a new model from YAML
|
||||
model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
|
||||
model = YOLO("yolov8n.yaml").load("yolov8n.pt") # build from YAML and transfer weights
|
||||
|
||||
# Train the model
|
||||
results = model.train(data='coco8.yaml', epochs=100, imgsz=640)
|
||||
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -92,15 +92,15 @@ Validate trained YOLOv8n model accuracy on the COCO8 dataset. No argument need t
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
model = YOLO("yolov8n.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom model
|
||||
|
||||
# Validate the model
|
||||
metrics = model.val() # no arguments needed, dataset and settings remembered
|
||||
metrics.box.map # map50-95
|
||||
metrics.box.map # map50-95
|
||||
metrics.box.map50 # map50
|
||||
metrics.box.map75 # map75
|
||||
metrics.box.maps # a list contains map50-95 of each category
|
||||
metrics.box.maps # a list contains map50-95 of each category
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -121,11 +121,11 @@ Use a trained YOLOv8n model to run predictions on images.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
model = YOLO("yolov8n.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom model
|
||||
|
||||
# Predict with the model
|
||||
results = model('https://ultralytics.com/images/bus.jpg') # predict on an image
|
||||
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -148,11 +148,11 @@ Export a YOLOv8n model to a different format like ONNX, CoreML, etc.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom trained model
|
||||
model = YOLO("yolov8n.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom trained model
|
||||
|
||||
# Export the model
|
||||
model.export(format='onnx')
|
||||
model.export(format="onnx")
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
|
|||
|
|
@ -76,12 +76,12 @@ Train YOLOv8n-obb on the `dota8.yaml` dataset for 100 epochs at image size 640.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-obb.yaml') # build a new model from YAML
|
||||
model = YOLO('yolov8n-obb.pt') # load a pretrained model (recommended for training)
|
||||
model = YOLO('yolov8n-obb.yaml').load('yolov8n.pt') # build from YAML and transfer weights
|
||||
model = YOLO("yolov8n-obb.yaml") # build a new model from YAML
|
||||
model = YOLO("yolov8n-obb.pt") # load a pretrained model (recommended for training)
|
||||
model = YOLO("yolov8n-obb.yaml").load("yolov8n.pt") # build from YAML and transfer weights
|
||||
|
||||
# Train the model
|
||||
results = model.train(data='dota8.yaml', epochs=100, imgsz=640)
|
||||
results = model.train(data="dota8.yaml", epochs=100, imgsz=640)
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -113,15 +113,15 @@ retains its training `data` and arguments as model attributes.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-obb.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
model = YOLO("yolov8n-obb.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom model
|
||||
|
||||
# Validate the model
|
||||
metrics = model.val(data='dota8.yaml') # no arguments needed, dataset and settings remembered
|
||||
metrics.box.map # map50-95(B)
|
||||
metrics = model.val(data="dota8.yaml") # no arguments needed, dataset and settings remembered
|
||||
metrics.box.map # map50-95(B)
|
||||
metrics.box.map50 # map50(B)
|
||||
metrics.box.map75 # map75(B)
|
||||
metrics.box.maps # a list contains map50-95(B) of each category
|
||||
metrics.box.maps # a list contains map50-95(B) of each category
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -142,11 +142,11 @@ Use a trained YOLOv8n-obb model to run predictions on images.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-obb.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
model = YOLO("yolov8n-obb.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom model
|
||||
|
||||
# Predict with the model
|
||||
results = model('https://ultralytics.com/images/bus.jpg') # predict on an image
|
||||
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -169,11 +169,11 @@ Export a YOLOv8n-obb model to a different format like ONNX, CoreML, etc.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-obb.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom trained model
|
||||
model = YOLO("yolov8n-obb.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom trained model
|
||||
|
||||
# Export the model
|
||||
model.export(format='onnx')
|
||||
model.export(format="onnx")
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@ Train a YOLOv8-pose model on the COCO128-pose dataset.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-pose.yaml') # build a new model from YAML
|
||||
model = YOLO('yolov8n-pose.pt') # load a pretrained model (recommended for training)
|
||||
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
|
||||
model = YOLO("yolov8n-pose.yaml") # build a new model from YAML
|
||||
model = YOLO("yolov8n-pose.pt") # load a pretrained model (recommended for training)
|
||||
model = YOLO("yolov8n-pose.yaml").load("yolov8n-pose.pt") # build from YAML and transfer weights
|
||||
|
||||
# Train the model
|
||||
results = model.train(data='coco8-pose.yaml', epochs=100, imgsz=640)
|
||||
results = model.train(data="coco8-pose.yaml", epochs=100, imgsz=640)
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
|
@ -107,15 +107,15 @@ retains its training `data` and arguments as model attributes.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-pose.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
model = YOLO("yolov8n-pose.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom model
|
||||
|
||||
# Validate the model
|
||||
metrics = model.val() # no arguments needed, dataset and settings remembered
|
||||
metrics.box.map # map50-95
|
||||
metrics.box.map # map50-95
|
||||
metrics.box.map50 # map50
|
||||
metrics.box.map75 # map75
|
||||
metrics.box.maps # a list contains map50-95 of each category
|
||||
metrics.box.maps # a list contains map50-95 of each category
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -136,11 +136,11 @@ Use a trained YOLOv8n-pose model to run predictions on images.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-pose.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
model = YOLO("yolov8n-pose.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom model
|
||||
|
||||
# Predict with the model
|
||||
results = model('https://ultralytics.com/images/bus.jpg') # predict on an image
|
||||
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -163,11 +163,11 @@ Export a YOLOv8n Pose model to a different format like ONNX, CoreML, etc.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-pose.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom trained model
|
||||
model = YOLO("yolov8n-pose.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom trained model
|
||||
|
||||
# Export the model
|
||||
model.export(format='onnx')
|
||||
model.export(format="onnx")
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ Train YOLOv8n-seg on the COCO128-seg dataset for 100 epochs at image size 640. F
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-seg.yaml') # build a new model from YAML
|
||||
model = YOLO('yolov8n-seg.pt') # load a pretrained model (recommended for training)
|
||||
model = YOLO('yolov8n-seg.yaml').load('yolov8n.pt') # build from YAML and transfer weights
|
||||
model = YOLO("yolov8n-seg.yaml") # build a new model from YAML
|
||||
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
|
||||
model = YOLO("yolov8n-seg.yaml").load("yolov8n.pt") # build from YAML and transfer weights
|
||||
|
||||
# Train the model
|
||||
results = model.train(data='coco8-seg.yaml', epochs=100, imgsz=640)
|
||||
results = model.train(data="coco8-seg.yaml", epochs=100, imgsz=640)
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -93,19 +93,19 @@ retains its training `data` and arguments as model attributes.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-seg.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
model = YOLO("yolov8n-seg.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom model
|
||||
|
||||
# Validate the model
|
||||
metrics = model.val() # no arguments needed, dataset and settings remembered
|
||||
metrics.box.map # map50-95(B)
|
||||
metrics.box.map # map50-95(B)
|
||||
metrics.box.map50 # map50(B)
|
||||
metrics.box.map75 # map75(B)
|
||||
metrics.box.maps # a list contains map50-95(B) of each category
|
||||
metrics.seg.map # map50-95(M)
|
||||
metrics.box.maps # a list contains map50-95(B) of each category
|
||||
metrics.seg.map # map50-95(M)
|
||||
metrics.seg.map50 # map50(M)
|
||||
metrics.seg.map75 # map75(M)
|
||||
metrics.seg.maps # a list contains map50-95(M) of each category
|
||||
metrics.seg.maps # a list contains map50-95(M) of each category
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -126,11 +126,11 @@ Use a trained YOLOv8n-seg model to run predictions on images.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-seg.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
model = YOLO("yolov8n-seg.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom model
|
||||
|
||||
# Predict with the model
|
||||
results = model('https://ultralytics.com/images/bus.jpg') # predict on an image
|
||||
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
@ -153,11 +153,11 @@ Export a YOLOv8n-seg model to a different format like ONNX, CoreML, etc.
|
|||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n-seg.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom trained model
|
||||
model = YOLO("yolov8n-seg.pt") # load an official model
|
||||
model = YOLO("path/to/best.pt") # load a custom trained model
|
||||
|
||||
# Export the model
|
||||
model.export(format='onnx')
|
||||
model.export(format="onnx")
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue