Skip to content

Commit

Permalink
[Fix]: fix dataset meta (#9536)
Browse files Browse the repository at this point in the history
  • Loading branch information
RangiLyu authored Dec 27, 2022
1 parent a9f46b6 commit 99d501f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions mmdet/apis/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,15 @@ def init_detector(
checkpoint_meta = checkpoint.get('meta', {})
# save the dataset_meta in the model for convenience
if 'dataset_meta' in checkpoint_meta:
# mmdet 3.x
model.dataset_meta = checkpoint_meta['dataset_meta']
# mmdet 3.x, all keys should be lowercase
model.dataset_meta = {
k.lower(): v
for k, v in checkpoint_meta['dataset_meta'].items()
}
elif 'CLASSES' in checkpoint_meta:
# < mmdet 3.x
classes = checkpoint_meta['CLASSES']
model.dataset_meta = {'classes': classes, 'palette': palette}
elif 'classes' in checkpoint_meta:
# < mmdet 3.x
classes = checkpoint_meta['classes']
model.dataset_meta = {'classes': classes, 'palette': palette}
else:
warnings.simplefilter('once')
warnings.warn(
Expand Down

0 comments on commit 99d501f

Please sign in to comment.