Skip to content

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

@Tyler871203

Description

@Tyler871203

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)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions