0

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.

2 Answers 2

2

Try using model.evaluate(x_test)

Sign up to request clarification or add additional context in comments.

Comments

0

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))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.