[炼丹术]Yolov8训练使用总结
Yolov8训练使用总结
Yolov8训练使用总结
介绍
安装
Install
pip install ultralytics
Development
git clone https://github.com/ultralytics/ultralytics
cd ultralytics
pip install -e .
用法
1.CLI
简单地使用最新的 Ultralytics YOLO 模型。
yolo task=detect mode=train model=yolov8n.yaml args=...
classify predict yolov8n-cls.yaml args=...
segment val yolov8n-seg.yaml args=...
export yolov8n.pt format=onnx
2.Python SDK
使用 Ultralytics YOLO 模型的 pythonic 接口。
from ultralytics import YOLO
model = YOLO("yolov8n.yaml") # create a new model from scratch
model = YOLO(
"yolov8n.pt"
) # load a pretrained model (recommended for best training results)
results = model.train(data="coco128.yaml", epochs=100, imgsz=640, ...)
results = model.val()
results = model.predict(source="bus.jpg")
success = model.export(format="onnx")
如果您希望为研发修改 YOLO 或在其之上构建,请参阅文档中的 Using Trainer 指南
Talk is cheap. Show me the code