def main():
    args = parse_args()
    root_path = args.root_path
    for split in ['training', 'test']:
        print(f'Processing {split} set...')
        with mmcv.Timer(print_tmpl='It takes {}s to convert FUNSD annotation'):
            files = collect_files(osp.join(root_path, 'imgs'), osp.join(root_path, 'annotations', split))
            image_infos = collect_annotations(files, nproc=args.nproc)
            convert_annotations(image_infos, osp.join(root_path, (('instances_' + split) + '.json')))
def main():
    args = parse_args()
    root_path = args.root_path
    for split in ['training', 'test']:
        print(f'Processing {split} set...')
        with mmcv.Timer(print_tmpl='It takes {}s to convert FUNSD annotation'):
            files = collect_files(osp.join(root_path, 'imgs'), osp.join(root_path, 'annotations', split))
            image_infos = collect_annotations(files, nproc=args.nproc)
            convert_annotations(image_infos, osp.join(root_path, (('instances_' + split) + '.json')))