VOC格式标签
:图片的实际宽和高,标注框的左上角和右下角坐标YOLO格式标签
:标注框的中心坐标(归一化的),标注框的宽和高(归一化的)
将xml文件从pic_path移到xml_path
def copy_xml_to_other_folder(pic_path,xml_path):
"""move xml file from pic_path to xml_path"""
pic_xml_list = os.listdir(pic_path)
for sample in tqdm(pic_xml_list):
if 'xml' in sample:
ori_xml_path = osp.join(pic_path,sample)
end_xml_path = osp.join(xml_path,sample)
shutil.copy(ori_xml_path,end_xml_path)
读取xml文件,并转为voc形式的txt。
def xml_to_txt(xml_path, outdir):
"""读取xml文件,获得想要的内容存到txt文件中"""
"""XML设计的核心是包含和传输数据"""
xml_list = os.listdir(xml_path)
for xml_file in tqdm(xml_list):
xml_file_name = osp.basename(xml_file)[:-4]
xml_file_p