def METHOD_NAME():
    args = parse_args()
    root_path = args.root_path
    ratio = args.val_ratio
    trn_files, val_files = collect_files(
        osp.join(root_path, 'imgs'), osp.join(root_path, 'annotations'), ratio)
    # Train set
    trn_infos = collect_annotations(trn_files, nproc=args.nproc)
    with mmengine.Timer(
            print_tmpl='It takes {}s to convert MTWI Training annotation'):
        dump_ocr_data(trn_infos, osp.join(root_path,
                                          'instances_training.json'),
                      'textdet')
    # Val set
    if len(val_files) > 0:
        val_infos = collect_annotations(val_files, nproc=args.nproc)
        with mmengine.Timer(
                print_tmpl='It takes {}s to convert MTWI Val annotation'):
            dump_ocr_data(val_infos, osp.join(root_path, 'instances_val.json'),
                          'textdet')