rykov8 / ssd_keras

Port of Single Shot MultiBox Detector to Keras
MIT License
1.1k stars 553 forks source link

keras 2.0 concat error in ssd.train ipython #60

Open zhyhan opened 7 years ago

zhyhan commented 7 years ago

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

rykov8 commented 7 years ago

@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.

zhyhan commented 7 years ago

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

rykov8 commented 7 years ago

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

sruu72 commented 7 years ago

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

BenMacKenzie commented 7 years ago

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

???

rykov8 commented 7 years ago

@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.