Mask_RCNN icon indicating copy to clipboard operation
Mask_RCNN copied to clipboard

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

Open Meoooww opened this issue 3 years ago • 38 comments

image AttributeError: module 'keras.engine' has no attribute 'Layer' this error happened when i run the demo.ipynb

Meoooww avatar Mar 01 '22 17:03 Meoooww

i use the version of image

Meoooww avatar Mar 01 '22 17:03 Meoooww

I'm having the same problem aswell. I have downloaded the notebook inside my cloned repo but when I try running it's import section I get the same error. Hope this gets fixed soon.

Roboticol avatar Mar 07 '22 14:03 Roboticol

same problem, any help please

Isamalatby avatar Mar 08 '22 04:03 Isamalatby

pip install tensorflow==1.14.0 pip install keras==2.0.8

work for me!

auri99 avatar Mar 10 '22 15:03 auri99

it also work for me

Erwen222 avatar Mar 12 '22 03:03 Erwen222

i solve this problem. The reason for the error is that I did not install pycocotools. so stupid am i image

Meoooww avatar Mar 14 '22 06:03 Meoooww

https://github.com/akTwelve/Mask_RCNN use this repo to resolve the issue , without chaning any versions of keras and tensorflow .. And make sure to install pycocotools also . Thank You .

Harish-Tamarana avatar Mar 15 '22 06:03 Harish-Tamarana

i still not able to solve this problem even after installing pycocotools . please give me some solid solution

Aditya-180859 avatar Mar 26 '22 06:03 Aditya-180859

Update your repo to the recent release , i provided link in my comment

On Sat, 26 Mar 2022, 12:04 Aditya_180859, @.***> wrote:

i still not able to solve this problem even after installing pycocotools . please give me some solid solution

— Reply to this email directly, view it on GitHub https://github.com/matterport/Mask_RCNN/issues/2783#issuecomment-1079620759, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASHMFIPMWRY7XLU6TERZPX3VB2VV3ANCNFSM5PUXXATA . You are receiving this because you commented.Message ID: @.***>

Harish-Tamarana avatar Mar 26 '22 06:03 Harish-Tamarana

i updated everything still can't able to solve

Aditya-180859 avatar Mar 26 '22 06:03 Aditya-180859

Which version of tensorflow you are using?

On Sat, 26 Mar 2022, 12:15 Aditya_180859, @.***> wrote:

i updated everything still can't able to solve

— Reply to this email directly, view it on GitHub https://github.com/matterport/Mask_RCNN/issues/2783#issuecomment-1079622605, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASHMFIOK3NHF7EPUILLXGTDVB2XATANCNFSM5PUXXATA . You are receiving this because you commented.Message ID: @.***>

Harish-Tamarana avatar Mar 26 '22 08:03 Harish-Tamarana

2.8 .now what i have to do

Aditya-180859 avatar Mar 27 '22 11:03 Aditya-180859

same problem

Nazaroadi avatar Mar 31 '22 03:03 Nazaroadi

pip install tensorflow==1.14.0 pip install keras==2.0.8

work for me!

ERROR: Could not find a version that satisfies the requirement tensorflow==1.14.30 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2) ERROR: No matching distribution found for tensorflow==1.14.30

Hey2296 avatar May 08 '22 08:05 Hey2296

tf=2.8, same error. I think it's not caused by wrong version of keras. Do u find sloution?

Phoenix-QU avatar May 12 '22 16:05 Phoenix-QU

Same problem here. Tried the 'solutions' here, but they didn't work... Please help.

kurkadr avatar May 16 '22 19:05 kurkadr

Same problem here. Can't seem to find any working solution

ralfleistad avatar May 25 '22 15:05 ralfleistad

Tried all the possible solutions mentioned here but nothing worked

Shadin710 avatar Jun 14 '22 11:06 Shadin710

ERROR: Could not find a version that satisfies the requirement tensorflow==1.14.30 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2) ERROR: No matching distribution found for tensorflow==1.14.30

@Hey2296 Install via conda instead of pip might help. Try this:

conda install tensorflow==1.14.0

That worked for me. And since keras can be installed by pip, pip install keras==2.0.8 should work fine.

