Skip to content

Instantly share code, notes, and snippets.

@OlafenwaMoses
Last active January 5, 2021 14:53
Show Gist options
  • Save OlafenwaMoses/60a0091fdefe48113d862fc5696f4e3b to your computer and use it in GitHub Desktop.
Save OlafenwaMoses/60a0091fdefe48113d862fc5696f4e3b to your computer and use it in GitHub Desktop.
from imageai.Classification import ImageClassification
import os
execution_path = os.getcwd()
prediction = ImageClassification()
prediction.setModelTypeAsResNet50()
prediction.setModelPath( execution_path + "\resnet50_imagenet_tf.2.0.h5")
prediction.loadModel()
predictions, percentage_probabilities = prediction.classifyImage("C:\Users\MyUser\Downloads\sample.jpg", result_count=5)
for index in range(len(predictions)):
print(predictions[index] , " : " , percentage_probabilities[index])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment