TypeError: ‘module’ object is not callable

Knowledge map advanced must read: read how large-scale map data efficient storage and retrieval>>>

[toc]

Problem description

Run command

Error log

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

Solutions

Install historical versions of keras before 2.1.6[ Releases ]

# pip install https://github.com/keras-team/keras/releases/tag/2.1.6

Problem analysis

1. According to the error log, the module was not found. 2. Check (under the search path) whether there is no such module

>>> import sys
>>> print(sys.path)

3. See if there is a merge.py module (file) in the installation path of keras

$ pip install keras

4. Keras has been installed and from keras.layers import merge has been introduced in the header file. But why not

5. The merge module (file) does exist

6. Open merge.py and find that there is no merge() function, so it will not be called[ Ref]

Similar Posts: