cotton_color/DPL/README.md
ZhenyeLi c4470adb3d 重命名YOLO为DPL
将yolo模块重命名为DPL模块
2024-11-14 18:11:57 +08:00

2.1 KiB
Raw Blame History

YOLO调试记录

data文件夹 yaml文件配置

该文件夹中配置的是数据集的路径及类别信息

path: ../datasets/dimo4
train: D:\yolov5-master\datasets\dimo4\images\train
val: D:\yolov5-master\datasets\dimo4\images\val
test: # test images (optional)
# Classes
names:
  0: dimo

模型导出

命令行形式

python export.py --weights runs/train/exp4/weights/best.pt --img 640 --batch 1 --device 0 --include onnx --opset 15       

通过export.py导出的文件格式为onnx

weights地址: runs/train/exp4/weights/xxx.pt best.pt为train.py训练后所得模型

在detect.py中batch为1batch在detect中不能更改,所以在导出onnx模型文件时要设置batch 1 batch在detect中不能更改

image-20241113133535978

1

PyCharm配置

export.py
--weights
runs/train/exp4/weights/best.pt
--img
640
--device0
--include
onnx
--opset
15

image-20241113182234260

模型加载

命令行形式

python detect.py --weights runs\train\exp4\weights\best.onnx --data D:\yolov5- master\data\dimo4.yaml

image-20241113133825646

image-20241113133840896

image-20241113133850391

PyCharm配置

--weights
runs\train\exp4\weights\best.onnx
--data
D:\yolov5-master\data\dimo4.yaml

image-20241113182433935

在detect.py中

输入的模型为在train.py中训练好的模型 :地址: runs/train/exp4/weights/xxx.pt

或者 runs/train/exp4/weights/xxx.onnx

image-20241113133825646

image-20241113133840896

image-20241113133850391