Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

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

Open
nouranali opened this issue Apr 26, 2021 · 3 comments
Labels
image Related to images

Comments

@nouranali
Copy link

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 nouranali added the image Related to images label Apr 26, 2021
@Dref360
Copy link
Contributor

Dref360 commented Apr 26, 2021

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

@nouranali
Copy link
Author

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

Dref360 commented Apr 26, 2021

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/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
image Related to images
Projects
None yet
Development

No branches or pull requests

2 participants