StepCOVNet icon indicating copy to clipboard operation
StepCOVNet copied to clipboard

Training Fails? Wrong shape?

Open nonlin opened this issue 1 year ago • 1 comments

Thought I'd try to test this project out. Being on Windows + Lack of windows tensorflow support has made it a challenge.

Using WSL2, I've managed to get far enough to do the training on the data set.

However I got a TypeError for 'image_shape' looks like its supposed to be 'input_shape' for the Conv2D inside model.py

input_shape=model_input.shape[1:],

However, while that error went away I get this now.

Starting training...
Epoch 1/15
2024-05-10 11:48:55.720494: W external/local_tsl/tsl/framework/cpu_allocator_impl.cc:83] Allocation of 154389504 exceeds 10% of free system memory.
2024-05-10 11:49:04.151717: W tensorflow/core/framework/op_kernel.cc:1827] INVALID_ARGUMENT: TypeError: `generator` yielded an element of shape (32, 2, 15, 80, 3) where an element of shape (None, 2, 15, 80, 1) was expected.
Traceback (most recent call last):

  File "/home/nonlin/miniconda3/envs/StepNet/lib/python3.10/site-packages/tensorflow/python/ops/script_ops.py", line 270, in __call__
    ret = func(*args)

  File "/home/nonlin/miniconda3/envs/StepNet/lib/python3.10/site-packages/tensorflow/python/autograph/impl/api.py", line 643, in wrapper
    return func(*args, **kwargs)

  File "/home/nonlin/miniconda3/envs/StepNet/lib/python3.10/site-packages/tensorflow/python/data/ops/from_generator_op.py", line 235, in generator_py_func
    raise TypeError(

TypeError: `generator` yielded an element of shape (32, 2, 15, 80, 3) where an element of shape (None, 2, 15, 80, 1) was expected.


Traceback (most recent call last):
  File "/mnt/c/Users/gerfe/StepCOVNet/train.py", line 166, in <module>
    train(
  File "/mnt/c/Users/gerfe/StepCOVNet/train.py", line 115, in train
    run_training(
  File "/mnt/c/Users/gerfe/StepCOVNet/train.py", line 61, in run_training
    executor.TrainingExecutor(stepcovnet_model=stepcovnet_model).execute(
  File "/mnt/c/Users/gerfe/StepCOVNet/stepcovnet/executor.py", line 111, in execute
    history = self.train(input_data, self.get_training_callbacks(hyperparameters))
  File "/mnt/c/Users/gerfe/StepCOVNet/stepcovnet/executor.py", line 191, in train
    history = self.stepcovnet_model.model.fit(
  File "/home/nonlin/miniconda3/envs/StepNet/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/home/nonlin/miniconda3/envs/StepNet/lib/python3.10/site-packages/tensorflow/python/eager/execute.py", line 53, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:

Detected at node PyFunc defined at (most recent call last):
<stack traces unavailable>
TypeError: `generator` yielded an element of shape (32, 2, 15, 80, 3) where an element of shape (None, 2, 15, 80, 1) was expected.
Traceback (most recent call last):

  File "/home/nonlin/miniconda3/envs/StepNet/lib/python3.10/site-packages/tensorflow/python/ops/script_ops.py", line 270, in __call__
    ret = func(*args)

  File "/home/nonlin/miniconda3/envs/StepNet/lib/python3.10/site-packages/tensorflow/python/autograph/impl/api.py", line 643, in wrapper
    return func(*args, **kwargs)

  File "/home/nonlin/miniconda3/envs/StepNet/lib/python3.10/site-packages/tensorflow/python/data/ops/from_generator_op.py", line 235, in generator_py_func
    raise TypeError(

TypeError: `generator` yielded an element of shape (32, 2, 15, 80, 3) where an element of shape (None, 2, 15, 80, 1) was expected.


         [[{{node PyFunc}}]]
         [[IteratorGetNext]] [Op:__inference_train_function_33834]

nonlin avatar May 10 '24 17:05 nonlin

Went ahead and tried to do this in Ubuntu and I got the same initial error in the models.py file For line 420...

Type error keyword argument. Not understood image shape.

nonlin avatar May 10 '24 21:05 nonlin