Keras-retinanet: TypeError: softmax() got an unexpected keyword argument 'axis'

Created on 23 Jun 2018  路  5Comments  路  Source: fizyr/keras-retinanet

Hello,I am honored to be able to use your code of RetinaNet, but I have got an error when I try to train it. Do you know why it happens?How can I fix it?Looking forward to your reply.

File "keras_retinanet/bin/train.py", line 485, in
main()
File "keras_retinanet/bin/train.py", line 437, in main
model = models.load_model(args.snapshot, backbone_name=args.backb
one)
File "keras_retinanet/bin....\keras_retinanet\models__init__.py", line 76,
in load_model
model = keras.models.load_model(filepath, custom_objects=backbone(backbone_n
ame).custom_objects)
...
File "C:\Program Files\Anaconda3\lib\site-packages\keras\activations.py", line
29, in softmax
return K.softmax(x)
File "C:\Program Files\Anaconda3\lib\site-packages\keras\backend\tensorflow_ba
ckend.py", line 2963, in softmax
return tf.nn.softmax(x, axis=axis)
TypeError: softmax() got an unexpected keyword argument 'axis'

Most helpful comment

Modify the code in this way: tf.nn.softmax(x, axis=axis) -> tf.nn.softmax(x, dim=axis)

All 5 comments

What version of tensorflow and Keras are you using? I would guess tensorflow is out of date.

This is a Keras issue encountered by many users, see here: https://github.com/keras-team/keras/issues/9621

You may need to change your keras/tensorflow version.

Modify the code in this way: tf.nn.softmax(x, axis=axis) -> tf.nn.softmax(x, dim=axis)

I got the same problem. Gave the following command and installed keras tensorflow. It worked for me

pip install -U keras tensorflow

just do it.

pip install --upgrade tensorflow # for Python 2.7

pip3 install --upgrade tensorflow # for Python 3.n

Was this page helpful?
0 / 5 - 0 ratings