keras-team / keras-preprocessing

Utilities for working with image data, text data, and sequence data.
Other
1.02k stars 444 forks source link

ImageDataGenerator, Apply augmentation on images that have more than 4 channels #341

Open nouranali opened 3 years ago

nouranali commented 3 years ago

Why ImageDataGenerator supports up to 4 channel images and not more, I am working on a project with a 6 channel image and unable to perform augmentation due to this limitation, are there any alternatives or modification to this code section ? Screenshot from 2021-04-26 15-27-38

Dref360 commented 3 years ago

I think this limitation comes from Pillow and not from keras-preprocessing. TF has a similar limitation in tf.io.decode_image

nouranali commented 3 years ago

I think this limitation comes from Pillow and not from keras-preprocessing. TF has a similar limitation in tf.io.decode_image

then what if I want to do so

Dref360 commented 3 years ago

You can implement your own tf Dataset: https://www.tensorflow.org/guide/data

Or your own keras.Sequence, they are deprecated, but still works.

Then for your data augmentation, you can do something similar to this post and use apply_transform.

I think the new keras preprocessing layers could be useful on your case. More info : https://keras.io/guides/preprocessing_layers/