question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: 'module' object is not callable

See original GitHub issue

Version

DenseNet-Keras git:(master) ipython
Python 2.7.12 (default, Dec  4 2017, 14:50:18)
Type "copyright", "credits" or "license" for more information.

IPython 5.5.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import cv2

In [2]: import tensorflow as tf

In [3]: cv2.__version__
Out[3]: '2.4.13.6'

In [4]: tf.__version__
Out[4]: '1.4.0'

In [5]: import keras
Using TensorFlow backend.

In [6]: keras.__version__
Out[6]: '2.2.2'

DenseNet-Keras git:(master) ls -hl imagenet_models
total 33M
drwxrwxr-x 2 epbox epbox 4.0K 8月  30 15:08 .
drwxrwxr-x 5 epbox epbox 4.0K 8月  30 15:09 ..
-rw-r--r-- 1 epbox epbox  32M 8月  30 15:07 densenet121_weights_tf.h5
-rw-rw-r-- 1 epbox epbox   55 8月  30 14:40 README.md

Error

DenseNet-Keras git:(master) python test_inference.py
Using TensorFlow backend.
/home/epbox/Github/DenseNet-Keras/densenet121.py:45: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (7, 7), strides=(2, 2), use_bias=False, name="conv1")`
  x = Convolution2D(nb_filter, 7, 7, subsample=(2, 2), name='conv1', bias=False)(x)
2018-09-10 14:25:19.720132: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2018-09-10 14:25:19.821988: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:892] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-09-10 14:25:19.822306: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 0 with properties:
name: GeForce GTX TITAN X major: 5 minor: 2 memoryClockRate(GHz): 1.076
pciBusID: 0000:01:00.0
totalMemory: 11.92GiB freeMemory: 11.64GiB
2018-09-10 14:25:19.822322: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX TITAN X, pci bus id: 0000:01:00.0, compute capability: 5.2)
/home/epbox/Github/DenseNet-Keras/densenet121.py:99: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (1, 1), use_bias=False, name="conv2_1_x1")`
  x = Convolution2D(inter_channel, 1, 1, name=conv_name_base+'_x1', bias=False)(x)
/home/epbox/Github/DenseNet-Keras/densenet121.py:109: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), use_bias=False, name="conv2_1_x2")`
  x = Convolution2D(nb_filter, 3, 3, name=conv_name_base+'_x2', bias=False)(x)
Traceback (most recent call last):
  File "test_inference.py", line 34, in <module>
    model = DenseNet(reduction=0.5, classes=1000, weights_path=weights_path)
  File "/home/epbox/Github/DenseNet-Keras/densenet121.py", line 55, in DenseNet
    x, nb_filter = dense_block(x, stage, nb_layers[block_idx], nb_filter, growth_rate, dropout_rate=dropout_rate, weight_decay=weight_decay)
  File "/home/epbox/Github/DenseNet-Keras/densenet121.py", line 165, in dense_block
    concat_feat = merge([concat_feat, x], mode='concat', concat_axis=concat_axis, name='concat_'+str(stage)+'_'+str(branch))
TypeError: 'module' object is not callable

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

6reactions
YingXiuHecommented, Oct 16, 2018

i solved this problem via reinstalled the Keras to 2.0.5 version.

0reactions
bitscott1102commented, Jun 5, 2020

The latest version of Keras does not support concatenate Use this Lambda policy = Lambda(lambda x: x[0]-K.mean(x[0])+x[1], (NUM_ACTIONS,))([advantage, value])

hi, how to write the code? thanks.

Replace concatenate([concat_feat, x], mode='concat', axis=concat_axis, name='concat'+str(stage)+'_'+str(branch))

with policy = Lambda(lambda x: x[0]-K.mean(x[0])+x[1], (NUM_ACTIONS,))([advantage, value])(This is my code. ) https://www.tensorflow.org/api_docs/python/tf/keras/layers/Lambda

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: 'module' object is not callable - python
It says module object is not callable , because your code is calling a module object. A module object is the type of...
Read more >
TypeError 'module' object is not callable in Python
The error “TypeError: 'module' object is not callable” occurs when the python compiler gets confused between function name and module name and try...
Read more >
What is "typeerror: 'module' object is not callable"
This error statement TypeError: 'module' object is not callable is raised as you are being confused about the Class name and Module name....
Read more >
TypeError: module object is not callable [Python Error Solved]
To put it simply, the "TypeError: 'module' object is not callable" error means that modules cannot be called like functions or methods. How...
Read more >
TypeError module object is not callable
This error statement TypeError: 'module' object is not callable is raised as you are being confused about the Class name and Module name....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found