Open Zigars opened 3 years ago
Traceback (most recent call last): File "d:/Users/ZHT/PycharmProjects/yolov5_瓷砖瑕疵检测/convert_utils/make_slice_voc.py", line 211, in slice_im(image_path, ann_path, out_name, outdir, sliceHeight=640, sliceWidth=640) File "d:/Users/ZHT/PycharmProjects/yolov5_瓷砖瑕疵检测/convert_utils/make_slice_voc.py", line 195, in slice_im make_slice_voc(outpath,exiset_obj_list,sliceHeight,sliceWidth) File "d:/Users/ZHT/PycharmProjects/yolov5_瓷砖瑕疵检测/convert_utils/make_slice_voc.py", line 86, in make_slice_voc with codecs.open(os.path.join(slice_voc_dir, name[:-4] + '.xml'), 'w', 'utf-8') as xml: File "D:\Users\ZHT\anaconda3\envs\pytorch\lib\codecs.py", line 905, in open file = builtins.open(filename, mode, buffering) FileNotFoundError: [Errno 2] No such file or directory: './slice/annotations_demo\JPEGImages_demo\qyl|1024_5120_640_640_0_8192_6000.xml'
你是不是把use_demo=False设置为True了?这个demo只是为了测试一下程序是否正确,应该使用False才对,同时212行:raw_images_dir='./yolov5/voc/JPEGImages'#这里的JPEGImages就是原始的图片,建议建立一个原始图片的软连接到这里(或把所有图片复制到voc/JPEGImages下面)
我也遇到了这种情况,遵循上面两种方法,还是出现了同样的错误
大佬,同问,我也遇到了相同的情况,FileNotFoundError: [Errno 2] No such file or directory:'./slice/annotations\JPEGImages\0|819_3276_1024_1024_0_8192_6000.xml'
我也是报这个错误,请问解决了吗?
还是报错
2024/05/31还是报错
2024/05/31报错但已找到解决方案 首先issue上传的是windows平台,因此windows需要把/都替换成\(除了main函数出现了/,还有代码第85行也出现了/);其次代码185行提示新生成的xml文件名需要用到"|"字符,该字符在windows下不合法,改成_即可跑通
Traceback (most recent call last): File "d:/Users/ZHT/PycharmProjects/yolov5_瓷砖瑕疵检测/convert_utils/make_slice_voc.py", line 211, in
slice_im(image_path, ann_path, out_name, outdir, sliceHeight=640, sliceWidth=640)
File "d:/Users/ZHT/PycharmProjects/yolov5_瓷砖瑕疵检测/convert_utils/make_slice_voc.py", line 195, in slice_im
make_slice_voc(outpath,exiset_obj_list,sliceHeight,sliceWidth)
File "d:/Users/ZHT/PycharmProjects/yolov5_瓷砖瑕疵检测/convert_utils/make_slice_voc.py", line 86, in make_slice_voc
with codecs.open(os.path.join(slice_voc_dir, name[:-4] + '.xml'), 'w', 'utf-8') as xml:
File "D:\Users\ZHT\anaconda3\envs\pytorch\lib\codecs.py", line 905, in open
file = builtins.open(filename, mode, buffering)
FileNotFoundError: [Errno 2] No such file or directory: './slice/annotations_demo\JPEGImages_demo\qyl|1024_5120_640_640_0_8192_6000.xml'