this is my model
model = tf.keras.models.Sequential([
tf.keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=(150, 150, 3)),
tf.keras.layers.MaxPooling2D(2, 2),
tf.keras.layers.Conv2D(64, (3,3), activation='relu'),
tf.keras.layers.MaxPooling2D(2,2),
tf.keras.layers.Conv2D(128, (3,3), activation='relu'),
tf.keras.layers.MaxPooling2D(2,2),
tf.keras.layers.Conv2D(256, (3,3), activation='relu'),
tf.keras.layers.MaxPooling2D(2,2),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(512, activation='relu'),
tf.keras.layers.Dense(1, activation='softmax') )
Model fit:
testing = model.fit(
train_generator,
steps_per_epoch=25,
epochs=20,
validation_data=validation_generator,
validation_steps=5,
verbose=1)
The error:
InvalidArgumentError: Matrix size-incompatible: In[0]: [32,3], In[1]: [512,1]
[[node gradient_tape/sequential/dense_1/MatMul (defined at <ipython-input-11-34d2a6f3254c>:7) ]] [Op:__inference_train_function_935]
Function call stack:
train_function
my training shape is 1312 images
i couldnt find the error Anyone could help me explain how to fix it?
Patch size is incorrect. Please go with the below discussion.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.