Created
February 18, 2020 16:32
-
-
Save THEFASHIONGEEK/ca4a7f192e0316bdc7359822e951b86f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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