[SOLVED] Keras 2: Flow_from_directory messing up colors

When I read an image from disk using scipy.ndimage.imread channels seems to be ordered okay - I can preview the picture just fine with plt.imshow

When I use ImageDataGenerator, this is not the case. I am guessing the channels are getting switched though can’t confirm. Please take a look at the below.

The question is - why is this happening? After rescaling the image is of dim (224, 224, 3), i tried all the possible permutations of the color channels, but to no avail - still getting peculiar colors.

1 Like

Case closed :slight_smile: Turned out the solution was here in this github thread: https://github.com/fchollet/keras/issues/5846

Apparently wrong datatype resulted in strange colors…

Just recently @goyder helped me fix that same issue. Really frustrating issue, but at least it is an easy solution!

1 Like