1. labelme制作标签
安装:https://github.com/wkentaro/labelme 有列出各种系统安装方法
启动:终端输入labelme(有介绍怎么启动)
启动以后:
处理完图像以后保存,json格式。
2. json转txt
import os
import json
import numpy as np
dir_json = '/test_label_json/' #json存储的文件目录
dir_txt = '/test_label_json/' #txt存储目录
if not os.path.exists(dir_txt):
os.makedirs(dir_txt)
list_json = os.listdir(dir_json)
def json2txt(path_json,path_txt): #可修改生成格式
with open(path_json,'r') as path_json:
jsonx=json.load(path_json)
with open(path_txt,'w+') as ftxt:
for shape in jsonx['shapes']:
label = str(shape['label'])+' &#