File size: 297 Bytes
c9dcefe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import cv2
import numpy as np
import tensorflow as tf
IMG_SIZE = 224
def preprocess(image):
image = cv2.resize(image, (IMG_SIZE, IMG_SIZE))
image = tf.keras.applications.mobilenet_v2.preprocess_input(image)
image = np.expand_dims(image, axis=0)
return image |