ultralytics 8.0.54
TFLite export improvements and fixes (#1447)
Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -26,11 +26,11 @@ see the [Configuration](../usage/cfg.md) page.
|
||||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO("yolov8n-cls.yaml") # build a new model from scratch
|
||||
model = YOLO("yolov8n-cls.pt") # load a pretrained model (recommended for training)
|
||||
model = YOLO('yolov8n-cls.yaml') # build a new model from scratch
|
||||
model = YOLO('yolov8n-cls.pt') # load a pretrained model (recommended for training)
|
||||
|
||||
# Train the model
|
||||
model.train(data="mnist160", epochs=100, imgsz=64)
|
||||
model.train(data='mnist160', epochs=100, imgsz=64)
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
@ -51,8 +51,8 @@ it's training `data` and arguments as model attributes.
|
||||
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
|
||||
@ -78,17 +78,17 @@ 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"
|
||||
|
||||
```bash
|
||||
yolo classify predict model=yolov8n-cls.pt source="https://ultralytics.com/images/bus.jpg" # predict with official model
|
||||
yolo classify predict model=path/to/best.pt source="https://ultralytics.com/images/bus.jpg" # predict with custom model
|
||||
yolo classify predict model=yolov8n-cls.pt source='https://ultralytics.com/images/bus.jpg' # predict with official model
|
||||
yolo classify predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model
|
||||
```
|
||||
|
||||
Read more details of `predict` in our [Predict](https://docs.ultralytics.com/modes/predict/) page.
|
||||
@ -105,11 +105,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 = YOLO('yolov8n-cls.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom trained
|
||||
|
||||
# Export the model
|
||||
model.export(format="onnx")
|
||||
model.export(format='onnx')
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
@ -26,11 +26,11 @@ the [Configuration](../usage/cfg.md) page.
|
||||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO("yolov8n.yaml") # build a new model from scratch
|
||||
model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
|
||||
model = YOLO('yolov8n.yaml') # build a new model from scratch
|
||||
model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training)
|
||||
|
||||
# Train the model
|
||||
model.train(data="coco128.yaml", epochs=100, imgsz=640)
|
||||
model.train(data='coco128.yaml', epochs=100, imgsz=640)
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
@ -51,8 +51,8 @@ training `data` and arguments as model attributes.
|
||||
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
|
||||
@ -80,17 +80,17 @@ 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"
|
||||
|
||||
```bash
|
||||
yolo detect predict model=yolov8n.pt source="https://ultralytics.com/images/bus.jpg" # predict with official model
|
||||
yolo detect predict model=path/to/best.pt source="https://ultralytics.com/images/bus.jpg" # predict with custom model
|
||||
yolo detect predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg' # predict with official model
|
||||
yolo detect predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model
|
||||
```
|
||||
|
||||
Read more details of `predict` in our [Predict](https://docs.ultralytics.com/modes/predict/) page.
|
||||
@ -107,11 +107,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 = YOLO('yolov8n.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom trained
|
||||
|
||||
# Export the model
|
||||
model.export(format="onnx")
|
||||
model.export(format='onnx')
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
@ -28,11 +28,11 @@ train an OpenPose model on a custom dataset, see the OpenPose Training page.
|
||||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO("yolov8n.yaml") # build a new model from scratch
|
||||
model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
|
||||
model = YOLO('yolov8n.yaml') # build a new model from scratch
|
||||
model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training)
|
||||
|
||||
# Train the model
|
||||
model.train(data="coco128.yaml", epochs=100, imgsz=640)
|
||||
model.train(data='coco128.yaml', epochs=100, imgsz=640)
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
@ -53,8 +53,8 @@ training `data` and arguments as model attributes.
|
||||
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
|
||||
@ -82,17 +82,17 @@ 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"
|
||||
|
||||
```bash
|
||||
yolo detect predict model=yolov8n.pt source="https://ultralytics.com/images/bus.jpg" # predict with official model
|
||||
yolo detect predict model=path/to/best.pt source="https://ultralytics.com/images/bus.jpg" # predict with custom model
|
||||
yolo detect predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg' # predict with official model
|
||||
yolo detect predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model
|
||||
```
|
||||
|
||||
Read more details of `predict` in our [Predict](https://docs.ultralytics.com/modes/predict/) page.
|
||||
@ -109,11 +109,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 = YOLO('yolov8n.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom trained
|
||||
|
||||
# Export the model
|
||||
model.export(format="onnx")
|
||||
model.export(format='onnx')
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
@ -26,11 +26,11 @@ arguments see the [Configuration](../usage/cfg.md) page.
|
||||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO("yolov8n-seg.yaml") # build a new model from scratch
|
||||
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
|
||||
model = YOLO('yolov8n-seg.yaml') # build a new model from scratch
|
||||
model = YOLO('yolov8n-seg.pt') # load a pretrained model (recommended for training)
|
||||
|
||||
# Train the model
|
||||
model.train(data="coco128-seg.yaml", epochs=100, imgsz=640)
|
||||
model.train(data='coco128-seg.yaml', epochs=100, imgsz=640)
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
@ -51,8 +51,8 @@ retains it's 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
|
||||
@ -84,17 +84,17 @@ 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"
|
||||
|
||||
```bash
|
||||
yolo segment predict model=yolov8n-seg.pt source="https://ultralytics.com/images/bus.jpg" # predict with official model
|
||||
yolo segment predict model=path/to/best.pt source="https://ultralytics.com/images/bus.jpg" # predict with custom model
|
||||
yolo segment predict model=yolov8n-seg.pt source='https://ultralytics.com/images/bus.jpg' # predict with official model
|
||||
yolo segment predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model
|
||||
```
|
||||
|
||||
Read more details of `predict` in our [Predict](https://docs.ultralytics.com/modes/predict/) page.
|
||||
@ -111,11 +111,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 = YOLO('yolov8n-seg.pt') # load an official model
|
||||
model = YOLO('path/to/best.pt') # load a custom trained
|
||||
|
||||
# Export the model
|
||||
model.export(format="onnx")
|
||||
model.export(format='onnx')
|
||||
```
|
||||
=== "CLI"
|
||||
|
||||
|
Reference in New Issue
Block a user