赞
踩
1、train.py文件,把ch=3改为ch=1
2、utils/datasets.py文件下
2.1、cv2.imread(path)改成cv2.imread(path,0),这样子读取的图像就是单通道
在数据加载模块,把三通道改成1通道,transpose函数改为reshape,如下:
2.2、去掉红框里的代码img.shape[2]
3、models/yolo.py下ch=3改为ch=1
2.3、注释掉这行代码(三通道图像的hsv 数据增强)
4、models/common.py下,在框住的代码下,加上如下代码
if im.mode != 'L':
im = im.convert('L')
1、RuntimeError: Given groups=1, weight of size [32, 1, 6, 6], expected input[8, 3, 640, 640] to have 1 channels
解决方法:图像读取,读的是三通道rgb图像,更改imread
2、RuntimeError: Given groups=1, weight of size [32, 3, 6, 6], expected input[8, 1, 640, 640] to have 1 channels
解决方法:在train.py代码里,–cfg上,加入模型配置文件。
3、出现,nonetype has no attribute python_exit_status
解决方法:train.py代码里配置文件,works改为0
4、出现KMP_DUPLICATE_LIB_OK='True’的警告打印文件
解决方法:在代码运行前的位置,添加 os.environ[‘KMP_DUPLICATE_LIB_OK’]=‘True’
pt模型转onnx,只需要在export.py 第457行,改channel为1
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。