Skip to content

Instantly share code, notes, and snippets.

@ocinpp
Created February 17, 2019 18:14
Show Gist options
  • Save ocinpp/516feee33fcb372616972cece2841fb7 to your computer and use it in GitHub Desktop.
Save ocinpp/516feee33fcb372616972cece2841fb7 to your computer and use it in GitHub Desktop.
Dog Breed - InceptionV3 Predict
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