Created
May 2, 2018 16:28
-
-
Save FavioVazquez/a02094a5848ab1f7e42ce52820a09fbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.applications import InceptionV3 | |
from sparkdl.udf.keras_image_model import registerKerasImageUDF | |
def keras_load_img(fpath): | |
from keras.preprocessing.image import load_img, img_to_array | |
import numpy as np | |
img = load_img(fpath, target_size=(299, 299)) | |
return img_to_array(img).astype(np.uint8) | |
registerKerasImageUDF("inceptionV3_udf_with_preprocessing", InceptionV3(weights="imagenet"), keras_load_img) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment