python---文件路径的操作(有点意思)
path='VOC/images/train'
在windows中需要将路径变成//这种的样子
使用
p = str(Path(p))
p='VOC\\images\\train'
parent = str(Path(p).parent) + os.sep
str(Path(p).parent)就变成了 VOC\\images
os.sep就是\\
parent='VOC\\images\\'
f += glob.iglob(p + os.sep + '*.*')
对路径下*.*的文件进行逐个添加到f中
下面这个可厉害了直接把image赚到了txt
[x.replace(sa, sb, 1).replace(os.path.splitext(x)[-1], '.txt') for x in img_paths]