I used the python code described in the tutorial “Train Image Recognition AI with 5 lines of code”. The training of my sample images worked fine but when I would like to do my first image recognition I receive the error message: ValueError: An error occured! Try again.
Attached please find the written code:
from imageai.Prediction.Custom import CustomImagePrediction
execution_path = os.getcwd()
prediction = CustomImagePrediction()
predictions, probabilities = prediction.predictImage(“test.jpg”, result_count=3)
for eachPrediction, eachProbability in zip(predictions, probabilities):
- print(eachPrediction , " : " , eachProbability)*
The error message appears when I try to run the line starting with “predictions, probabilities…”.
The error message points to the following code line:
File “C:\ProgramData\Anaconda3\Lib\site-packages\imageai\Prediction\Custom_init_.py”, line 547, in predictImage
raise ValueError(“An error occured! Try again.”)
ValueError: An error occured! Try again.
As this error message is very unspecific I would like to ask you what could be reason that my script doesn’t work? Thank you very much for your feedback!