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

Minor change: Added tif and tiff to white_list_formats #9187

Merged
merged 3 commits into from
Jan 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion keras/preprocessing/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,9 @@ def _recursive_list(subpath):
for fname in files:
is_valid = False
for extension in white_list_formats:
if fname.lower().endswith('.tiff'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will warns a tremendous amount times, isn't it?
I would just do a check before returning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I am pretty sure it won't (I also ran it).

See the docs at http://docs.python.org/2/library/warnings.html:

"Repetitions of a particular warning for the same source location are typically suppressed."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good then!

warnings.warn('Using \'.tiff\' files with multiple bands will cause distortion. '
'Please verify your output.')
if fname.lower().endswith('.' + extension):
is_valid = True
break
Expand Down Expand Up @@ -1094,7 +1097,7 @@ def __init__(self, directory, image_data_generator,
self.save_format = save_format
self.interpolation = interpolation

white_list_formats = {'png', 'jpg', 'jpeg', 'bmp', 'ppm'}
white_list_formats = {'png', 'jpg', 'jpeg', 'bmp', 'ppm', 'tif', 'tiff'}

# first, count the number of samples and classes
self.samples = 0
Expand Down