NameError: name 'KE' is not defined

NameError: name 'KE' is not defined

我正在学习本教程:https://blog.paperspace.com/mask-r-cnn-in-tensorflow-2-0/ 以训练用于对象检测的自定义数据集。当我 运行 训练代码(在段落:“Train Mask R-CNN in TensorFlow 1.0”下)时,我在 colab 上收到此错误:

NameError                                 Traceback (most recent call last)
<ipython-input-31-794112aa6465> in <module>()
      6 import mrcnn.config
      7 
----> 8 import mrcnn.model
      9 
     10 class KangarooDataset(mrcnn.utils.Dataset):

/content/drive/MyDrive/How_to_Train_an_Object_Detection_Model_with_Keras/Mask_RCNN/mrcnn/model.py in <module>()
    255 
    256 
--> 257 class ProposalLayer(KE.Layer):
    258     """Receives anchor scores and selects a subset to pass as proposals
    259     to the second stage. Filtering is done based on anchor scores and

NameError: name 'KE' is not defined

搜索后,我尝试检查 RCNN 是否可以:Import Matterport's Mask-RCNN model from github - error:ZipImportError: bad local file header with the solution that the guy in the end suggests. I have also found this: NameError: name 'K' is not defined 所以我尝试了这个命令:

from keras import backend as KE

(而不是 K,我输入了 KE)但是没有用!

您知道如何修复该错误吗?

好的,我尝试了这个 github 存储库而不是原来的 MaskRCNN:https://github.com/akTwelve/Mask_RCNN 在 colab 上安装了最新的 tensorflow (2.7.0) + Keras (2.7.0)。好像解决了我上面描述的问题。。。不知道为什么。。!