- yolo格式转labelme格式
- python to_json.py yolo标签路径 labelme标签路径
import os, sys, json, shutil
import cv2
from glob import glob
import numpy as np
classes=['white', 'yellow', 'black']
def func(labels, w, h, jp):
dic={
}
dic['version'] = '5.0.1'
dic['flags'] = {
}
dic['imageData'] = None
dic['imagePath'] = jp
dic['imageHeight'] = h
dic['imageWidth'] = w
dic['shapes'] = []
if labels is not None:
for l in labels:
tmp = {
}
tmp['label'] = classes[l[0]]
tmp['points'] =[[str(l[1]), str(l[2])], [str(l[3]), str(l