代码篇XML格式转换为JSON格式(转为COCO格式)Python版
发布时间
阅读量:
阅读量
import json
import xml.etree.ElementTree as ET
import os
from lxml import etree
from tqdm import tqdm
import numpy as np
class GEN_Annotations:
def __init__(self, filename):
self.root = etree.Element("annotation")
child1 = etree.SubElement(self.root, "folder")
child1.text = "VOC2007"
child2 = etree.SubElement(self.root, "filename")
child2.text = filename
child3 = etree.SubElement(self.root, "source")
child4 = etree.SubElement(child3, "annotation")
child4.text =
全部评论 (0)
还没有任何评论哟~
