GeoProj icon indicating copy to clipboard operation
GeoProj copied to clipboard

How did you derive the gradient of GenerateProFlow?

Open richardwth opened this issue 4 years ago • 1 comments

Hi, thanks for the wonderful paper and code.

I am trying to extend your method in my application where the project distortion is more flexible, that is, x3 = 1 - x4 and x1 < x4 in the function distortion_model.distortionParameter() do not always hold. I have tried my best to understand the mathematics of project distortion in your code. Currently, this function modelNetS.GenerateProFlow.backward() confuses me the most. The gradient is calculated as follows:

for s in range(batchSize):
    x = Input[s]*ProFactor
            
    t00 = -1.0*((2*H-2)*i+(1-H)*W+H-1)*j
    t01 = (4*j*j+(8-8*H)*j+4*H*H-8*H+4)*x*x+((4*H-4)*j-4*H*H+8*H-4)*x+H*H-2*H+1
    grad_current[s,0] = ProFactor*t00/t01
            
    t10 = -1.0*((99*H-99)*j*j+(-99*H*H+198*H-99)*j)
    t11 = (200*j*j+(400-400*H)*j+200*H*H-400*H+200)*x*x+((200*H-200)*j-200*H*H+400*H-200)*x+50*H*H-100*H+50
    grad_current[s,1] = ProFactor*t10/t11
        
    grad = grad_output * grad_current

for s in range(batchSize):
    grad_input[s,0] = torch.sum(grad[s,:,:,:])

May I request your advice about how this is derived or where I can find the related paper or tutorial? Any help on how a11 - a32 are derived in the function distortion_model.distortionParameter() is also much appreciated.

richardwth avatar Sep 15 '20 08:09 richardwth

Hey bro, Do you have the code of GenerateProFlow .The code to generate the prediction flow is now missing from the author's zip package .Could you send it to me if you have it,I really need it. My E-mail is [email protected] Thanks so much!

jingaoyin avatar Sep 21 '21 11:09 jingaoyin