Reputation: 141
The image has a shape of (512, 2048, 3)
but I get a ValueError when running preds_train = new_model.predict(img, batch_size=1)
:
ValueError: Could not find matching function to call loaded from the SavedModel. Got:
Positional arguments (3 total):
* Tensor("inputs:0", shape=(1, 2048, 3), dtype=float32)
* False
* None
Keyword arguments: {}
Expected these arguments to match one of the following 4 option(s):
Option 1:
Positional arguments (3 total):
* TensorSpec(shape=(None, 512, 2048, 3), dtype=tf.float32, name='inputs')
* True
* None
Keyword arguments: {}
Option 2:
Positional arguments (3 total):
* True
* None
Keyword arguments: {}
Option 3:
Positional arguments (3 total):
* TensorSpec(shape=(None, 512, 2048, 3), dtype=tf.float32, name='input_1')
* False
* None
Keyword arguments: {}
Option 4:
Positional arguments (3 total):
* TensorSpec(shape=(None, 512, 2048, 3), dtype=tf.float32, name='inputs')
* False
* None
Keyword arguments: {}
I've printed the initial dimensions of the shape so I'm sure it's (512, 2048, 3)
and additionally when i trained the model i did so using images of that shape. I don't know why I can't test the model.
Upvotes: 0
Views: 60
Reputation: 514
You probably need to reshape with one more dimension since your model is trained in that way, for example try this:
width,height,ch=img.shape
img_input=img.reshape((1,width,height,ch))
Upvotes: 0