def preprocess_image(image_path): img = load_img(image_path, target_size=(im_height, im_width)) img = img_to_array(img) img = np.expand_dims(img, axis=0) img = vgg16.preprocess_input(img) return img