Skip to content

Instantly share code, notes, and snippets.

@THEFASHIONGEEK
Created February 18, 2020 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save THEFASHIONGEEK/ca4a7f192e0316bdc7359822e951b86f to your computer and use it in GitHub Desktop.
Save THEFASHIONGEEK/ca4a7f192e0316bdc7359822e951b86f to your computer and use it in GitHub Desktop.
list_dict = []
anno = []
for i in range(len(df)):
img_name = df[columns[0]][i]
labels = df[columns[1]][i]
tmp = labels.split(delimiter)
for j in range(len(tmp)//5):
label = tmp[j*5+4]
if(label not in anno):
anno.append(label)
anno = sorted(anno)
for i in tqdm(range(len(anno))):
tmp = {}
tmp["supercategory"] = "master"
tmp["id"] = i
tmp["name"] = anno[i]
list_dict.append(tmp)
anno_f = open(output_classes_file, 'w')
for i in range(len(anno)):
anno_f.write(anno[i] + "\n")
anno_f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment