I am trying to fit the vgg model but am getting an exception with the shape.
Exception: Error when checking model input: expected lambda_input_2 to have shape (None, 3, 224, 224) but got array with shape (16, 224, 224, 3)
I am currently using keras 1.1.0 and have used set_image_ordering to ‘th’ but not able to set image_data_format in this version keras. I think this is causing the causing the issue but am not able to resolve it
Any help is greatly appreciated.
Also I see that there are some changes to be done in code like updating all occurrences of www.platform.ai to files.fast.ai and few others. Is there any place where all these changes/updates are available at one place?
The data you are feeding into the model seems to have the channels last ordering where the network expects the channels first ordering. You can edit the dimensions of your data using numpy rollaxis or slicing.
As you pointed out there was some issue with channels ordering. Using backend.set_image_dim_ordering(‘th’) has to set it to correct channel ordering for theano but it din’t for some reason. I added dim_ordering to imageDatagenerator in vgg16.py script as shown below and it is working now
Thanks for your help.
I came across this issue also, but when I tried raghavab1992’s solution it didn’t work. Instead I had to set:
Yup, I ran into the same issue and had to change the data_format argument to channels_first as well.