我正在尝试在Colab上运行Mask-rcnn以进行金属缺陷检测(https://github.com/maxkferg/metal-defect-detection)。 colab的Keras版本是2.4.3,而库keras版本是2.1.3。在加载砝码时出现以下错误:
model.load_weights(model_path, by_name=True, exclude=EXCLUDE_LAYER_WEIGHTS):
AttributeError Traceback (most recent call last)
<ipython-input-2-a24cb8cfa577> in <module>()
----> 1 model.load_weights(model_path, by_name=True, exclude=EXCLUDE_LAYER_WEIGHTS)
/content/drive/My Drive/Colab Notebooks/metal-defect-detection/model.py in load_weights(self, filepath, by_name, exclude)
2030
2031 if by_name:
-> 2032 topology.load_weights_from_hdf5_group_by_name(f, layers)
2033
2034 else:
AttributeError: module 'keras.engine.topology' has no attribute 'load_weights_from_hdf5_group_by_name'
我尝试了一些在线建议的解决方案,例如:用保存替换拓扑,但是我有同样的问题。有一种方法可以更改代码,以便在keras 2.4.3中使用此类存储库?