MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / plot_results

Function plot_results

semantic_sam/build_semantic_sam.py:52–74  ·  view source on GitHub ↗

plot input image and its reuslts

(outputs, image_ori, save_path='../vis/')

Source from the content-addressed store, hash-verified

50
51
52def plot_results(outputs, image_ori, save_path='../vis/'):
53 """
54 plot input image and its reuslts
55 """
56 if os.path.isdir(save_path):
57 image_ori_name = 'input.png'
58 im_name = 'example.png'
59 else:
60 image_ori_name = os.path.basename(save_path).split('.')[0] + '_input.png'
61 im_name = os.path.basename(save_path).split('.')[0]+ '_example.png'
62 save_path = os.path.dirname(save_path)
63
64 if not os.path.exists(save_path):
65 os.mkdir(save_path)
66
67 fig = plt.figure()
68 plt.imshow(image_ori)
69 plt.savefig(os.path.join(save_path, image_ori_name))
70 show_anns(outputs)
71 fig.canvas.draw()
72 im = Image.frombytes('RGB', fig.canvas.get_width_height(), fig.canvas.tostring_rgb())
73 plt.savefig(os.path.join(save_path, im_name))
74 return im
75
76def plot_multi_results(iou_sort_masks, area_sort_masks, image_ori, save_path='../vis/'):
77 """

Callers

nothing calls this directly

Calls 1

show_annsFunction · 0.90

Tested by

no test coverage detected