Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 import matplotlib.pyplot as plt
00009 from random import random as rand
00010 def show_boxes(im, dets, classes, scale = 1.0):
00011 plt.cla()
00012 plt.axis("off")
00013 plt.imshow(im)
00014 for cls_idx, cls_name in enumerate(classes):
00015 cls_dets = dets[cls_idx]
00016 for det in cls_dets:
00017 bbox = det[:4] * scale
00018 color = (rand(), rand(), rand())
00019 rect = plt.Rectangle((bbox[0], bbox[1]),
00020 bbox[2] - bbox[0],
00021 bbox[3] - bbox[1], fill=False,
00022 edgecolor=color, linewidth=2.5)
00023 plt.gca().add_patch(rect)
00024
00025 if cls_dets.shape[1] == 5:
00026 score = det[-1]
00027 plt.gca().text(bbox[0], bbox[1],
00028 '{:s} {:.3f}'.format(cls_name, score),
00029 bbox=dict(facecolor=color, alpha=0.5), fontsize=9, color='white')
00030 plt.show()
00031 return im
00032