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

ConvNeXt classifier_activation=softmax returns linear layer #319

Closed
Frightera opened this issue Dec 31, 2022 · 7 comments
Closed

ConvNeXt classifier_activation=softmax returns linear layer #319

Frightera opened this issue Dec 31, 2022 · 7 comments
Assignees

Comments

@Frightera
Copy link
Contributor

Describe the problem.

Specifying classifier_activation=softmax in ConvNeXt models does not work, instead it returns the model with a linear classifier layer.

Inspecting source code:
https://github.com/keras-team/keras/blob/e6784e4302c7b8cd116b74a784f4b78d60e83c26/keras/applications/convnext.py#L524-L526

Definition of Head function:
https://github.com/keras-team/keras/blob/e6784e4302c7b8cd116b74a784f4b78d60e83c26/keras/applications/convnext.py#L327-L348

Find the Colab gist here.

If OK I can open a PR and fix it.

@innat
Copy link

innat commented Jan 1, 2023

FYI, all models are moving to keras-cv. keras-team/keras-cv#678

@Frightera
Copy link
Contributor Author

I see, in keras-cv the implementation is correct. Shall I close this issue?

@innat
Copy link

innat commented Jan 2, 2023

Yes, you may. All the models from application will be moved to kcv completely soon.

@innat
Copy link

innat commented Feb 8, 2023

@Frightera please re-open this ticket.

Shall I close this issue?
yes.

I was wrong. This should be discussed and fixed right away.

@Frightera Frightera reopened this Feb 8, 2023
@Frightera
Copy link
Contributor Author

Frightera commented Feb 8, 2023

@innat Sure, re-opened it. Should be a small and easy fix. I think I can create a PR for that now.

@sushreebarsa sushreebarsa assigned innat and unassigned sushreebarsa Feb 13, 2023
copybara-service bot referenced this issue in keras-team/keras Feb 14, 2023
Imported from GitHub PR #17544

Fixes the issue #17386.

Please find the bug, fix, and test [gist here](https://colab.research.google.com/gist/Frightera/93a784fc0e03a19f5804e7e14bfbecba/-17386.ipynb).
Copybara import of the project:

--
eedabb6 by Kaan <46622558+Frightera@users.noreply.github.com>:

Pass classifier_activation arg to "Head"
--
e226091 by Kaan <46622558+Frightera@users.noreply.github.com>:

Add classifier_activation to the docstring
--
3856fed by Kaan <46622558+Frightera@users.noreply.github.com>:

Add classifier_activation unit test
--
c3dfc34 by Kaan <46622558+Frightera@users.noreply.github.com>:

Move classifier_activation validation before head creation
--
71eaa69 by Kaan <46622558+Frightera@users.noreply.github.com>:

Update test_application_classifier_activation
--
ebd6940 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>:

Reformatting using format.sh

--
bce4ac9 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>:

Fix test_application_classifier_activation test

--
00d4889 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>:

Fix Head params to accept classifier_activation

--
2c22d37 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>:

Revert "Fix Head params to accept classifier_activation"

This reverts commit 00d4889.

--
3abd441 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>:

Exclude RegNet in test_application_classifier_activation

Merging this change closes #17544

FUTURE_COPYBARA_INTEGRATE_REVIEW=#17544 from Frightera:frightera_fix_17386 3abd441
PiperOrigin-RevId: 509550999
@Frightera
Copy link
Contributor Author

Closing as PR was merged.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@fchollet fchollet transferred this issue from keras-team/keras Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants