zanilzanzan / FuseNet_PyTorch

Joint scene classification and semantic segmentation with FuseNet
GNU General Public License v3.0
108 stars 34 forks source link

Visual evaluation of the model #12

Closed isaeldoori closed 5 years ago

isaeldoori commented 5 years ago

Hi,

I want to thank you for the work you have done, it has helped me a lot for my Machine Vision course. I have everything working on both the NYUv2 and SUN RGB-D datasets, I even have the model working on a different dataset. However, I was wondering how you made the plots of the visual evaluation of the FuseNet model? fusenet_visual_evaluation

Just like this one in your paper.

Thanks in advance!

hazirbas commented 5 years ago

Hey, if you have a tensor of [numCls, H, W], you can take the max and put palette using PIL.Image:

with open('pascal_voc_colormap.txt', 'r') as f:
    palette = numpy.array([[int(x) for x in line.split()] for line in f]).flatten().tolist()
im = Image.fromarray( (numpy.argmax( result , axis = 0).astype( numpy.uint8 ) ) )
im.putpalette(palette)
im.save('filename.png')

pascal_voc_colormap.txt