ssd_kerasV2 icon indicating copy to clipboard operation
ssd_kerasV2 copied to clipboard

ssd300MobileNet layer concatenate error

Open rkuo2000 opened this issue 4 years ago • 1 comments

when I use SSD.ipynb or SSD_Train.ipynb, (keras-2.3.1 or 2.1.5 both failed) model=model = SSD(input_shape, num_classes=NUM_CLASSES) always cause Error as below:

ValueError: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 1917, 4), (None, 1917, 21), (None, 114432, 8)]

error is caused by merge of the 3 nets at line #186 of ssd300MobileNet.py net['predictions'] = concatenate([net['mbox_loc'],net['mbox_conf'],net['mbox_priorbox']],axis=2,name='predictions')

how to fix the shape mismatch of these 3 nets ?

rkuo2000 avatar Jan 10 '20 21:01 rkuo2000

The fix is to modify ssd_layers.py line #32 and #84 : if K.image_dim_ordering() == 'tf': to if K.image_data_format() == 'channels_last': Then it runs !

rkuo2000 avatar Jan 10 '20 23:01 rkuo2000