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)
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
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
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