Criheacy avatar Jun 15 '22 17:06 Criheacy

I tried to change KE.Layer to be KE.base_layer.Layer and its work

novbuddy avatar Jun 16 '22 04:06 novbuddy

https://github.com/akTwelve/Mask_RCNN use this repo to resolve the issue , without chaning any versions of keras and tensorflow .. And make sure to install pycocotools also . Thank You .

Hey, it worked for me, I was trying to use an old project of my friend and Mask R-CNN files were not running with TensorFlow>=2.0, I installed the version of this repo and run "python setup.py install".

I'm using Windows 10, with Conda and Jupyter, and I ran this command inside the env I'm working with Mask R-CNN requirements.

If you gonna make any changes inside of Mask R-CNN model files, you need to run "python setup.py install" again, for changes take effect.

ty

JPVercosa avatar Aug 27 '22 13:08 JPVercosa

Update your repo to the recent release , i provided link in my comment On Sat, 26 Mar 2022, 12:04 Aditya_180859, @.> wrote: i still not able to solve this problem even after installing pycocotools . please give me some solid solution — Reply to this email directly, view it on GitHub <#2783 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASHMFIPMWRY7XLU6TERZPX3VB2VV3ANCNFSM5PUXXATA . You are receiving this because you commented.Message ID: @.>

Hi, thank you for sharing the new version Mask R-CNN code repo. I tried to run the demo code. But it gave me the Error in PredictCost() for the op: op: "CropAndResize". I searched it online, it seemed to be with the package version. I want to know if you had the same issue or not.

ice-tall-cold avatar Sep 28 '22 04:09 ice-tall-cold

i tried to change "KE.Layer" to "KL.Layer", and it work

RoboticsChen avatar Oct 26 '22 16:10 RoboticsChen

i tried to change "KE.Layer" to "KL.Layer", and it work

Thank you! I will try it.

ice-tall-cold avatar Oct 26 '22 16:10 ice-tall-cold

it was also suggested that: change KE.Layer to be KE.base_layer.Layer https://blog.csdn.net/qq_41413211/article/details/127562472?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22127562472%22%2C%22source%22%3A%22unlogin%22%7D

however, i gived up this code several weeks ago, so i didnt try the upon suggestion

Meoooww avatar Oct 27 '22 14:10 Meoooww

it was also suggested that: change KE.Layer to be KE.base_layer.Layer https://blog.csdn.net/qq_41413211/article/details/127562472?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22127562472%22%2C%22source%22%3A%22unlogin%22%7D

however, i gived up this code several weeks ago, so i didnt try the upon suggestion

Tried to change KE.Layer to KE.base_layer.Layer and it works. There's total 3 line to change in model.py

- class ProposalLayer(KE.base_layer.Layer): - class PyramidROIAlign(KE.base_layer.Layer): - class DetectionLayer(KE.base_layer.Layer):

Myst-Lee avatar Nov 09 '22 17:11 Myst-Lee

it was also suggested that: change KE.Layer to be KE.base_layer.Layer https://blog.csdn.net/qq_41413211/article/details/127562472?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22127562472%22%2C%22source%22%3A%22unlogin%22%7D however, i gived up this code several weeks ago, so i didnt try the upon suggestion

Tried to change KE.Layer to KE.base_layer.Layer and it works. There's total 3 line to change in model.py

- class ProposalLayer(KE.base_layer.Layer): - class PyramidROIAlign(KE.base_layer.Layer): - class DetectionLayer(KE.base_layer.Layer):

Good solution! Just to add modification of the DetectionTargetLayer class as well.

sara-knezevic avatar Nov 28 '22 14:11 sara-knezevic

i tried to change "KE.Layer" to "KL.Layer", and it work

This one work for me after install pip install pycocotools

xshalan avatar Dec 28 '22 01:12 xshalan

I tried to change KE.Layer to be KE.base_layer.Layer and its work Thank you and it works

1ntersection avatar Mar 05 '23 08:03 1ntersection

我尝试将 KE.Layer 更改为 KE.base_layer.Layer 及其工作 谢谢,它有效

换了之后不会出现新的错误吗

yxxxxxhh111 avatar Mar 12 '23 05:03 yxxxxxhh111