根据第一步得到如下数据集组成结构:
由下代码变成:
import xml.etree.ElementTree as ET
import os
sets = ['train', 'val'] # 需要转换训练集. 验证集
Root = '../datasets/voc-end/' # 数据集目录
classes = ["person", "chef_uniform", "voc_clothes"] # 修改为自己的label
def convert(size, box):
dw = 1./(size[0])
dh = 1./(size[1])
x = (box[0] + box[1])/2.0 - 1
y = (box[2] + box[3])/2.0 - 1
w =