import os
rootimgs = 'D:\paper\\2fully_convolutial_adaption\setting1\JPEGImages'
rootxmls = 'D:\paper\\2fully_convolutial_adaption\setting1\Annotations\\'
allusedxmls = []
file_imgs = os.listdir(rootimgs)
file_xmls = os.listdir(rootxmls)
for file_name in file_imgs:
file_name = file_name[:-4] + '.xml'
# print(file_name)
allusedxmls.append(file_name)
for file_name in file_xmls:
# print(file_name)
if file_name not in allusedxmls:
path = rootxmls + file_name
os.remove(path)
删除没有标注的图像或多余的标签
于 2022-04-29 07:50:57 首次发布