You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Help!! I can't predict my model because it's giving me the error: ValueError: Input 0 of layer dense_3 is incompatible with the layer: expected axis -1 of input shape to have value 100352 but received input with shape [None, 131072]
I just finished training a CNN using a ResNet50 architecture and a few top layers.
This is the code I used for creating the model...
base_model = ResNet50(weights = None, include_top=False, input_shape=(200, 200, 3))
x = base_model.output
x = Flatten()(x)
x = Dropout(0.2)(x)
x = Dense(32, activation='relu')(x)
x = Dense(16, activation='relu')(x)
predictions = Dense(num_class, activation='softmax')(x)
# The model to be trained
model = Model(inputs=base_model.input, outputs=predictions)
model.compile(loss='binary_crossentropy',
optimizer='rmsprop',
metrics=['accuracy'])
callbacks_list = [keras.callbacks.EarlyStopping(monitor='val_acc', verbose=1)]
model.summary()
As you can see, I only used a few layers on top of the ResNet50 architecture. I also used an image size input of 200, 200, 3
Went it calls back, this is the summary for the FLATTEN to the 2ND LAST DENSE LAYER.
The dense layer expects an input of shape 100,352 but instead it receives an input of 131,072!! Hence, the value error when running the predict code via...
img_path = 'train/10_right.jpeg'
img = image.load_img(img_path, target_size =(256,256))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
preds = model.predict(x)
The text was updated successfully, but these errors were encountered:
Help!! I can't predict my model because it's giving me the error:
ValueError: Input 0 of layer dense_3 is incompatible with the layer: expected axis -1 of input shape to have value 100352 but received input with shape [None, 131072]
I just finished training a CNN using a ResNet50 architecture and a few top layers.
This is the code I used for creating the model...
As you can see, I only used a few layers on top of the ResNet50 architecture. I also used an image size input of 200, 200, 3
Went it calls back, this is the summary for the FLATTEN to the 2ND LAST DENSE LAYER.
The dense layer expects an input of shape 100,352 but instead it receives an input of 131,072!! Hence, the value error when running the predict code via...
The text was updated successfully, but these errors were encountered: