File size: 366 Bytes
e3800b0
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
import tensorflow as tf

def prep_image(image, img_shape=224):
    img = tf.keras.preprocessing.image.img_to_array(image)
    img = tf.image.resize(img, size=[img_shape, img_shape])
    # No need to normalize manually because EfficientNet models from TensorFlow Hub 
    # include a built-in rescaling layer that normalizes inputs to the range [0,1].
    return img