Mask_rcnn: module 'keras.engine.topology' has no attribute 'load_weights_from_hdf5_group_by_name'

Created on 18 Jun 2018  Â·  17Comments  Â·  Source: matterport/Mask_RCNN

hi everybody
I want to use Mask-RCNN demo.py in my jupyter notebook but when i ran the the demo code in part of Create Model and Load Trained Weights i faced with such problem

AttributeError Traceback (most recent call last)
in ()
3
4 # Load weights trained on MS-COCO
----> 5 model.load_weights(COCO_MODEL_PATH, by_name=True)

~/Downloads/Mask_RCNN/mrcnn/model.py in load_weights(self, filepath, by_name, exclude)
2117
2118 if by_name:
-> 2119 topology.load_weights_from_hdf5_group_by_name(f, layers)
2120 else:
2121 topology.load_weights_from_hdf5_group(f, layers)

AttributeError: module 'keras.engine.topology' has no attribute 'load_weights_from_hdf5_group_by_name'

please help me

Most helpful comment

@JulienDufour @farzadzare A better solution
You need to clean your build dir first.
Then mrcnn/model.py, replace the "topology" with "saving".
Then run python3 setup.py install

All 17 comments

Hi,

Try to re install Keras 2.1.6 instead of the last version (i.e., 2.2.0).

pip install 'keras==2.1.6' --force-reinstall

@JulienDufour Do you know why this will happen on the lastest Keras? Too strange

@JulienDufour @farzadzare A better solution
You need to clean your build dir first.
Then mrcnn/model.py, replace the "topology" with "saving".
Then run python3 setup.py install

Same error here.

@hadim Look my comments. I have given the solution.

Thanks @engineer1109 ! Just replace toppology by saving works for me.

@engineer1109 can you describe in detail,do you mean replace the 'topology' with 'saving' in model.py??

@hadim @csq20081052 You can follow this pull request #662 to solve your problem. You just need to change 'topology' with 'saving' in model.py as shown in the referenced pull request.

@engrchrishenry thx, I haved solved this problem.

Thanks @engineer1109, Your suggestion is awesome

Thanks @roobooot

Hi, I want to know the meaning of "You need to clean your build dir first.". I try to solve the problem by replacing "toppology"by "saving", but it has the same problem as before. I think the problem is I haven't do it correctly with "You need to clean your build dir first." @engineer1109

@JulienDufour What version of tensorflow are you using with keras 2.1.6 ?

For m it still gives the same error of module 'keras.engine.topology' has no attribute 'load_weights_from_hdf5_group_by_name' even after replacin wih saving. How is hat happening?

@JulienDufour @farzadzare A better solution
You need to clean your build dir first.
Then mrcnn/model.py, replace the "topology" with "saving".
Then run python3 setup.py install

Yaa it works for me too. Thanks a lot.

For m it still gives the same error of module 'keras.engine.topology' has no attribute 'load_weights_from_hdf5_group_by_name' even after replacin wih saving. How is hat happening?

same problem.. following

Was this page helpful?
0 / 5 - 0 ratings

Related issues

msson picture msson  Â·  4Comments

LifeBeyondExpectations picture LifeBeyondExpectations  Â·  4Comments

chrispolo picture chrispolo  Â·  4Comments

JonathanCMitchell picture JonathanCMitchell  Â·  3Comments

Mabinogiysk picture Mabinogiysk  Â·  3Comments