Skip to content

Commit

Permalink
Merge b95f4e5 into 3cb1a70
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaAndroid authored Mar 2, 2021
2 parents 3cb1a70 + b95f4e5 commit a799cc5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
9 changes: 1 addition & 8 deletions mmdet/apis/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def init_detector(config, checkpoint=None, device='cuda:0', cfg_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:
warnings.simplefilter('once')
Expand Down Expand Up @@ -184,9 +184,7 @@ def show_result_pyplot(model,
img,
result,
score_thr=0.3,
fig_size=(15, 10),
title='result',
block=True,
wait_time=0):
"""Visualize the detection results on the image.
Expand All @@ -196,15 +194,10 @@ def show_result_pyplot(model,
result (tuple[list] or list): The detection result, can be either
(bbox, segm) or just bbox.
score_thr (float): The threshold to visualize the bboxes and masks.
fig_size (tuple): Figure size of the pyplot figure.
title (str): Title of the pyplot figure.
block (bool): Whether to block GUI. Default: True
wait_time (float): Value of waitKey param.
Default: 0.
"""
warnings.warn('"block" will be deprecated in v2.9.0,'
'Please use "wait_time"')
warnings.warn('"fig_size" are deprecated and takes no effect.')
if hasattr(model, 'module'):
model = model.module
model.show_result(
Expand Down
6 changes: 0 additions & 6 deletions mmdet/core/visualization/image.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import warnings

import matplotlib.pyplot as plt
import mmcv
import numpy as np
Expand Down Expand Up @@ -37,7 +35,6 @@ def imshow_det_bboxes(img,
text_color='green',
mask_color=None,
thickness=2,
font_scale=0.5,
font_size=13,
win_name='',
show=True,
Expand All @@ -61,7 +58,6 @@ def imshow_det_bboxes(img,
Color of masks. The tuple of color should be in BGR order.
Default: None
thickness (int): Thickness of lines. Default: 2
font_scale (float): Font scales of texts. Default: 0.5
font_size (int): Font size of texts. Default: 13
show (bool): Whether to show the image. Default: True
win_name (str): The window name. Default: ''
Expand All @@ -72,8 +68,6 @@ def imshow_det_bboxes(img,
Returns:
ndarray: The image with bboxes drawn on it.
"""
warnings.warn('"font_scale" will be deprecated in v2.9.0,'
'Please use "font_size"')
assert bboxes.ndim == 2, \
f' bboxes ndim should be 2, but its ndim is {bboxes.ndim}.'
assert labels.ndim == 1, \
Expand Down
2 changes: 1 addition & 1 deletion tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def main():
model = fuse_conv_bn(model)
# old versions did not save class info in checkpoints, this walkaround is
# for backward compatibility
if 'CLASSES' in checkpoint['meta']:
if 'CLASSES' in checkpoint.get('meta', {}):
model.CLASSES = checkpoint['meta']['CLASSES']
else:
model.CLASSES = dataset.CLASSES
Expand Down

0 comments on commit a799cc5

Please sign in to comment.