Using ResNeXt in Keras 2.2.4

      3 Comments on Using ResNeXt in Keras 2.2.4

To use ResNeXt50, I wrote my code as the API documentation for Keras:

But it reported errors:

That’s weird. The code doesn’t work as documentation said.
So I checked the code of Keras-2.2.4 (the version in my computer), and noticed that this version of code use ‘keras_applications’ instead of ‘keras.applications’.
Then I changed my code:

But it reported another error:

Witout choice, I had to check code of ‘/usr/lib/python3.6/site-packages/keras_applications/’ too. Finally, I realise the ResNeXt50() function need three more arguments:

Now the program could run ResNeXt50 model correctly. This github issue explained the detail: the ‘keras_applications’ could be used both for Keras and Tensorflow, so it needs to pass library details into model function.

3 thoughts on “Using ResNeXt in Keras 2.2.4

  1. harley

    Can you tell me how did you find add the 3 more arguments,the code works.
    I go to the source code, and didn’t find the 3 arguments,

    1. Robin Dong Post author

      From the code of I found the function ‘ResNet()’ will call ‘get_submodules_from_kwargs()’ to get extra arguments.
      The implementation of ‘get_submodules_from_kwargs()’ is here. Therefore I found the 3 more arguments.


Leave a Reply to Robin Dong Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.