The following code snippet is used to pre-process the images according to the Inceptionv3 model.
def load_image(image_path,cap):
img = tf.io.read_file(image_path)
img = tf.image.decode_jpeg(img, channels=3)
img = tf.image.resize(img, (299, 299))
img = tf.keras.applications.inception_v3.preprocess_input(img)
return img, cap
In the tensorflow documentation for tf.keras.applications.inception_v3.preprocess_input it is given that the x argument (img) here needs to be in the range of [0,255]
I suggest the following code snippet instead
def load_image(image_path,cap):
img = tf.io.read_file(image_path)
img = tf.image.decode_jpeg(img, channels=3)
img = tf.image.resize(img, (299, 299))
img = img * 255.0
img = tf.keras.applications.inception_v3.preprocess_input(img)
return img, cap