TypeError: l2_normalize() got an unexpected keyword argument 'axis'
See original GitHub issueHi, i use this code to create your own model with own dataset , but occure this error.
Warning (from warnings module):
File “C:\Python36\lib\site-packages\h5py_init_.py”, line 36
from ._conv import register_converters as _register_converters
FutureWarning: Conversion of the second argument of issubdtype from float
to np.floating
is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type
.
Using TensorFlow backend.
Traceback (most recent call last):
File “C:\Python36\ssd_keras-master\train_ssd300.py”, line 59, in <module>
swap_channels=swap_channels)
File “C:\Python36\ssd_keras-master\keras_ssd300.py”, line 287, in ssd_300
conv4_3_norm = L2Normalization(gamma_init=20, name=‘conv4_3_norm’)(conv4_3)
File “C:\Python36\lib\keras\engine\topology.py”, line 619, in call
output = self.call(inputs, **kwargs)
File “C:\Python36\ssd_keras-master\keras_layer_L2Normalization.py”, line 63, in call
output = K.l2_normalize(x, self.axis)
File “C:\Python36\lib\keras\backend\tensorflow_backend.py”, line 3151, in l2_normalize
return tf.nn.l2_normalize(x, axis=axis)
TypeError: l2_normalize() got an unexpected keyword argument ‘axis’
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (5 by maintainers)
Top GitHub Comments
What version of TensorFlow are you using?
The error message is pretty clear:
tf.nn.l2_normalize()
doesn’t have a parameter namedaxis
in your version of TensorFlow, implying that you are using a version of TensorFlow that is too old.EDIT: For anybody having this issue in the future, the error is caused by an incompatibility between your TensorFlow and Keras versions. TensorFlow changed the name of the concerned argument from
dim
toaxis
(I believe in version 1.5), and Keras adopted this change in a recent release (I believe 2.1.5). This means you must run TF and Keras versions that are consistent in this regard, i.e. versions that call this argument by the same name. If you run Keras 2.1.5 or later, then you must also run TF 1.5/1.6 or later. Conversely, if you run TF 1.4 or earlier, then you must also run Keras 2.1.4 or earlier.Update: I just solved the issue. It was my Keras 2.1.5 version that caused the problem. tensorflow-gpu v.1.4.1 was breaking but only because Keras 2.1.5 was making incorrect use of the following call:
I solved by downgrading to Keras v. 2.1.4