如何解决imageai库图像预测的Python Tensorflow错误``ImportError:没有名为'_pywrap_tensorflow_internal'的模块''
https://github.com/OlafenwaMoses/ImageAI(用于包装)
ImageAI具有简单的思想,支持一系列用于图像预测,自定义图像预测,对象检测,视频检测,视频对象跟踪和图像预测训练的最新机器学习算法。 ImageAI当前使用ImageNet-1000数据集上训练的4种不同的机器学习算法来支持图像预测和训练。 ImageAI还使用在COCO数据集上训练的RetinaNet,YOlov3和TinyYOlov3支持对象检测,视频检测和对象跟踪。最后,ImageAI允许您训练自定义模型以执行对新对象的检测和识别。
最终,ImageAI将为计算机视觉的更广泛,更专业的方面提供支持,包括但不限于特殊环境和特殊领域中的图像识别。
我正在尝试建立一个imageai项目,该项目可以对图像进行预测。但是我的代码给出了我不理解的错误
from imageai.Prediction import ImagePrediction
from tensorflow import *
import os
exe = os.getcwd()
prediction = ImagePrediction()
prediction.setModelTypeAsSqueezeNet()
prediction.setModelPath(os.path.join(exe,"squeezenet_weights_tf_dim_ordering_tf_kernels.h5"))
prediction.loadModel()
predictions,probabilities = prediction.predictimage(os.path.join(exe,"Cake.jpg"),result_count=10)
for eachPrediction,eachProbability in zip(predictions,probabilities):
print(eachPrediction," : ",eachProbability)
这是错误
Traceback (most recent call last):
File "C:\Users\Jezon Fernando\AppData\Local\Programs\Python\python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",line 18,in swig_import_helper
fp,pathname,description = imp.find_module('_pywrap_tensorflow_internal',[dirname(__file__)])
File "C:\Users\Jezon Fernando\AppData\Local\Programs\Python\python38-32\lib\imp.py",line 296,in find_module
raise ImportError(_ERR_MSG.format(name),name=name)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception,another exception occurred:
Traceback (most recent call last):
File "C:\Users\Jezon Fernando\AppData\Local\Programs\Python\python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",line 58,in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Jezon Fernando\AppData\Local\Programs\Python\python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",line 28,in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Jezon Fernando\AppData\Local\Programs\Python\python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",line 20,in swig_import_helper
import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception,another exception occurred:
Traceback (most recent call last):
File "C:/Users/Jezon Fernando/Desktop/Tutorials/PROGRAMING/PYTHON 3/AI/photo_recorgnizer.py",line 1,in <module>
from imageai.Prediction import ImagePrediction
File "C:\Users\Jezon Fernando\AppData\Local\Programs\Python\python38-32\lib\site-packages\imageai\Prediction\__init__.py",line 2,in <module>
from tensorflow.python.keras.preprocessing import image
File "C:\Users\Jezon Fernando\AppData\Local\Programs\Python\python38-32\lib\site-packages\tensorflow\__init__.py",line 24,in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Jezon Fernando\AppData\Local\Programs\Python\python38-32\lib\site-packages\tensorflow\python\__init__.py",line 49,in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Jezon Fernando\AppData\Local\Programs\Python\python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",line 74,in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Jezon Fernando\AppData\Local\Programs\Python\python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",in swig_import_helper
import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Process finished with exit code 1
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。