rykov8 / ssd_keras

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

TypeError: l2_normalize() got an unexpected keyword argument 'axis' #134

Open maxlchina opened 6 years ago

maxlchina commented 6 years ago

hello,when i run the file SSD_training.ipynb, it give this erro:

TypeError Traceback (most recent call last)

in () ----> 1 model = SSD300(input_shape, num_classes=NUM_CLASSES) 2 model.load_weights('weights_SSD300.hdf5', by_name=True) /home/maxl/ssd_keras-master/ssd.py in SSD300(input_shape, num_classes) 135 net['pool6'] = GlobalAveragePooling2D(name='pool6')(net['conv8_2']) 136 # Prediction from conv4_3 --> 137 net['conv4_3_norm'] = Normalize(20, name='conv4_3_norm')(net['conv4_3']) 138 num_priors = 3 139 x = Convolution2D(num_priors * 4, 3, 3, border_mode='same', /home/maxl/anaconda3/lib/python3.5/site-packages/keras/engine/topology.py in __call__(self, inputs, **kwargs) 617 618 # Actually call the layer, collecting output(s), mask(s), and shape(s). --> 619 output = self.call(inputs, **kwargs) 620 output_mask = self.compute_mask(inputs, previous_mask) 621 /home/maxl/ssd_keras-master/ssd_layers.py in call(self, x, mask) 45 46 def call(self, x, mask=None): ---> 47 output = K.l2_normalize(x, self.axis) 48 output *= self.gamma 49 return output /home/maxl/anaconda3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in l2_normalize(x, axis) 3149 A tensor. 3150 """ -> 3151 return tf.nn.l2_normalize(x,axis=axis) 3152 3153 TypeError: l2_normalize() got an unexpected keyword argument 'axis'
sudonto commented 6 years ago

Hi, in my case, you should change tf.nn.l2_normalize(x,axis=axis) to tf.nn.l2_normalize(x,dim=axis) in tensorflow_backend.py

chanilP commented 6 years ago

because tensorflow version. I use tensorflow 1.6.0 in linux

Rorschaaaach commented 6 years ago

so did you take it?cause i meet this problem too