Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'module' object is not callable #16

Open
baiboat opened this issue Nov 9, 2019 · 0 comments
Open

TypeError: 'module' object is not callable #16

baiboat opened this issue Nov 9, 2019 · 0 comments

Comments

@baiboat
Copy link

baiboat commented Nov 9, 2019

环境版本与要求一致,运行python videotest_example.py hy.mp4,提示:
Using TensorFlow backend.
../ssd.py:40: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="relu", name="conv1_1", padding="same")
name='conv1_1')(net['input'])
../ssd.py:44: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="relu", name="conv1_2", padding="same")
name='conv1_2')(net['conv1_1'])
../ssd.py:46: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool1", padding="same")
name='pool1')(net['conv1_2'])
../ssd.py:51: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (3, 3), activation="relu", name="conv2_1", padding="same")
name='conv2_1')(net['pool1'])
../ssd.py:55: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (3, 3), activation="relu", name="conv2_2", padding="same")
name='conv2_2')(net['conv2_1'])
../ssd.py:57: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool2", padding="same")
name='pool2')(net['conv2_2'])
../ssd.py:62: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_1", padding="same")
name='conv3_1')(net['pool2'])
../ssd.py:66: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_2", padding="same")
name='conv3_2')(net['conv3_1'])
../ssd.py:70: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_3", padding="same")
name='conv3_3')(net['conv3_2'])
../ssd.py:72: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool3", padding="same")
name='pool3')(net['conv3_3'])
../ssd.py:77: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_1", padding="same")
name='conv4_1')(net['pool3'])
../ssd.py:81: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_2", padding="same")
name='conv4_2')(net['conv4_1'])
../ssd.py:85: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_3", padding="same")
name='conv4_3')(net['conv4_2'])
../ssd.py:87: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool4", padding="same")
name='pool4')(net['conv4_3'])
../ssd.py:92: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_1", padding="same")
name='conv5_1')(net['pool4'])
../ssd.py:96: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_2", padding="same")
name='conv5_2')(net['conv5_1'])
../ssd.py:100: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_3", padding="same")
name='conv5_3')(net['conv5_2'])
../ssd.py:102: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((3, 3), strides=(1, 1), name="pool5", padding="same")
name='pool5')(net['conv5_3'])
/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/legacy/layers.py:301: UserWarning: The AtrousConvolution2D layer has been deprecated. Use instead the Conv2D layer with the dilation_rate argument.
warnings.warn('The AtrousConvolution2D layer '
/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/legacy/layers.py:305: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(1024, (3, 3), activation="relu", name="fc6", dilation_rate=(6, 6), padding="same")
return Conv2D(*args, **kwargs)
../ssd.py:110: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(1024, (1, 1), activation="relu", name="fc7", padding="same")
border_mode='same', name='fc7')(net['fc6'])
../ssd.py:115: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (1, 1), activation="relu", name="conv6_1", padding="same")
name='conv6_1')(net['fc7'])
../ssd.py:118: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv6_2", strides=(2, 2), padding="same")
name='conv6_2')(net['conv6_1'])
../ssd.py:122: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (1, 1), activation="relu", name="conv7_1", padding="same")
name='conv7_1')(net['conv6_2'])
../ssd.py:126: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv7_2", strides=(2, 2), padding="valid")
name='conv7_2')(net['conv7_2'])
../ssd.py:130: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (1, 1), activation="relu", name="conv8_1", padding="same")
name='conv8_1')(net['conv7_2'])
../ssd.py:133: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv8_2", strides=(2, 2), padding="same")
name='conv8_2')(net['conv8_1'])
../ssd.py:140: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(12, (3, 3), name="conv4_3_norm_mbox_loc", padding="same")
name='conv4_3_norm_mbox_loc')(net['conv4_3_norm'])
../ssd.py:148: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(63, (3, 3), name="conv4_3_norm_mbox_conf", padding="same")
name=name)(net['conv4_3_norm'])
../ssd.py:160: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="fc7_mbox_loc", padding="same")
name='fc7_mbox_loc')(net['fc7'])
../ssd.py:168: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="fc7_mbox_conf", padding="same")
name=name)(net['fc7'])
../ssd.py:178: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv6_2_mbox_loc", padding="same")
name='conv6_2_mbox_loc')(net['conv6_2'])
../ssd.py:186: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv6_2_mbox_conf", padding="same")
name=name)(net['conv6_2'])
../ssd.py:197: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv7_2_mbox_loc", padding="same")
name='conv7_2_mbox_loc')(net['conv7_2'])
../ssd.py:205: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv7_2_mbox_conf", padding="same")
name=name)(net['conv7_2'])
../ssd.py:216: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv8_2_mbox_loc", padding="same")
name='conv8_2_mbox_loc')(net['conv8_2'])
../ssd.py:224: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv8_2_mbox_conf", padding="same")
name=name)(net['conv8_2'])
Traceback (most recent call last):
File "videotest_example.py", line 16, in
model = SSD(input_shape, num_classes=NUM_CLASSES)
File "../ssd.py", line 258, in SSD300
mode='concat', concat_axis=1, name='mbox_loc')
TypeError: 'module' object is not callable
上网查了之后,将ssd.py中修改如下:
net['mbox_loc'] = concatenate([net['conv4_3_norm_mbox_loc_flat'],
net['fc7_mbox_loc_flat'],
net['conv6_2_mbox_loc_flat'],
net['conv7_2_mbox_loc_flat'],
net['conv8_2_mbox_loc_flat'],
net['pool6_mbox_loc_flat']],
axis=1, name='mbox_loc')
net['mbox_conf'] = concatenate([net['conv4_3_norm_mbox_conf_flat'],
net['fc7_mbox_conf_flat'],
net['conv6_2_mbox_conf_flat'],
net['conv7_2_mbox_conf_flat'],
net['conv8_2_mbox_conf_flat'],
net['pool6_mbox_conf_flat']],
axis=1, name='mbox_conf')
net['mbox_priorbox'] = concatenate([net['conv4_3_norm_mbox_priorbox'],
net['fc7_mbox_priorbox'],
net['conv6_2_mbox_priorbox'],
net['conv7_2_mbox_priorbox'],
net['conv8_2_mbox_priorbox'],
net['pool6_mbox_priorbox']],
axis=1,
name='mbox_priorbox')
之后报错如下:
Using TensorFlow backend.
../ssd.py:41: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="relu", name="conv1_1", padding="same")
name='conv1_1')(net['input'])
../ssd.py:45: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="relu", name="conv1_2", padding="same")
name='conv1_2')(net['conv1_1'])
../ssd.py:47: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool1", padding="same")
name='pool1')(net['conv1_2'])
../ssd.py:52: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (3, 3), activation="relu", name="conv2_1", padding="same")
name='conv2_1')(net['pool1'])
../ssd.py:56: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (3, 3), activation="relu", name="conv2_2", padding="same")
name='conv2_2')(net['conv2_1'])
../ssd.py:58: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool2", padding="same")
name='pool2')(net['conv2_2'])
../ssd.py:63: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_1", padding="same")
name='conv3_1')(net['pool2'])
../ssd.py:67: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_2", padding="same")
name='conv3_2')(net['conv3_1'])
../ssd.py:71: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_3", padding="same")
name='conv3_3')(net['conv3_2'])
../ssd.py:73: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool3", padding="same")
name='pool3')(net['conv3_3'])
../ssd.py:78: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_1", padding="same")
name='conv4_1')(net['pool3'])
../ssd.py:82: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_2", padding="same")
name='conv4_2')(net['conv4_1'])
../ssd.py:86: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_3", padding="same")
name='conv4_3')(net['conv4_2'])
../ssd.py:88: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool4", padding="same")
name='pool4')(net['conv4_3'])
../ssd.py:93: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_1", padding="same")
name='conv5_1')(net['pool4'])
../ssd.py:97: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_2", padding="same")
name='conv5_2')(net['conv5_1'])
../ssd.py:101: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_3", padding="same")
name='conv5_3')(net['conv5_2'])
../ssd.py:103: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((3, 3), strides=(1, 1), name="pool5", padding="same")
name='pool5')(net['conv5_3'])
/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/legacy/layers.py:301: UserWarning: The AtrousConvolution2D layer has been deprecated. Use instead the Conv2D layer with the dilation_rate argument.
warnings.warn('The AtrousConvolution2D layer '
/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/legacy/layers.py:305: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(1024, (3, 3), activation="relu", name="fc6", dilation_rate=(6, 6), padding="same")
return Conv2D(*args, **kwargs)
../ssd.py:111: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(1024, (1, 1), activation="relu", name="fc7", padding="same")
border_mode='same', name='fc7')(net['fc6'])
../ssd.py:116: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (1, 1), activation="relu", name="conv6_1", padding="same")
name='conv6_1')(net['fc7'])
../ssd.py:119: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv6_2", strides=(2, 2), padding="same")
name='conv6_2')(net['conv6_1'])
../ssd.py:123: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (1, 1), activation="relu", name="conv7_1", padding="same")
name='conv7_1')(net['conv6_2'])
../ssd.py:127: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv7_2", strides=(2, 2), padding="valid")
name='conv7_2')(net['conv7_2'])
../ssd.py:131: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (1, 1), activation="relu", name="conv8_1", padding="same")
name='conv8_1')(net['conv7_2'])
../ssd.py:134: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv8_2", strides=(2, 2), padding="same")
name='conv8_2')(net['conv8_1'])
../ssd.py:141: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(12, (3, 3), name="conv4_3_norm_mbox_loc", padding="same")
name='conv4_3_norm_mbox_loc')(net['conv4_3_norm'])
../ssd.py:149: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(63, (3, 3), name="conv4_3_norm_mbox_conf", padding="same")
name=name)(net['conv4_3_norm'])
../ssd.py:161: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="fc7_mbox_loc", padding="same")
name='fc7_mbox_loc')(net['fc7'])
../ssd.py:169: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="fc7_mbox_conf", padding="same")
name=name)(net['fc7'])
../ssd.py:179: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv6_2_mbox_loc", padding="same")
name='conv6_2_mbox_loc')(net['conv6_2'])
../ssd.py:187: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv6_2_mbox_conf", padding="same")
name=name)(net['conv6_2'])
../ssd.py:198: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv7_2_mbox_loc", padding="same")
name='conv7_2_mbox_loc')(net['conv7_2'])
../ssd.py:206: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv7_2_mbox_conf", padding="same")
name=name)(net['conv7_2'])
../ssd.py:217: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv8_2_mbox_loc", padding="same")
name='conv8_2_mbox_loc')(net['conv8_2'])
../ssd.py:225: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv8_2_mbox_conf", padding="same")
name=name)(net['conv8_2'])
Traceback (most recent call last):
File "videotest_example.py", line 16, in
model = SSD(input_shape, num_classes=NUM_CLASSES)
File "../ssd.py", line 274, in SSD300
name='mbox_priorbox')
File "/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/layers/merge.py", line 641, in concatenate
return Concatenate(axis=axis, **kwargs)(inputs)
File "/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/engine/base_layer.py", line 434, in call
self.build(input_shapes)
File "/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/layers/merge.py", line 354, in build
'Got inputs shapes: %s' % (input_shape))
ValueError: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 38, 38, 512), (None, 19, 19, 1024), (None, 10, 10, 512), (None, 5, 5, 256), (None, 3, 3, 256), (None, 1, 1, 256)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant