Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make_slice_voc报错 #6

Open
Zigars opened this issue Jan 19, 2021 · 7 comments
Open

make_slice_voc报错 #6

Zigars opened this issue Jan 19, 2021 · 7 comments

Comments

@Zigars
Copy link

Zigars commented Jan 19, 2021

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
Copy link
Owner

DLLXW commented Jan 19, 2021

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
Copy link

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

@liu-guoguo
Copy link

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

@ZXYQAQ123
Copy link

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

@ZXYQAQ123
Copy link

还是报错

@defzhangaa
Copy link

2024/05/31还是报错

@defzhangaa
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants