| 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 |