掩码RCNN,属性错误:模块“keras.engine”没有属性“Layer

vsikbqxv  于 2022-12-04  发布在  其他
关注(0)|答案(1)|浏览(281)

我试着经营Matterport/MaskRCNN。尽管我试着改变
import keras.engine as KEimport keras.engine.topology as KE
拓扑不起作用,因为无法解析拓扑拈
我也试过

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

并安装新的

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

因为tensorflow版本错误,所以它没有工作
我已经通过github讨论和stackflow进行了研究。有人能帮我解决这个问题吗?

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'
  • 谢谢-谢谢
14ifxucb

14ifxucb1#

将“KERAS.engine as KE”更改为“KERAS.layers as KE”

相关问题