Skip to content

Commit

Permalink
Merge 4e2cf3d into 1efdbda
Browse files Browse the repository at this point in the history
  • Loading branch information
gaotongxiao authored Nov 9, 2021
2 parents 1efdbda + 4e2cf3d commit 2159aae
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mmocr/apis/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def init_detector(config, checkpoint=None, device='cuda:0', cfg_options=None):
config.model.train_cfg = None
model = build_detector(config.model, test_cfg=config.get('test_cfg'))
if checkpoint is not None:
map_loc = 'cpu' if device == 'cpu' else None
checkpoint = load_checkpoint(model, checkpoint, map_location=map_loc)
checkpoint = load_checkpoint(model, checkpoint, map_location='cpu')
if 'CLASSES' in checkpoint.get('meta', {}):
model.CLASSES = checkpoint['meta']['CLASSES']
else:
Expand Down

0 comments on commit 2159aae

Please sign in to comment.