I get error in epoch line

IM_SIZE = 224
lenet_model = tf.keras.Sequential([
InputLayer(input_shape = (IM_SIZE,IM_SIZE, 3)),

Conv2D(filters = 6 , kernel_size = 5, strides=1, padding = 'valid', activation = 'relu' ),
BatchNormalization(),
MaxPool2D (pool_size = 2, strides=2),

Conv2D(filters = 16 , kernel_size = 3, strides=1, padding = 'valid', activation = 'relu' ),
BatchNormalization(),
MaxPool2D (pool_size = 2, strides=2),

Flatten(),
Dense(100,activation = 'relu'),
BatchNormalization(),
Dense(10,activation = 'relu'),
BatchNormalization(),
Dense(1,activation = 'sigmoid'),

])
lenet_model.summary()

y_true = [0,1,0,0]

y_pred = [0.6,0.51,0.94,1]

bce = tf.keras.losses.BinaryCrossentropy()

bce(y_true, y_pred)

lenet_model.compile(optimizer = Adam(learning_rate = 0.01),
loss = BinaryCrossentropy(),
metrics = ‘accuracy’)

history = lenet_model.fit(train_dataset,validation_data = val_dataset, epochs = 20, verbose=1)

ValueError Traceback (most recent call last)
in <cell line: 1>()
----> 1 history = lenet_model.fit(train_dataset,validation_data = val_dataset, epochs = 20, verbose=1)

1 frames
/usr/local/lib/python3.10/dist-packages/keras/src/engine/training.py in tf__train_function(iterator)
13 try:
14 do_return = True
—> 15 retval_ = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
16 except:
17 do_return = False

ValueError: in user code:

File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training.py", line 1401, in train_function  *
    return step_function(self, iterator)
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training.py", line 1384, in step_function  **
    outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training.py", line 1373, in run_step  **
    outputs = model.train_step(data)
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training.py", line 1150, in train_step
    y_pred = self(x, training=True)

File “/usr/local/lib/python3.10/dist-packages/keras/src/utils/traceback_utils.py”, line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File “/usr/local/lib/python3.10/dist-packages/keras/src/engine/input_spec.py”, line 298, in assert_input_compatibility
raise ValueError(

ValueError: Input 0 of layer "sequential_6" is incompatible with the layer: expected shape=(None, 224, 224, 3), found shape=(None, None, 224, 224, 3)

You need to reshape your input dataset

this is essential info

The error message you’re encountering, particularly the ValueError related to the input layer’s compatibility, suggests that there’s a mismatch between the shape of the data provided to your model and the expected input shape defined in the model architecture. This kind of issue is common in deep learning and can usually be resolved by ensuring consistency between your dataset and the model’s expected input format.