Can't import object detection imageai (python) - 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

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

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.

Related

ImportError: cannot import name 'DecisionBoundaryDisplay' from 'sklearn.inspection'

I imported sklearn DecisionBoundaryDisplay via the below command in my Google Colab file.
from sklearn.inspection import DecisionBoundaryDisplay
And I'm getting the following error.
ImportError: cannot import name 'DecisionBoundaryDisplay' from 'sklearn.inspection'
I even installed the following packages & also tried by restarting my runtime but still I'm getting the error.
!pip install --upgrade scikit-learn
!pip install scipy
!pip3 install -U scikit-learn scipy matplotlib
How to fix this issue?
what worked for me was installing scikit learn 1.1.0, i had version 1.0.2 before and got the same error you're encountering.
pip install -U scikit-learn --user
Hope it helps.
It seems DecisionBoundaryDisplay is a new feature and it is currently in an unstable development version. To use it, you need to install the nightly build.

module 'keras.api._v2.keras.experimental' has no attribute 'PeepholeLSTMCell'

I tried to install tensorflow_federated in google colab. I used
pip install --quiet tensorflow-federated-nightly
import tensorflow-federated as tff
and it worked. but now when I try to import it get this error:
AttributeError: module 'keras.api._v2.keras.experimental' has no attribute 'PeepholeLSTMCell'
I don't know why I get this error, because I didn't have any problem before.
I also used the following code to install tensorflow-federated:
pip install --upgrade tensorflow-federated-nightly
but I get the same error.
How do I fix it?
My versions are:
tensorflow 2.8.0,
keras 2.8.0,
tensorflow-federated-nightly 0.19.0.dev20220218
To use TensorFlow Federated with TensorFlow 2.8.0, please try the newly released version of TFF 0.20.0 pypi, github.
The tensorflow-federated-nightly package depends on the nightly versions of TensorFlow (tf-nightly), Keras (keras-nightly) and so on.

Why aren't transformers imported in Python?

I want to import transformers in jupyter notebook but I get the following error. What is the reason for this error? My Python version is 3.8
ImportError: cannot import name 'TypeAlias' from 'typing_extensions'
I also updated the typing-extensions library version, but the problem was not resolved
You could try
pip install typing-extensions --upgrade
maybe the probelm is the version of datasets package:
pip install datasets==1.15
TypeAlias is available from python version 3.10.
You should upgrade your python version to avoid the error.

cannot import name '_pywrap_utils' from 'tensorflow.python'

I am working on pose estimation using OpenPose. For that I installed TensorFlow GPU and installed all the requirements including CUDA development kit.
While running the Python script:
C:\Users\abhi\Anaconda3\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py, I encountered the following error:
ImportError: cannot import name '_pywrap_utils' from
'tensorflow.python'
(C:\Users\abhi\Anaconda3\lib\site-packages\tensorflow\python__init__.py)
I tried searching for _pywrap_utils file but there was no such file.
Try pip3 install pywrap and pip3 install tensorflow pywrap utils should be included with tensorflow. If it is not found, that means TF was not installed correctly.

please upgrade your tensorflow 1.4 error comes up but TF 1.4 already installed

I'm trying to run object detection API's object_detection_tutorial.ipynb and I was able to run it before and i trained some simple models for object detection. I think broke my installation. I'm using Anaconda+Windows and Tensorflow 1.4 installed on an environment called "neuralnets" here is pip list of this environment:
pip list
error:
error
if in your Python console you type:
import tensorflow as tf
tf.__Version__
What do you get? just to make sure try to reinstall with the --ignore-installed flag:
pip install --ignore-installed tensorflow=1.4

Categories

Resources