I'm passing a Numpy array, image, to 'process_image'. It is then processed, turned into a TensorSpec object with the dimensions and dtype required by the Tensorflow Hub model.
def image_preprocessing(image):
img = tf.convert_to_tensor(image, dtype=tf.float32)
img = tf.expand_dims(img, 0)
return tf.TensorSpec.from_tensor(img)
def process_image(image):
img = image_preprocessing(image)
model = generate_model()
hr_img = model(img, True)
return hr_img[0]
img: TensorSpec(shape=(1, 480, 640, 3), dtype=tf.float32, name=None)
The model is loaded from Tensorflow Hub;
import tensorflow_hub as hub
def generate_model():
SAVED_MODEL = 'https://tfhub.dev/captain-pool/esrgan-tf2/1'
model = hub.load(SAVED_MODEL)
return model
I then get this error code;
ValueError: Signature specifies 343 arguments, got: 342.
I've tried adding an additional argument (True), however it shows the exact same error as when I called model(img).
Would be thankful for any ideas.