[Fix] check for CLASSES in checkpoint meta (#207)
- check for CLASSES in checkpoint meta when key meta does not existspull/220/head
parent
1cde6f6e65
commit
3affc481c8
|
@ -36,7 +36,7 @@ def init_model(config, checkpoint=None, device='cuda:0', options=None):
|
|||
if checkpoint is not None:
|
||||
map_loc = 'cpu' if device == 'cpu' else None
|
||||
checkpoint = load_checkpoint(model, checkpoint, map_location=map_loc)
|
||||
if 'CLASSES' in checkpoint['meta']:
|
||||
if 'CLASSES' in checkpoint.get('meta', {}):
|
||||
model.CLASSES = checkpoint['meta']['CLASSES']
|
||||
else:
|
||||
from mmcls.datasets import ImageNet
|
||||
|
|
|
@ -111,7 +111,7 @@ def main():
|
|||
wrap_fp16_model(model)
|
||||
checkpoint = load_checkpoint(model, args.checkpoint, map_location='cpu')
|
||||
|
||||
if 'CLASSES' in checkpoint['meta']:
|
||||
if 'CLASSES' in checkpoint.get('meta', {}):
|
||||
CLASSES = checkpoint['meta']['CLASSES']
|
||||
else:
|
||||
from mmcls.datasets import ImageNet
|
||||
|
|
Loading…
Reference in New Issue