deep-learning-models icon indicating copy to clipboard operation
deep-learning-models copied to clipboard

Error negative dimension creating resnet50,

Open chuski92 opened this issue 7 years ago • 3 comments

Hello.

I have a problem while creating a resnet50 network. I used your script to create my network, but I have this error:

"ValueError: Negative dimension size caused by subtracting 7 from 3 for 'avg_pool/AvgPool' (op: 'AvgPool') with input shapes: [?,3,3,2048]."

The neural layers are the same that you use in your code, so I don't know what is the issue. I use tensorflow 1.3 and keras 2.0.6 in ubuntu using anaconda and spyder.

I have the same problem while creating GoogLeNet v1... I don't know what to do because I'm noob in deep learning.

Thank you very much.

chuski92 avatar Nov 12 '17 01:11 chuski92

Check the keras.json file If it has "channels first", the first layer of the model must have the input_shape as input_shape=(channels,img_rows, img_cols)

Otherwise the input shape must be input_shape=(img_rows, img_cols,channels)

This should solve the negative dimension error

vaibhav12345 avatar Dec 24 '17 14:12 vaibhav12345

hello vaibhav! thank you for your reply. I found the problem. It is about the size of the image and the number of the strides in maxpool and avgpool, if the image is too small the strides has to be small.

chuski92 avatar Dec 25 '17 13:12 chuski92