Yooooooo🎇
- 🥪环境搭建
- ⚡注意
- 💡CUDA
- PyTorch
- 💡ultralytics
- 🦪食用
- 💡cmd
- 💡Python
- 🍲导出官方模型到本地
🥪环境搭建
⚡注意
Python>=3.8
PyTorch>=1.8
💡CUDA
下载CUDA最新版本👈
PyTorch
安装PyTorch 命令获取 👈,根据自己的情况选好后复制安装命令
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
💡ultralytics
pip install ultralytics
🦪食用
💡cmd
cmd 先到需要的目录再 输入命令,它会保存到cmd当前所在目录:
yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'
预测结果存放在:\runs\detect\predict
💡Python
用法示例
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
官网👈
文档