forked from Py-Contributors/dataset-convertor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.py
26 lines (20 loc) · 1.12 KB
/
convert.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
"""
# Python script to convert objects detection dataset from
# one format to another format
"""
import argparse
from src.utils import Convertor
parser = argparse.ArgumentParser(description='convert object detection format to another format')
parser.add_argument('--input-folder', '-i', type=str, required=True, help='input folder')
parser.add_argument('--output-folder', '-o', type=str, required=True, help='output folder')
parser.add_argument('--input-format', '-if', type=str, required=True, help='input format')
parser.add_argument('--output-format', '-of', type=str, required=True, help='output format')
args = parser.parse_args()
if __name__ == '__main__':
convertor = Convertor(args.input_folder, args.output_folder, args.input_format, args.output_format)
if args.input_format == 'yolo' and args.output_format == "voc":
convertor.yolo2voc()
elif args.input_format == 'voc' and args.output_format == "yolo":
convertor.voc2yolo()
else:
print('Conversion not supported yet, please check https://github.com/codePerfectPlus/dataset-convertor/blob/main/README.md for upcoming supported formats')