keras-preprocessing icon indicating copy to clipboard operation
keras-preprocessing copied to clipboard

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

Open nouranali opened this issue 4 years ago • 3 comments

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

nouranali avatar Apr 26 '21 13:04 nouranali

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

Dref360 avatar Apr 26 '21 14:04 Dref360

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

nouranali avatar Apr 26 '21 15:04 nouranali

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/

Dref360 avatar Apr 26 '21 16:04 Dref360