Не работает setModelPath в ImageAi
Пытаюсь сделать туториал - https://medium.com/@guymodscientist/image-prediction-with-10-lines-of-code-3266f4039c7a Скачал файл(resnet50_weights_tf_dim_ordering_tf_kernels.h5) и положил в папку с кодом,однако уже на первом же куске кода возникли проблемы и при запуске кода:
from imageai.Prediction import ImagePrediction
import os
execution_path = os.getcwd()
prediction = ImagePrediction()
prediction.setModelTypeAsResNet()
prediction.setModelPath( execution_path + "\resnet50_weights_tf_dim_ordering_tf_kernels.h5")
prediction.loadModel()
возникает ошибка ValueError: .
ValueError: You have specified an incorrect path to the ResNet model file.
Я и провреял execution_path и даже попробовал в Google Collab,но все одно и тоже С чем может быть проблема?
Ответы (1 шт):
Автор решения: MaxU
→ Ссылка
воспользуйтесь os.path.join():
import os
model_path = os.path.join(os.getcwd(), "resnet50_weights_tf_dim_ordering_tf_kernels.h5")
prediction.setModelPath(model_path)