jiwoon-ahn / irn

Weakly Supervised Learning of Instance Segmentation with Inter-pixel Relations, CVPR 2019 (Oral)
MIT License
525 stars 100 forks source link

How do you get the result image? #12

Closed UdonDa closed 5 years ago

UdonDa commented 5 years ago

Thanks to open your implementation!

I want to know how to save the visualization image like https://github.com/jiwoon-ahn/irn/blob/master/outline.jpg

thanks.

jiwoon-ahn commented 5 years ago

Hi @UdonDa, This code already provides those functions. Please look up: https://github.com/jiwoon-ahn/irn/blob/master/misc/imutils.py#L193-L272

UdonDa commented 5 years ago

Thanks! I will try it!

UdonDa commented 5 years ago

Sorry, I don't know how to save the images, fig6 (C) and (D) in the https://arxiv.org/pdf/1904.05044.pdf I want to save the centroid image. Please teach us.

jiwoon-ahn commented 5 years ago

Consider adding the following lines around here https://github.com/jiwoon-ahn/irn/blob/master/step/make_ins_seg_labels.py#L125 For (c), colorize_displacement(dp) For (d), edge

mokadyr commented 4 years ago

Hi @jiwoon-ahn How can I get the Instance Map from the Displacement field (As in Figure 1)?

JamChaos commented 3 years ago

考虑在此处添加以下几行https://github.com/jiwoon-ahn/irn/blob/master/step/make_ins_seg_labels.py#L125 对于(c), colorize_displacement(dp) 对于(d), edge

请问对于d用哪个函数

pppwzj commented 1 year ago

How can i get fig6 (e) Pseudo labels? Thank you

Elaineok commented 2 months ago

############Visual offset field from PIL import Image rgb_image = colorize_displacement(dp) if rgb_image.dtype != np.uint8: 空格rgb_image = (rgb_image * 255).astype(np.uint8) image = Image.fromarray(rgbimage) image.save(os.path.join("/disk4/xjt/irn-master/cam/","" + str(img_name)+"offset" + ".png")) ###############

another method ############# def save_displacement_image(offset_map): import numpy as np r = np.sqrt(offset_map[0] 2 + offset_map[1] 2) r = np.clip(r, 0, np.max(r)) norm_r = r / (np.max(r) + 1e-5) return norm_r

offset_map1 = offset_map.cpu().numpy() norm_r = save_displacement_image(offset_map1)

import matplotlib.pyplot as plt import os fig, ax = plt.subplots(figsize=(10, 10)) cmap = plt.get_cmap('coolwarm') norm = plt.Normalize(vmin=0, vmax=1) cax = ax.imshow(norm_r, cmap=cmap, norm=norm) save_path = "/data2/jt2/code/BESTIE-main_peak50copy1_1active_get_stage1copy/utils/1/" filename = f"{fname[0]}{cls}.png" file_path = os.path.join(save_path, filename) plt.savefig(file_path, bbox_inches='tight', pad_inches=0) plt.close(fig) #############