Created
February 17, 2019 18:14
-
-
Save ocinpp/516feee33fcb372616972cece2841fb7 to your computer and use it in GitHub Desktop.
Dog Breed - InceptionV3 Predict
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
def extract_InceptionV3(tensor): | |
from keras.applications.inception_v3 import InceptionV3, preprocess_input | |
return InceptionV3(weights='imagenet', include_top=False).predict(preprocess_input(tensor)) | |
def InceptionV3_predict_breed(img_path): | |
# extract bottleneck features | |
bottleneck_feature = extract_InceptionV3(path_to_tensor(img_path)) | |
# obtain predicted vector | |
predicted_vector = InceptionV3_model.predict(bottleneck_feature) | |
# return dog breed that is predicted by the model | |
return dog_names[np.argmax(predicted_vector)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment