Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mmdet/datasets/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def load_data_list(self) -> List[dict]:
# change with the order of the `classes`
self.cat_ids = self.coco.get_cat_ids(
cat_names=self.metainfo['classes'])

if len(self.cat_ids) == 0:
raise Exception(f"Can't find classes in \
annotation file {self.metainfo['classes']}")

self.cat2label = {cat_id: i for i, cat_id in enumerate(self.cat_ids)}
self.cat_img_map = copy.deepcopy(self.coco.cat_img_map)

Expand Down