Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request opencv-dnn] Swish Activation, Mish Activation #15693

Closed
LukeAI opened this issue Oct 13, 2019 · 9 comments · Fixed by #15808
Closed

[Feature Request opencv-dnn] Swish Activation, Mish Activation #15693

LukeAI opened this issue Oct 13, 2019 · 9 comments · Fixed by #15808

Comments

@LukeAI
Copy link

LukeAI commented Oct 13, 2019

Google's famous Efficientnet uses the Swish Activation function
It is currently not possible to use efficientnet in opencv due to the absence of swish.

The newer Mish activation function reportedly outperforms swish and would be great to have as an option.

@dkurt
Copy link
Member

dkurt commented Oct 13, 2019

It's possible for now to enable this network with custom layers mechanism. Please read a tutorial https://docs.opencv.org/master/dc/db1/tutorial_dnn_custom_layers.html.

@suab321321
Copy link

@dkurt @LukeAI I would like to help with this one

@dkurt
Copy link
Member

dkurt commented Oct 15, 2019

@suab321321, thanks! Feel free to open a PR

@grassknoted
Copy link

Hi @dkurt seeing no progress, I was wondering if I could take this issue up? I had a look at the link:

Please read a tutorial https://docs.opencv.org/master/dc/db1/tutorial_dnn_custom_layers.html.

I'm still unsure of where to add the Mish activation function. Could you just help me get started, please?

@alalek
Copy link
Member

alalek commented Oct 22, 2019

Usage questions should go to Users OpenCV Q/A forum: http://answers.opencv.org
Custom layers are part of User code. Check "samples".

@grassknoted
Copy link

Thanks for the reply @alalek !
Just to clarify, I would need to create an Mish function example in the samples/ directory, right? Something like: samples/python/mish.py?

@alalek
Copy link
Member

alalek commented Oct 22, 2019

Well, if you want to add this implementation OpenCV then check this patch: #10889 + add tests on data from original framework (1-2 layers, to ensure that it is parsed properly).

Not sure if this is really "good first issue".

@dkurt
Copy link
Member

dkurt commented Oct 22, 2019

As far as I know Swish is an activation layer so you need to implement it here: https://github.com/opencv/opencv/blob/master/modules/dnn/src/layers/elementwise_layers.cpp.

Also, you need to register a new name at https://github.com/opencv/opencv/blob/master/modules/dnn/src/init.cpp

and write some tests depends on origin framework.

@grassknoted
Copy link

Well, if you want to add this implementation OpenCV then check this patch: #10889 + add tests on data from original framework (1-2 layers, to ensure that it is parsed properly).

Not sure if this is really "good first issue".

Looking at the required changes, I'm not very sure I could take this on. I will instead look for more beginner focussed issues. Thank you @dkurt and @alalek for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants