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 (将#修改为@)