Home > Software design >  AttributeError using mrcnn package in python
AttributeError using mrcnn package in python

Time:01-08

I am trying to use Masked RCNN in Python through mrcnn package but I'm getting errors.

I'm using Keras 2.0.8 and Tensorflow 1.13.1 But, no luck so far.

Here's the code I've written

from mrcnn.config import Config
from mrcnn import model as modellib, utils
from mrcnn import visualize

While trying to import the above, I'm facing this error:

AttributeError: module 'keras.engine' has no attribute 'Layer'

Error Image

CodePudding user response:

Check the versions of the libraries:

import tensorflow
tensorflow.__version__

If tensorflow, keras, h5py are not

tensorflow==1.13.1
keras==2.0.8
h5py==2.10.0

do this. This worked for me to solve this issue:

pip uninstall keras -y
pip uninstall keras-nightly -y
pip uninstall keras-Preprocessing -y
pip uninstall keras-vis -y
pip uninstall tensorflow -y
pip uninstall h5py -y

Then reinstall keras and tensorflow:

pip install tensorflow==1.13.1
pip install keras==2.0.8
pip install h5py==2.10.0

Remember that if you are on jupyter notebook, then

!pip install tensorflow==1.13.1
!pip install keras==2.0.8
!pip install h5py==2.10.0
  •  Tags:  
  • Related