资源简介
NWPU VHR-10转化为VOC数据集脚本,将NWPU VHR-10的txt标注信息转化为VOC数据集需要的xml脚本
代码片段和文件信息
# -*- coding:UTF-8 -*-
from lxml.etree import Element SubElement tostring
from xml.dom.minidom import parseString
import xml.dom.minidom
import os
import sys
from PIL import Image
def dealwh(path):
files = os.listdir(path) # 鍒楀嚭鎵€鏈夋枃浠?
for file in files:
filename = os.path.splitext(file)[0] # 鍒嗗壊鍑烘枃浠跺悕
sufix = os.path.splitext(file)[1] # 鍒嗗壊鍑哄悗缂€
if sufix == ‘.jpg‘:
height width = readsize(file)
dealpath = path + “/“ + filename + “.xml“
gxml(dealpath height width)
# 鎶妕xt涓殑鍐呭鍐欒繘xml
def deal(path):
files = os.listdir(path) # 鍒楀嚭鎵€鏈夋枃浠?
for file in files:
filename = os.path.splitext(file)[0] # 鍒嗗壊鍑烘枃浠跺悕
# print(filename)
sufix = os.path.splitext(file)[1
评论
共有 条评论