plot input image and its reuslts
(outputs, image_ori, save_path='../vis/')
| 50 | |
| 51 | |
| 52 | def 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 | |
| 76 | def plot_multi_results(iou_sort_masks, area_sort_masks, image_ori, save_path='../vis/'): |
| 77 | """ |
nothing calls this directly
no test coverage detected