(scores, boxes, classes)
| 84 | |
| 85 | |
| 86 | def show_predictions(scores, boxes, classes): |
| 87 | num_obj = len(scores) |
| 88 | if num_obj == 0: |
| 89 | return |
| 90 | ax = plt.gca() |
| 91 | ax.set_autoscale_on(False) |
| 92 | colors = plt.cm.gist_rainbow(np.linspace(0, 1, num_obj)) |
| 93 | |
| 94 | for obj_ind in range(num_obj): |
| 95 | box = boxes[obj_ind] |
| 96 | score = scores[obj_ind] |
| 97 | name = classes[obj_ind] |
| 98 | |
| 99 | # color_mask = np.random.random((1, 3)).tolist()[0] |
| 100 | color_mask = colors[obj_ind] |
| 101 | |
| 102 | # m = masks[obj_ind][0] |
| 103 | # img = np.ones((m.shape[0], m.shape[1], 3)) |
| 104 | # for i in range(3): |
| 105 | # img[:,:,i] = color_mask[i] |
| 106 | # ax.imshow(np.dstack((img, m*0.45))) |
| 107 | |
| 108 | x0, y0, w, h = box[0], box[1], box[2] - box[0], box[3] - box[1] |
| 109 | ax.add_patch(plt.Rectangle((x0, y0), w, h, edgecolor=color_mask, facecolor=(0, 0, 0, 0), lw=2)) |
| 110 | |
| 111 | label = name + ': {:.2}'.format(score) |
| 112 | ax.text(x0, y0, label, color=color_mask, fontsize='large', fontfamily='sans-serif') |
| 113 | |
| 114 | def get_gpu_memory(max_gpus=None): |
| 115 | gpu_memory = [] |
no outgoing calls
no test coverage detected