nicolov / segmentation_keras

DilatedNet in Keras for image segmentation
MIT License
301 stars 92 forks source link

palette conversion not needed #14

Open ahundt opened 7 years ago

ahundt commented 7 years ago

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?

nicolov commented 7 years ago

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

DarylWM commented 7 years ago

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

ahundt commented 7 years ago

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

DarylWM commented 7 years ago

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?

nicolov commented 7 years ago

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.

DarylWM commented 6 years ago

Yes indeed - thanks.