YOLO模型验证.md 1.3 KB

采用命令

yolo predict model=yolov8n.pt source=/path/钢绳/人船.jpg

输出:

Ultralytics YOLOv8.2.48 🚀 Python-3.8.10 torch-1.13.1 CPU (Intel Core(TM) i9-9880H 2.30GHz)
YOLOv8n summary (fused): 168 layers, 3151904 parameters, 0 gradients, 8.7 GFLOPs

image 1/1 /path/钢绳/人船.jpg: 448x640 1 person, 1 boat, 165.1ms
Speed: 8.1ms preprocess, 165.1ms inference, 15.0ms postprocess per image at shape (1, 3, 448, 640)
Results saved to runs/detect/predict3
💡 Learn more at https://docs.ultralytics.com/modes/predict

YOLO 模型导出 ONNX

采用 yolo 导出为 onnx 格式。

yolo export model=yolov8n-cls.pt format=onnx imgsz=224,128
yolo export model=water_strean_model.pt format=onnx \
--iou-thres 0.65 --conf-thres 0.25 --topk 100 --opset 16 \
--sim --input-shape 1 3 640 640

python export-det.py --weights water_strean_model.pt \
--iou-thres 0.65 --conf-thres 0.25 \
--topk 100 --opset 16 --sim --input-shape 1 3 640 640 --device "0"

python export-det.py --weights water_strean_model.pt \
--iou-thres 0.65 --conf-thres 0.25 \
--topk 100 --opset 16 --sim --input-shape 1 3 640 640 --device cpu

注意:

(最新的yolo8改用默认GPU版的onnxruntime,要安装一下下面的库,否则ONNX转换会有警告) pip install onnxruntime-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple