def vis_result(image, seg, gt, file_name='test.png'):
indices = np.where(seg == 1)
indices_gt = np.where(gt == 1)
im_norm = image / image.max()
rgb_image = color.gray2rgb(im_norm)
multiplier = [0., 1., 1.]
multiplier_gt = [1., 1., 0.]
im_seg = rgb_image.copy()
im_gt = rgb_image.copy()
im_seg[indices[0], indices[1], :] *= multiplier
im_gt[indices_gt[0], indices_gt[1], :] *= multiplier_gt
fig = plt.figure()
a = fig.add_subplot(1, 2, 1)
plt.imshow(im_seg)
a.set_title('Segmentation')
a = fig.add_subplot(1, 2, 2)
plt.imshow(im_gt)
a.set_title('Ground truth')
plt.savefig(file_name)
评论列表
文章目录