woraxe8641
woraxe8641

Reputation: 3

Can't import object detection imageai (python)

I installed imageai,tensorflow,keras in python with pip

i typed this code

from imageai.Detection import ObjectDetection

it shows this error

ModuleNotFoundError: No module named 'keras.layers.advanced_activations'

module versions
imageai - 2.0.2
keras - 2.90
tensorflow - 2.9.1

im running on windows 10 pro

Upvotes: 0

Views: 1774

Answers (2)

user11530462
user11530462

Reputation:

As imageai now uses Pytorch in backend, you must install a few library dependencies before installing imageai. Please refer to this link for the same.

pip install cython pillow>=7.0.0 numpy>=1.18.1 opencv-python>=4.1.2 torch>=1.9.0 --extra-index-url https://download.pytorch.org/whl/cpu torchvision>=0.10.0 --extra-index-url https://download.pytorch.org/whl/cpu pytest==7.1.3 tqdm==4.64.1 scipy>=1.7.3 matplotlib>=3.4.3 mock==4.0.3

pip install imageai --upgrade

Import the Object detection api from imageai

from imageai.Detection import ObjectDetection

Let us know if the issue still persists. Thank you.

Upvotes: 0

john_orge
john_orge

Reputation: 11

Try to update version of imageai to new versions. try this

Upvotes: 1

Related Questions