Retrain model failed after adding 1 new image

I tried to retrain my model after I uploaded 1 new image as training data.

Then I got this error:

Training model...
Training on 809 inputs, validating on 203 inputs
Traceback (most recent call last):
  File "/home/train.py", line 363, in <module>
    main_function()
  File "/home/train.py", line 184, in main_function
    model, override_mode, disable_per_channel_quantization = train_model(train_dataset, validation_dataset,
  File "/home/train.py", line 78, in train_model
    model.add(Reshape((rows, columns, channels), input_shape=(input_length, )))
  File "/app/keras/.venv/lib/python3.8/site-packages/tensorflow/python/training/tracking/base.py", line 530, in _method_wrapper
    result = method(self, *args, **kwargs)
  File "/app/keras/.venv/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 67, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/app/keras/.venv/lib/python3.8/site-packages/keras/layers/core/reshape.py", line 110, in _fix_unknown_dimension
    raise ValueError(msg)
ValueError: Exception encountered when calling layer "reshape" (type Reshape).

total size of new array must be unchanged, input_shape = [32], output_shape = [0, 32, 3]

Call arguments received:
  • inputs=tf.Tensor(shape=(None, 32), dtype=float32)
Application exited with code 1

My ID is: 79256

Hello!

Have you managed to retrain your model, I can see that the model has been trained properly on your project? Let me know.

Regards,

Louis

I do not know if it was retrained or not. I just got the error and it said that it failed to retrain it. So i’m guessing that it was not.

When I try to retain it now, I get the same error.

Ok thanks, I am having a deeper look now

Hello @andreas.bomholtz ,

You haven’t changed anything in your NN architecture? If I remove your first reshape layer, I can train successfully your NN.

Regards,

Louis

No, I have just tuned the model first. That is where the NN architecture comes from.

So should I just remove that layer and all should be good?

Yes, I tried to clone your project, remove the first layer (reshape) and I was able to train the model.
Let me know if you have any other questions.

Regards,

Louis