1.博主从朋友那里拿了一个VOC数据集,里面有20个类,博主只要6个
classes={"one","two","three","four","five","fist"}
2.选出来后把对应图片也找出来
# coding=utf-8
"""选出指定标签的xml文件"""
#"""选出对应标签的图片"""
import os
import os.path
import xml.dom.minidom
import shutil
import sys
path = "C:\\Users\\AS\\Desktop\\new\\Annotations"
newpath="C:\\Users\\AS\\Desktop\\new\\label"
label_path = "C:\\Users\\AS\\Desktop\\new\\label"
image_path = "C:\\Users\\AS\\Desktop\\new\\JPEGImages"
image_new_path ="C:\\Users\\AS\\Desktop\\new\\image"
files = os.listdir(path) # 得到文件夹下所有文件名称
# s = []
classes={"one","two","three","four","five","fist"}
new =[]
def selete_xml_file():
j = 1
for xmlFile in files:
# 遍历文件夹
j