問題描述
運行命令
錯誤日志
Traceback (most recent call last):
File "./run.py", line 125, in <module>
model = get_unet()
File "./run.py", line 103, in get_unet
up6 = merge([UpSampling2D(size=(2, 2))(conv5), conv4], mode='concat', concat_axis=1)
TypeError: 'module' object is not callable
解決方法
安裝歷史版本 Keras 2.1.6 之前的版本。[ Releases ]
# pip install https://github.com/keras-team/keras/releases/tag/2.1.6
問題分析
1、根據錯誤日志,找不到模塊。
2、查看(搜索路徑下),是否真的沒有這個模塊。
>>> import sys
>>> print(sys.path)
3、看一下是否有Keras的安裝路徑下是否有merge.py這個模塊(文件)。
$ pip install keras
4、已經安裝了keras,在頭文件也是引入了 from keras.layers import merge
。但是為什么找不到呢?
5、確實也存在merge模塊(文件)
6、打開merge.py,發現並沒有merge()
函數,那自然就無法調用了。[Ref]