| 18 | |
| 19 | |
| 20 | def get_annpaths(ann_dir_path: str = None, |
| 21 | ann_ids_path: str = None, |
| 22 | ext: str = '', |
| 23 | annpaths_list_path: str = None) -> List[str]: |
| 24 | # If use annotation paths list |
| 25 | if annpaths_list_path is not None: |
| 26 | with open(annpaths_list_path, 'r') as f: |
| 27 | ann_paths = f.read().split() |
| 28 | return ann_paths |
| 29 | |
| 30 | # If use annotaion ids list |
| 31 | ext_with_dot = '.' + ext if ext != '' else '' |
| 32 | with open(ann_ids_path, 'r') as f: |
| 33 | ann_ids = f.read().split() |
| 34 | ann_paths = [os.path.join(ann_dir_path, aid+ext_with_dot) for aid in ann_ids] |
| 35 | return ann_paths |
| 36 | |
| 37 | |
| 38 | def get_image_info(annotation_root, extract_num_from_imgid=True): |