CNNGestureRecognizer icon indicating copy to clipboard operation
CNNGestureRecognizer copied to clipboard

Solution to the error : Negative dimension size caused by subtracting 3 from 1 for 'conv2d_2/convolution'

Open Tyler871203 opened this issue 5 years ago • 1 comments

I found the solution to this problem : When you initiate a convolution layer, the order of parameters of the input size should be (rows, cols, channel) but in your code gestureCNN.py, loadCNN, line 151 says that: model.add(Conv2D(nb_filters, (nb_conv, nb_conv), padding='valid', input_shape=(img_channels, img_rows, img_cols)))

so you should add a new parameter called "data_format" and set it to 'channels_first' like this :

model.add(Conv2D(nb_filters, (nb_conv, nb_conv), padding='valid',data_format='channels_first', input_shape=(img_channels, img_rows, img_cols)))

Tyler871203 avatar Aug 19 '20 06:08 Tyler871203

May I know which Tensorflow version are you using ?

asingh33 avatar Aug 20 '20 11:08 asingh33