I have the following code for classifying images that are 64 by 64 and in grayscale

_______________________________________________________________

# Initialising

cnn_classifier = Sequential()

# 1st conv. layer

cnn_classifier.add(Conv2D(32, (3, 1), input_shape = (64, 64,1), activation = 'relu')) # 64 by 64 grayscale image

cnn_classifier.add(MaxPooling2D(pool_size = (2, 2)))

# 2nd conv. layer

cnn_classifier.add(Conv2D(50, (5, 1), activation = 'relu')) #no need to specify the input shape

cnn_classifier.add(MaxPooling2D(pool_size = (2, 2)))

# 3nd conv. layer

cnn_classifier.add(Conv2D(80, (5, 3), activation = 'relu')) #no need to specify the input shape

cnn_classifier.add(MaxPooling2D(pool_size = (2, 2)))

cnn_classifier.add(Dropout(0.25))

# Flattening

cnn_classifier.add(Flatten())

# Full connection

cnn_classifier.add(Dense(units = 512, activation = 'relu'))

cnn_classifier.add(Dropout(0.5)) # quite aggresive dropout, maybe reduce

cnn_classifier.add(Dense(units = 3, activation = 'softmax'))

cnn_classifier.summary()

___________________________________________________________

on running it in python it gives the error

StopIteration: could not broadcast input array from shape (64,64,3) into shape (64,64,1,3)

yet from the code I have declared the image as ( 64,64,1 )

Similar questions and discussions