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

Function plot_multi_results

semantic_sam/build_semantic_sam.py:76–94  ·  view source on GitHub ↗

plot input image and its reuslts

(iou_sort_masks, area_sort_masks, image_ori, save_path='../vis/')

Source from the content-addressed store, hash-verified

74 return im
75
76def plot_multi_results(iou_sort_masks, area_sort_masks, image_ori, save_path='../vis/'):
77 """
78 plot input image and its reuslts
79 """
80 if not os.path.exists(save_path):
81 os.mkdir(save_path)
82 plt.imshow(image_ori)
83 plt.savefig('../vis/input.png')
84 def create_long_image(masks):
85 ims = []
86 for img in masks:
87 ims.append(img)
88 width, height = ims[0].size
89 result = Image.new(ims[0].mode, (width * len(ims), height))
90 for i, im in enumerate(ims):
91 result.paste(im, box=(i * width, 0))
92 return result
93 create_long_image(iou_sort_masks).save('../vis/all_results_sort_by_iou.png')
94 create_long_image(area_sort_masks).save('../vis/all_results_sort_by_areas.png')

Callers

nothing calls this directly

Calls 2

create_long_imageFunction · 0.85
saveMethod · 0.80

Tested by

no test coverage detected