File size: 309 Bytes
7800904
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
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