-
Notifications
You must be signed in to change notification settings - Fork 0
/
json2label.py
36 lines (30 loc) · 972 Bytes
/
json2label.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import click
import json
import os
from json_utils import *
from tqdm import tqdm
@click.command()
@click.option(
"--dir_in_json",
"-di",
help = "directory of GT JSON files",
type = click.Path(exists = True, file_okay = False),
)
@click.option(
"--dir_out_labels",
"-do",
help = "directory where the output lables will be written in the png format.",
type = click.Path(exists = True, file_okay = False),
)
@click.option(
"--type_output",
"-to",
help = "this defines if the output should be 3d (encoded with RGB color for visibility) or 2d (used for training a model). Just pass '2d' or '3d'.",
)
def main(dir_in_json, dir_out_labels, type_output):
ls_jsons = os.listdir(dir_in_json)
for ind in tqdm(ls_jsons):
json_name = os.path.join(dir_in_json, ind)
json_converter(json_name, dir_out_labels, type_output)
if __name__ == "__main__":
main()