Failed to create interface using TF Hub loaded model

Hello,

I am trying to run object detection script from below link using saved trained model.
link - 이미지 분류자 다시 훈련하기  |  TensorFlow Hub

I have used “efficientnetv2-xl-21k-ft1k” pre-trained model for training.

object detection script not allowing to use image with resolution other than 512*512 and datatype other that float32 while reshaping.
Is there any way to use image with any resolution as well as any of the data type?

I got below error :
Code :-

running inference

results = hub_model(image_np)
print(results)
result = {key:value.numpy() for key,value in results.items()}
print(result.keys())

Error : -

ValueError Traceback (most recent call last)
in <cell line: 2>()
1 # running inference
----> 2 results = hub_model(image_np)
3 print(results)
4
5 # different object detection models have additional results

2 frames
/usr/local/lib/python3.10/dist-packages/tensorflow/python/saved_model/function_deserialization.py in restored_function_body(*args, **kwargs)
333 “Option {}:\n {}\n Keyword arguments: {}”.format(
334 index + 1, _pretty_format_positional(positional), keyword))
→ 335 raise ValueError(
336 "Could not find matching concrete function to call loaded from the "
337 f"SavedModel. Got:\n {_pretty_format_positional(args)}\n Keyword "

ValueError: Could not find matching concrete function to call loaded from the SavedModel. Got:
Positional arguments (3 total):
* <tf.Tensor ‘inputs:0’ shape=(1, 2769, 1698, 3) dtype=uint8>
* False
* None
Keyword arguments: {}

Expected these arguments to match one of the following 2 option(s):

Option 1:
Positional arguments (3 total):
* TensorSpec(shape=(None, 512, 512, 3), dtype=tf.float32, name=‘input_1’)
* True
* None
Keyword arguments: {}

Option 2:
Positional arguments (3 total):
* TensorSpec(shape=(None, 512, 512, 3), dtype=tf.float32, name=‘input_1’)
* False
* None
Keyword arguments: {}

Hi @Tanvi, By looking at the error I suspect that there is a shape mismatch between the model input define and the input you are passing. Could you please make sure that both the shapes are the same or not. If you are still facing the issue even after passing the correct data shape please provide the stand alone code to reproduce the issue. Thank you.