简体   繁体   中英

AttributeError using mrcnn package in python

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'

错误图像

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

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