Skip to content

Instantly share code, notes, and snippets.

@OlafenwaMoses
Created June 28, 2019 15:38
Show Gist options
  • Save OlafenwaMoses/0654dab4e7b911d3d492115fd3852d37 to your computer and use it in GitHub Desktop.
Save OlafenwaMoses/0654dab4e7b911d3d492115fd3852d37 to your computer and use it in GitHub Desktop.
from imageai.Prediction.Custom import CustomImagePrediction
import os
predictor = CustomImagePrediction()
predictor.setModelPath(model_path="transfer_trained_fruits_model_ex-050_acc-0.862500.h5")
predictor.setJsonPath(model_json="model_class.json")
predictor.loadFullModel(num_objects=5)
prediction, probability = predictor.predictImage(image_input=os.path.join(os.getcwd(), "sample.jpg"), result_count=1)
print(prediction, " :", probability)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment