Fix window data won't destroy error when out_file is not None and show=False (#4442)

pull/4453/head
Haian Huang(深度眸) 4 years ago committed by GitHub
parent 3a0e75b081
commit c762d1e4cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      mmdet/core/visualization/image.py

@ -112,7 +112,7 @@ def imshow_det_bboxes(img,
img = mmcv.bgr2rgb(img) img = mmcv.bgr2rgb(img)
img = np.ascontiguousarray(img) img = np.ascontiguousarray(img)
plt.figure(figsize=fig_size) plt.figure(win_name, figsize=fig_size)
plt.title(win_name) plt.title(win_name)
plt.axis('off') plt.axis('off')
ax = plt.gca() ax = plt.gca()
@ -159,6 +159,8 @@ def imshow_det_bboxes(img,
dir_name = osp.abspath(osp.dirname(out_file)) dir_name = osp.abspath(osp.dirname(out_file))
mmcv.mkdir_or_exist(dir_name) mmcv.mkdir_or_exist(dir_name)
plt.savefig(out_file) plt.savefig(out_file)
if not show:
plt.close()
if show: if show:
if wait_time == 0: if wait_time == 0:
plt.show() plt.show()

Loading…
Cancel
Save