OlafenwaMoses / ImageAI

A python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities
https://www.genxr.co/#products
MIT License
8.55k stars 2.19k forks source link

BugCustomPrediction #170

Closed tryinggo closed 5 years ago

tryinggo commented 5 years ago

ValueError: You have specified an incorrect path to the ResNet model file.

tryinggo commented 5 years ago

from imageai.Prediction.Custom import CustomImagePrediction import os execution_path = os.getcwd()

prediction = CustomImagePrediction() prediction.setModelTypeAsResNet() prediction.setModelPath(os.path.join(execution_path, "model_ex-010_acc-0.605000.h5"))#("img\models\model_ex-010_acc-0.605000.h5") prediction.setJsonPath(os.path.join(execution_path, "model_class.json"))#( "img\json\model_class.json") prediction.loadModel(num_objects=5)

predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "img/test/cup/_425.jpg"),result_count = 5)#( "img/test/cup/_425.jpg", result_count=5)

for eachPrediction, eachProbability in zip(predictions, probabilities): print(eachPrediction + " : " + eachProbability)

anchu-simplecrm commented 5 years ago

write whole directory name and before that just add r