How can I change the colors of results of show_results for segmentation problem

Hello

I am trying to change the colors of the output of show_results function in a segmented image. Could anyone please help me with this?

Thank you

1 Like

There’s a cmap parameter where you can pass in various matplotlib color map codes

Hello Zachary

Thanks for the reply. Can you please give me an example code? if I have three segmented labels, how can I map them to three different custom colors?

Thank you

https://matplotlib.org/3.2.1/tutorials/colors/colormaps.html

https://matplotlib.org/3.2.1/tutorials/colors/colormap-manipulation.html

https://matplotlib.org/3.1.0/gallery/color/custom_cmap.html

I have never personally tried a custom color map, I’ve just used what they have available in matplotlib (as this is what it’s from, not fastai). The above links should help you some :slight_smile:

3 Likes