Dimension mismatch on imported training set

Hi,

for testing purposes I imported the CatsVsDogs training set from here: https://www.kaggle.com/c/dogs-vs-cats

I am using a convnet in Keras for classification. My model seems to be working fine but there is a problem.

In the preprocessing I am resizing the images to 256x256 just for testing. Upon training I get the following error:

could not broadcast input array from shape (256,256,4) into shape (256,256,3)

So it seems like the preprocessing step bumps up my third image dimension to four channels.

Am I doing something wrong here?

this means that some of your images has 4 channels. Maybe some images are PNG files with alpha channels.

You will need to cleanup your images first and make sure they have only 3 channels.

There were only Jpegs in the training set but some of them had an invalid format.

So the rror message is misleading but my problem is solved.

Thanks!

How did you check your images for invalid format? I have the same problem with all jpg’s…