lukemelas / deep-spectral-segmentation

[CVPR 2022] Deep Spectral Methods: A Surprisingly Strong Baseline for Unsupervised Semantic Segmentation and Localization
229 stars 41 forks source link

Add a line to retransform output image #14

Open mraoaakash opened 1 year ago

mraoaakash commented 1 year ago

Hello!

While running your code on my dataset, I noticed your CRF output was not being displayed correctly. I realised that this was an error between line 688 and 694. You were computing the correct CRF, however, since it was a binary array generated you need to multiply it by 255 to have the appropriate image pixel values generated. Convert('L') does not seem to be having a desired effect on MacOS and Linux with an Nvidia A5000 (the bases on which I have tested your code). I hope this addition is valuable to your code and subsequent research.

Best, Aakash

lukemelas commented 1 year ago

Should this be segmap_crf = (segmap_crf * 255).astype(np.uint8)?

I suppose if segmap_crf is binary than it doesn't matter, but if it is not binary and it takes values between 0 and 1 then they will get truncated when it gets casted to uint8.

mraoaakash commented 1 year ago

Yes, the correction should be segmap_crf = (segmap_crf * 255).astype(np.uint8)