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

Signed square root #4

Closed
sshkhr opened this issue May 18, 2018 · 4 comments
Closed

Signed square root #4

sshkhr opened this issue May 18, 2018 · 4 comments

Comments

@sshkhr
Copy link

sshkhr commented May 18, 2018

Hi Hao

First of all thanks for the excellent implementation. I have used the code here as a reference for my own implementations.

In the original paper (http://vis-www.cs.umass.edu/bcnn/docs/bcnn_iccv15.pdf) the authors have used signed square root operation. Something like:

X = torch.mul(torch.sign(X),torch.sqrt(torch.abs(X)+1e-5))

instead of the normal square root you have used X = torch.sqrt(X + 1e-5)

Was there a particular reason for using this ?

@HaoMood
Copy link
Owner

HaoMood commented May 19, 2018

It is used for prevent sqrt(0). This type of trick is also used in other bilinear CNN implementations.

@sshkhr
Copy link
Author

sshkhr commented May 22, 2018

I get that we are adding 1e-5 to prevent sqrt(0). But in the paper they are using signed square root.

Here in the TF implementation - https://github.com/abhaydoke09/Bilinear-CNN-TensorFlow/blob/master/core/bcnn_finetuning.py also signed square root is taken

self.y_ssqrt = tf.multiply(tf.sign(self.phi_I),tf.sqrt(tf.abs(self.phi_I)+1e-12)) '''Take signed square root of phi_I'''

@HaoMood
Copy link
Owner

HaoMood commented May 22, 2018

Please refer to this issue #1 for why sqrt rather than signed sqrt is used in this implementation.

@sshkhr
Copy link
Author

sshkhr commented May 22, 2018

Thanks that makes a lot of sense

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