nie-lang / UDIS2

ICCV2023 - Parallax-Tolerant Unsupervised Deep Image Stitching (UDIS++)
Apache License 2.0
179 stars 26 forks source link

Inquiry about <def cal_lp_loss2(input1, warp_mesh, warp_mesh_mask)> in /Warp/Codes/loss.py #38

Open zhihaoyi opened 1 week ago

zhihaoyi commented 1 week ago

Thank you for your work! It is an inspiration for those who want to dive into this field!

I am trying to understand to code behind Iterative Warp Adaption. As shown below,

def cal_lp_loss2(input1, warp_mesh, warp_mesh_mask): batchsize, , img_h, img_w = input1.size()

delta3 = (torch.sum(warp_mesh, [2,3]) - torch.sum(input1*warp_mesh_mask, [2,3])) / torch.sum(warp_mesh_mask, [2,3])
input1_newbalance = input1 + delta3.unsqueeze(2).unsqueeze(3).expand(-1, -1, img_h, img_w)

lp_loss_2 = l_num_loss(input1_newbalance*warp_mesh_mask, warp_mesh, 1)
lp_loss = 1. * lp_loss_2

return lp_loss

I don't understand the intuition of adding an extra term <delta3.unsqueeze(2).unsqueeze(3).expand(-1, -1, img_h, img_w)> after to get . I do not see this term in your paper.

What is the purpose of this extra term?

Thank you!

nie-lang commented 1 week ago

This can be simply understood as illumination compensation. We just used the most simple strategy and assumed every pixel has the same light difference.