# -*- coding: utf-8 -*-
import os
import xml.etree.ElementTree as ET
dirpath = 'xmldir' # 原来存放xml文件的目录
newdir = 'txtdir' # 修改label后形成的txt目录
if not os.path.exists(newdir):
os.makedirs(newdir)
dict_info = {
'sf6': 0, 'thermometer': 1, 'eem': 2,'Ammeter':3,'w':4,'Voltmenter':5} # 有几个 属性 填写几个label names
for fp in os.listdir(dirpath):
python批量实现labelImg标注的 xml格式数据转换成 txt格式保存
于 2024-04-30 10:29:24 首次发布