segmentation_keras icon indicating copy to clipboard operation
segmentation_keras copied to clipboard

palette conversion not needed

Open ahundt opened this issue 8 years ago • 6 comments

https://github.com/nicolov/segmentation_keras/blob/master/convert_masks.py isn't necessary.

Just use Pillow and you can load the classes separately from the color palette, which means it will already be in the format you want!

from https://github.com/aurora95/Keras-FCN/blob/master/utils/SegDataGenerator.py#L203

                from PIL import Image
                label = Image.open(label_filepath)
                if self.save_to_dir and self.palette is None:
                    self.palette = label.palette

cool right?

ahundt avatar Apr 20 '17 16:04 ahundt

Thanks, I did not know about this. pngs for the win!

nicolov avatar Apr 21 '17 09:04 nicolov

The convert_masks.py script produced a set of completely black PNGs for me. Is it still required?

DarylWM avatar Oct 11 '17 23:10 DarylWM

if it is black that most likely means there isn't a palette and you are seeing the raw values as grayscale

ahundt avatar Oct 12 '17 20:10 ahundt

I downloaded the Augmented Pascal VOC dataset and ran the convert_masks.py script. Doesn't that define the palette, and mean that I should see colored mask images?

DarylWM avatar Oct 13 '17 05:10 DarylWM

IIRC black images are ok, because the values are within the 0-21 range. Try opening them in numpy or a photo editor to make sure.

nicolov avatar Oct 13 '17 05:10 nicolov

Yes indeed - thanks.

DarylWM avatar Nov 10 '17 03:11 DarylWM