ssd_keras icon indicating copy to clipboard operation
ssd_keras copied to clipboard

keras 2.0 concat error in ssd.train ipython

Open zhyhan opened this issue 8 years ago • 6 comments

When I code the ssd.train.ipython in notebook, the follwing error will appear, i has upgrade the keras 2.0 version: ValueError: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer 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)]

zhyhan avatar Mar 17 '17 03:03 zhyhan

@hzycn you need to rename get_output_shape to compute_output_shape in custom layers. However there might be other issues, as the implementation was not tested with Keras 2 api.

rykov8 avatar Mar 17 '17 10:03 rykov8

Thank you @rykov8 , I changed the get_output_shape to computer_output_shape in ssd_layers.py, but it still appears same issues.

zhyhan avatar Mar 17 '17 15:03 zhyhan

@hzycn is it a missprint in your comment? You need compute_output_shape, not computer_output_shape

rykov8 avatar Mar 17 '17 19:03 rykov8

Works after @rykov8 suggestion implemented, and it seems to be only necessary change.

sruu72 avatar Mar 22 '17 11:03 sruu72

i'm having the same issue. not sure i am interpreting the suggested fix correctly though:

in Class PriorBox

change: def get_output_shape_for(self, input_shape): to def compute_output_shape_for(self, input_shape):

???

BenMacKenzie avatar Apr 10 '17 17:04 BenMacKenzie

@BenMacKenzie not exactly. You need to rename

def get_output_shape_for(self, input_shape):
    ...

to

def compute_output_shape(self, input_shape):
    ...

It's just a Keras 2.0 change in API.

rykov8 avatar Apr 10 '17 19:04 rykov8