Skip to content

Commit 99d501f

Browse files
authored
[Fix]: fix dataset meta (#9536)
1 parent a9f46b6 commit 99d501f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

mmdet/apis/inference.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,15 @@ def init_detector(
5959
checkpoint_meta = checkpoint.get('meta', {})
6060
# save the dataset_meta in the model for convenience
6161
if 'dataset_meta' in checkpoint_meta:
62-
# mmdet 3.x
63-
model.dataset_meta = checkpoint_meta['dataset_meta']
62+
# mmdet 3.x, all keys should be lowercase
63+
model.dataset_meta = {
64+
k.lower(): v
65+
for k, v in checkpoint_meta['dataset_meta'].items()
66+
}
6467
elif 'CLASSES' in checkpoint_meta:
6568
# < mmdet 3.x
6669
classes = checkpoint_meta['CLASSES']
6770
model.dataset_meta = {'classes': classes, 'palette': palette}
68-
elif 'classes' in checkpoint_meta:
69-
# < mmdet 3.x
70-
classes = checkpoint_meta['classes']
71-
model.dataset_meta = {'classes': classes, 'palette': palette}
7271
else:
7372
warnings.simplefilter('once')
7473
warnings.warn(

0 commit comments

Comments
 (0)