DLLXW / data-science-competition

该仓库用于记录作者本人参加的各大数据科学竞赛的获奖方案源码以及一些新比赛的原创baseline. 主要涵盖:kaggle, 阿里天池,华为云大赛校园赛,百度aistudio,和鲸社区,datafountain等
1.33k stars 474 forks source link

make_slice_voc报错 #6

Open Zigars opened 3 years ago

Zigars commented 3 years ago

image 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'

DLLXW commented 3 years ago

image 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下面)

MingwayZhang27 commented 3 years ago

我也遇到了这种情况,遵循上面两种方法,还是出现了同样的错误

liu-guoguo commented 2 years ago

大佬,同问,我也遇到了相同的情况,FileNotFoundError: [Errno 2] No such file or directory:'./slice/annotations\JPEGImages\0|819_3276_1024_1024_0_8192_6000.xml'

ZXYQAQ123 commented 1 year ago

我也是报这个错误,请问解决了吗?

ZXYQAQ123 commented 1 year ago

还是报错

defzhangaa commented 5 months ago

2024/05/31还是报错

defzhangaa commented 5 months ago

2024/05/31报错但已找到解决方案 首先issue上传的是windows平台,因此windows需要把/都替换成\(除了main函数出现了/,还有代码第85行也出现了/);其次代码185行提示新生成的xml文件名需要用到"|"字符,该字符在windows下不合法,改成_即可跑通