Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

palette conversion not needed #14

Open
ahundt opened this issue Apr 20, 2017 · 6 comments
Open

palette conversion not needed #14

ahundt opened this issue Apr 20, 2017 · 6 comments

Comments

@ahundt
Copy link

ahundt commented Apr 20, 2017

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
Copy link
Owner

nicolov commented Apr 21, 2017

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

@DarylWM
Copy link

DarylWM commented Oct 11, 2017

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

@ahundt
Copy link
Author

ahundt commented Oct 12, 2017

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

@DarylWM
Copy link

DarylWM commented Oct 13, 2017

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
Copy link
Owner

nicolov commented Oct 13, 2017

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
Copy link

DarylWM commented Nov 10, 2017

Yes indeed - thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants