Skip to content

How did you derive the gradient of GenerateProFlow? #6

@richardwth

Description

@richardwth

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions