Closed tryinggo closed 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)
write whole directory name and before that just add r
ValueError: You have specified an incorrect path to the ResNet model file.