image_captioning / preprocess.py
maverick1729's picture
all files
7800904 verified
Raw History Blame Contribute Delete
309 Bytes
import tensorflow as tf
def preprocess_image(img):
img = tf.convert_to_tensor(img)
# img = tf.io.decode_jpeg(img, channels=3)
img = tf.keras.layers.Resizing(224, 224)(img)
img = tf.cast(img, tf.float32)
img = tf.keras.applications.efficientnet.preprocess_input(img)
return img