rykov8/ssd_keras

Issue in upgrade to Keras 2.0

yogeshprox opened this issue · 2 comments

Hi,

I am trying to compile and run your code using Keras 2.0. I have replaced 'merge' function with 'concatenate' as follows:

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)
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)
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)

I am getting the following error:

File "..\ssd.py", line 274, in SSD300
axis=1)

File "C:\Program Files\Anaconda3\envs\py35\lib\site-packages\keras\layers\merge.py", line 508, in concatenate
return Concatenate(axis=axis, **kwargs)(inputs)

File "C:\Program Files\Anaconda3\envs\py35\lib\site-packages\keras\engine\topology.py", line 571, in call
self.build(input_shapes)

File "C:\Program Files\Anaconda3\envs\py35\lib\site-packages\keras\layers\merge.py", line 277, in build
'Got inputs shapes: %s' % (input_shape))

ValueError: 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)]

Kindly help me out with this issue.

Thanks in advance,
Yogesh

Hi,

have a look here #60

Thank you @D3lt4lph4 , i changed get_output_shape to compute_output_shape and it is working now.