Python>=3.8
PyTorch>=1.8
安装PyTorch 命令获取 ,根据自己的情况选好后复制安装命令
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install ultralytics
cmd 先到需要的目录再 输入命令,它会保存到cmd当前所在目录:
yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'
用法示例
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)
# Use the model
model.train(data="coco128.yaml", epochs=3) # train the model
metrics = model.val() # evaluate model performance on the validation set
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
path = model.export(format="onnx") # export the model to ONNX format
cmd 先到需要的目录再 输入命令,它会保存到cmd当前所在目录:
yolo export model=yolov8n.pt format=torchscript
官网
文档