labelme标注json转xml
import os
from typing import List, Any
import numpy as np
import codecs
import json
from glob import glob
import cv2
import shutil
from sklearn.model_selection import train_test_split
labelme_path = "G:/12json/" #json文件夹路径
saved_path = "G:/12json/" # xml保存路径
if not os.path.exists(saved_path + "Annotations"):
os.makedirs(saved_path + "Annotations")
files = glob(labelme_path + "*.json")
files = [i.replace("\\","/").split("/")[-1].split(".json")[0] for i in files]
print(files)
for json_file_ in files:
json_filename = labelme_path + json_file_ + ".json"
json_file = json.load(open(json_filename, "r", encoding="utf-8"))
height, width, channels = 720,1280,3<