1

I tried to run matterport/MaskRCNN. Even though I've tried to change

import keras.engine as KE to import keras.engine.topology as KE

topology didn't work because topology module could not be resolved.

I've also tried

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

and install new by

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

it didn't work because tensorflow's version error.

I've researched through github discussion and stackflow. Can anyone help me to solve this problem?

AttributeError                            Traceback (most recent call last)
Cell In [2], line 16
     14 sys.path.append(ROOT_DIR)  # To find local version of the library
     15 from mrcnn import utils
---> 16 import mrcnn.model as modellib
     17 from mrcnn import visualize
     18 # Import COCO config

File c:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\mask_rcnn-2.1-py3.10.egg\mrcnn\model.py:255
    251     clipped.set_shape((clipped.shape[0], 4))
    252     return clipped
--> 255 class ProposalLayer(KE.Layer):
    256     """Receives anchor scores and selects a subset to pass as proposals
    257     to the second stage. Filtering is done based on anchor scores and
    258     non-max suppression to remove overlaps. It also applies bounding
   (...)
    267         Proposals in normalized coordinates [batch, rois, (y1, x1, y2, x2)]
    268     """
    270     def __init__(self, proposal_count, nms_threshold, config=None, **kwargs):

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

Thank you.

gyuegg
  • 11
  • 2

1 Answers1

1

Change "keras.engine as KE" to "keras.layers as KE"

Daniel Wu
  • 31
  • 5
  • This is a good answer. A friendly suggestion would be to highlight code snippets in "`" characters for a single line or "```" for code blocks. It makes them stand out a little better for reading. – Shmack Dec 03 '22 at 07:59