目录
数据集可视化
这是VOC 2007,放在VOC2007文件夹下 ,用opencv-python处理的,显示进度
import os
import cv2
import xml.dom.minidom
from tqdm import tqdm
image_path="./JPEGImages/"
annotation_path="./Annotations/"
files_name = os.listdir(image_path)
for filename_ in tqdm(files_name):
filename, extension= os.path.splitext(filename_)
#filename=filename.split('__')[0]
img_path =image_path+filename+'.jpg'
xml_path =annotation_path+filename+'.xml'
img = cv2.imread(img_path)
if img is None:
pass
try:
dom = xml.dom.minidom.parse(xml_path)
except:
#os.remove(img_path)
continue
root = dom.documentElement
objec