pinas / model /preprocess_input.py
weryques's picture
Create skin pinas
347fd60
Raw History Blame Contribute Delete
409 Bytes
from PIL import Image
from tensorflow.keras.utils import img_to_array
from tensorflow.keras.applications import inception_resnet_v2
import numpy as np
def preprocess_image(image):
img = Image.open(image)
# converting image to array
x = img.resize((299, 299))
x = img_to_array(x)
# reshaping the image
x = np.expand_dims(x, axis=0)
return inception_resnet_v2.preprocess_input(x)