简体   繁体   中英

ModuleNotFoundError: No module named 'imageai'

I am tring to install the object detection or imageai for python in Pycharm. I did all the installation method but this shows me the error ModuleNotFoundError: No module named 'imageai'


This is my code

from imageai.Prediction import ImagePrediction
import os
execution_path = os.getcwd()


prediction = ImagePrediction()
prediction.setModelTypeAsResNet()
prediction.setModelPath(os.path.join(execution_path, "resnet50_weights_tf_dim_ordering_tf_kernels.h5"))
prediction.loadModel()


predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "1.jpg"), result_count=5 )
for eachPrediction, eachProbability in zip(predictions, probabilities):
    print(eachPrediction , " : " , eachProbability)

What do I need to do to fix it? I am new to python please help me.


the output

 Traceback (most recent call last):
  File "C:/Python37/files/FirstPrediction/FirstPrediction.py", line 1, in <module>
    from imageai.Prediction import ImagePrediction
ModuleNotFoundError: No module named 'imageai'

C:\Users\משתמש>pip show imageai
Name: imageai
Version: 2.0.2
Summary: A flexible Computer Vision and Deep Learning library for applications and systems.
Home-page: https://moses.specpal.science
Author: Moses Olafenwa and John Olafenwa
Author-email: UNKNOWN
License: MIT
Location: c:\python37\lib\site-packages
Requires:
Required-by:

C:\Users\משתמש>pip -V
pip 18.1 from c:\python37\lib\site-packages\pip (python 3.7)

Your First need to download this ImageAI whl file and from here. https://github.com/OlafenwaMoses/ImageAI/releases/download/2.0.2/imageai-2.0.2-py3-none-any.whl

Run following

pip install imageai-2.0.2-py3-none-any.whl

Terensflow 不支持 Python 3.7 需要下载 python 3.6 卸载 python 3.7 并全部安装 python 3.6

另外,还可以从PyPI中直接安装ImageAI

pip3 install imageai --upgrade
python -m pip install --upgrade pip

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM