Hi Im new to Stack overflow. Im having trouble with my code, I was at model.fit() and when I entered a value at the epochs and ran the code I got an error. Here is the code for the model.fit:
model.fit( train_ds, validation_data = valid_ds, epochs = 10 )
and below here is the error I got:
ValueError Traceback (most recent call last) in () 2 train_ds, 3 validation_data = valid_ds, ----> 4 epochs = 10 5 )
1 frames /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs) 1145 except Exception as e: # pylint:disable=broad-except 1146 if hasattr(e, "ag_error_metadata"): -> 1147 raise e.ag_error_metadata.to_exception(e) 1148 else: 1149 raise
ValueError: in user code:
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1021, in train_function *
return step_function(self, iterator)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1010, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1000, in run_step **
outputs = model.train_step(data)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 859, in train_step
y_pred = self(x, training=True)
File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.7/dist-packages/keras/layers/convolutional.py", line 305, in compute_output_shape
f'One of the dimensions in the output is <= 0 '
ValueError: Exception encountered when calling layer "sequential_3" (type Sequential).
One of the dimensions in the output is <= 0 due to downsampling in conv2d_280. Consider increasing the input size. Received input shape [None, 32, 32, 3] which would produce output shape with a zero or negative value in a dimension.
Call arguments received:
• inputs=tf.Tensor(shape=(None, 32, 32, 3), dtype=float32)
• training=True
• mask=None
Can someone assist me with this? Thanks in advance
CodePudding user response:
Probably you need to upscale the size of your image which you are feeding into the CNN. 360x360x3 is a standard one. Your image size is too small, hence it is not able to build the model fully.
CodePudding user response:
***Probably you need to upscale the size of your image which you are feeding into the CNN. 360x360x3 is a standard one. Your image size is too small, hence it is not able to build the model fully.