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

ImageDataGenerator file formats #7904

Open
Nqabz opened this Issue Sep 15, 2017 · 5 comments

Comments

Projects
None yet
6 participants
@Nqabz

Nqabz commented Sep 15, 2017

Not a question but perhaps a suggestion that the file formats that are read, when using the image data augmentation module for example a direct read of file on a local directory with datagen.flow_from_directory(), are too specific and no useful message error is communicated back to the user if you happen to read files not included in the white_list_formats = {'png', 'jpg', 'jpeg', 'bmp', 'ppm'}. Is it possible to communicate a useful error message if the file format is not part of the list or perhps expose white_list_formats to be set outside the script.

Took me me few hours to figure out why the module wouldn't read my images in .tiff format. As you can see from the list above. 'tiff' is not one of the default file formats. Adding it to the list on line 969 in keras/preprocessing/image.py resolves the problem.

@russell0

This comment has been minimized.

russell0 commented Dec 11, 2017

It also works to change it to '.tif' -- thankfully for me!

@osamadel

This comment has been minimized.

osamadel commented Feb 3, 2018

Well, thank you this actually worked for me. I had to add the 'tif' and 'tiff' file extensions to the white_list_formats in small letters and restart Spyder once, and run the code again to make it actually work.

@mmortazavi

This comment has been minimized.

mmortazavi commented Feb 3, 2018

For some reasons simply adding them did not help! Finally I updated the keras from git branch, and ran the code again, worked just fine (that is why I deleted my original question because I thought it was perhaps quite obvious that I had to pull it from the main branch). Still wondering how it is possible for some like you simply adding "tif" to white_list_formats make it work.
Now keras preprocessing supports {'png', 'jpg', 'jpeg', 'bmp', 'ppm', 'tif', 'tiff'}, nice.

@benneely

This comment has been minimized.

benneely commented Apr 20, 2018

I'm interested in learning more about the purpose of white_list_formats. PILLOW will handle tifs and many other image formats. Since PIL support for image formats seems to be the rate limiting step, why not just limit to PIL's support of image formats?

@sarahndudgeon

This comment has been minimized.

sarahndudgeon commented Sep 6, 2018

for me it was line 1188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment