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

About the Softmax in the CAM_Module #48

Closed
lartpang opened this issue Apr 7, 2019 · 5 comments
Closed

About the Softmax in the CAM_Module #48

lartpang opened this issue Apr 7, 2019 · 5 comments

Comments

@lartpang
Copy link

lartpang commented Apr 7, 2019

energy_new = torch.max(energy, -1, keepdim=True)[0].expand_as(energy)-energy

image

Is your code trying to improve numerical stability? Maybe it should be in this form.

       energy_new = torch.max(energy, -1, keepdim=True)
       energy_new = energy_new[0].expand_as(energy)
       energy_new = energy - energy_new
       attention = self.softmax(energy_new)
@junfu1115
Copy link
Owner

@lartpang Thanks, we have tried the form you provide, but the performance is not good

@lartpang
Copy link
Author

lartpang commented Apr 8, 2019

Well, can I take it as a practical experience?

@junfu1115
Copy link
Owner

@lartpang This might be an attempt, in other cases,

@lartpang
Copy link
Author

lartpang commented Apr 8, 2019

OK, thanks for your answer and your code...

This idea is so good, except for some extra memory... It's more suitable for a position where the number of channels is small.

@junfu1115
Copy link
Owner

@lartpang Thanks

@lartpang lartpang closed this as completed Apr 9, 2019
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

2 participants