I have written a code in VSCode using tensorflow library that trains a model to detect road lanes. I have used the Road Line and Marking Dataset for training. It worked perfectly fine in VS Code but I wanted to transition to colab to make it faster. I am getting a lot of value errors like this:
ValueError Traceback (most recent call last)
in <cell line: 126>()
124
125 # Training loop
–> 126 detect = model.fit(
127 load_dataset_batch(extracted_trains_folder, extracted_labels_folder, batch_size),
128 steps_per_epoch=steps_per_epoch,
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 253, in assert_input_compatibility
raise ValueError(
ValueError: Exception encountered when calling layer 'sequential_15' (type Sequential).
Input 0 of layer "conv2d_105" is incompatible with the layer: expected min_ndim=4, found ndim=1. Full shape received: (None,)
Call arguments received by layer 'sequential_15' (type Sequential):
• inputs=tf.Tensor(shape=(None,), dtype=float32)
• training=True
• mask=None
I tried debugging the code, but it didn’t help me much.