Register a dataset in LVIS's json annotation format for instance detection and segmentation. Args: name (str): a name that identifies the dataset, e.g. "lvis_v0.5_train". metadata (dict): extra metadata associated with this dataset. It can be an empty dict. json_fil
(name, metadata, json_file, image_root)
| 22 | |
| 23 | |
| 24 | def register_lvis_instances(name, metadata, json_file, image_root): |
| 25 | """ |
| 26 | Register a dataset in LVIS's json annotation format for instance detection and segmentation. |
| 27 | |
| 28 | Args: |
| 29 | name (str): a name that identifies the dataset, e.g. "lvis_v0.5_train". |
| 30 | metadata (dict): extra metadata associated with this dataset. It can be an empty dict. |
| 31 | json_file (str): path to the json instance annotation file. |
| 32 | image_root (str or path-like): directory which contains all the images. |
| 33 | """ |
| 34 | DatasetCatalog.register(name, lambda: load_lvis_json(json_file, image_root, name)) |
| 35 | MetadataCatalog.get(name).set( |
| 36 | json_file=json_file, image_root=image_root, evaluator_type="lvis", **metadata |
| 37 | ) |
| 38 | |
| 39 | |
| 40 | def load_lvis_json(json_file, image_root, dataset_name=None): |
no test coverage detected