SphereNet-pytorch icon indicating copy to clipboard operation
SphereNet-pytorch copied to clipboard

Question about the function get_xy

Open dasing opened this issue 6 years ago • 5 comments

I have read the original paper and traced the code of sphere_cnn.py. However, I found in the get_xy function, the center point is (1,1) and it was (0,0) in the paper, so I want to ask why it is (1,1) instead of (0,0) here ?

Thank you very much!

dasing avatar Jan 16 '19 02:01 dasing

Hi @dasing, Since that position is the center of the kernel, it should be filled with the same pixel as a conventional kernel. (in line 57 new_result[1, 1] = (img_r, img_c)) So actually what get_xy returns for that position doesn't matter, but substituting (0, 0) into the formula will result in NaN.

ChiWeiHsiao avatar Jan 17 '19 07:01 ChiWeiHsiao

Hi @ChiWeiHsiao , I got it ! Thanks for replying. Actually I have some question about the formula of get_xy on the paper, screen shot 2019-01-19 at 9 46 18 am

I can understand of the formula of x(+-1, 0) and x(0, +-1), but I cannot understand the sec delta theta term in the x(+-1, +-1). It will be very grateful if you can tell me some idea about it. Thank you!

dasing avatar Jan 19 '19 02:01 dasing

Hi @dasing , I'm also reading into the same paper and find the code here. Here's my understanding of the equations above, correct me if I'm wrong?

First, for simplicity here, we can assume latitude fire_0 and longitude theta_0 for tangent plane Pi_0 are all zeros, then equations (5), (6) can all be simplified to x(fire, theta) = tan(theta) y(fire, theta) = tan(fire) / cos(theta)

Then, for x(+-1, +-1), they should be s(+-1, +-1) on the original sphere, then just substitute +- delta_fire and +- delta_theta into the equations above should give the correct answer.

However, my confusion is that, the above equations only tell us how we do sampling for the central point (0,0) on the equirectangular image. Then what about sampling at an arbitrary point? i.e, how do we make use of equation (11) in the paper?

rxqy avatar Jan 19 '19 05:01 rxqy

Hi @rxqy , your understanding in the case of (thetai_0, phi_0) = (0, 0) is correct. However, (theta_0, phi_0) is not always (0, 0), I think they should can be an arbitrary point, that is why I can't understand the formula.

dasing avatar Jan 20 '19 14:01 dasing

Hi @dasing , for an arbitrary point, we should use equation 11 in the original paper. That is, for a tangent plane T ( tangent to the sphere in (theta_pie, phi_pie) ), every point (x,y) can be reprojected with equation 11.

If you look into the code, this part does exactly the same thing. Input here is the height, width of the image, and the arbitrary point. https://github.com/ChiWeiHsiao/SphereNet-pytorch/blob/15e926cf3917a297171833e1fc2f9de9199efa62/spherenet/sphere_cnn.py#L31

In fact, I find another paper under review at ICLR 2019 that better describes the formula. (Section 3.1) Hope it may help you. https://openreview.net/pdf?id=H1fF0iR9KX

rxqy avatar Jan 23 '19 05:01 rxqy