提交 23214086 编写于 作者: S SunAhong1993 提交者: qingqing01

Fix the x2coco.py (#96)

* Update GETTING_STARTED_cn.md
* Update x2coco.py
上级 fce342dc
......@@ -132,7 +132,7 @@ def deal_json(ds_type, img_path, json_path):
image_num = -1
object_num = -1
for img_file in os.listdir(img_path):
img_label = img_file.split('.')[0]
img_label = os.path.splitext(img_file)[0]
if img_file.split('.')[
-1] not in ['bmp', 'jpg', 'jpeg', 'png', 'JPEG', 'JPG', 'PNG']:
continue
......@@ -282,13 +282,16 @@ def main():
indent=4,
cls=MyEncoder)
if args.val_proportion != 0:
val_data_coco = deal_json(args.output_dir + '/val', args.json_input_dir)
val_data_coco = deal_json(args.dataset_type,
args.output_dir + '/val',
args.json_input_dir)
val_json_path = osp.join(args.output_dir + '/annotations',
'instance_val.json')
json.dump(
val_data_coco, open(val_json_path, 'w'), indent=4, cls=MyEncoder)
if args.test_proportion != 0:
test_data_coco = deal_json(args.output_dir + '/test',
test_data_coco = deal_json(args.dataset_type,
args.output_dir + '/test',
args.json_input_dir)
test_json_path = osp.join(args.output_dir + '/annotations',
'instance_test.json')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册