赞
踩
原作者github代码https://github.com/DetectionTeamUCAS/RRPN_Faster-RCNN_Tensorflow/tree/master/data/io
但在我这跑不通,部分细节改了改。
将DOTA数据集转成PASCAL VOC的格式
import os from xml.dom.minidom import Document from xml.dom.minidom import parse import xml.dom.minidom import numpy as np import csv import cv2 import string def WriterXMLFiles(filename, path, box_list, label_list, w, h, d): # dict_box[filename]=json_dict[filename] doc = xml.dom.minidom.Document() root = doc.createElement('annotation') doc.appendChild(root) foldername = doc.createElement("folder") foldername.appendChild(doc.createTextNode("JPEGImages")) root.appendChild(foldername) nodeFilename = doc.createElement('filename') nodeFilename.appendChild(doc.createTextNode(filename)) root.appendChild(nodeFilename) pathname = doc.createElement("path") pathname.appendChild(doc.createTextNode("xxxx")) root.appendChild(pathname) sourcename=doc.createElement("source") databasename = doc.createElement("database") databasename.appendChild(doc.createTextNode("Unknown")) sourcename.appendChild(databasename) annotationname = doc.createElement("annotation") annotationname.appendChild(doc.createTextNode("xxx")) sourcename
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。