Open IlariaAnita opened 1 year ago
Hi, I didn't figure out how to add another half of the loss. Do I have to use getBatchHLoss() in the resnet file as I wrote in the following lines?
286 feature_loss_mat = triplet_loss(patch_2, pred_I2_CnnFeature, patch_1) 287 288 feature_loss = torch.sum(torch.mul(feature_loss_mat, mask_ap)) / sum_value 289 feature_loss = torch.unsqueeze(feature_loss, 0) 290 291 feature_loss_add_half = getBatchHLoss(H_mat, torch.linalg.inv(H_mat)) 292 feature_loss_add_half = torch.unsqueeze(feature_loss_add_half, 0) 293 294 feature_loss = feature_loss.add(feature_loss_add_half)
Hi~ I assume the H is used for warping B to A. If you want to add the inverse feature loss you need to calculate the inverse H( warp A to B) and compute the triplet_loss again
Hi, I didn't figure out how to add another half of the loss. Do I have to use getBatchHLoss() in the resnet file as I wrote in the following lines?
286 feature_loss_mat = triplet_loss(patch_2, pred_I2_CnnFeature, patch_1) 287
288 feature_loss = torch.sum(torch.mul(feature_loss_mat, mask_ap)) / sum_value 289 feature_loss = torch.unsqueeze(feature_loss, 0) 290 291 feature_loss_add_half = getBatchHLoss(H_mat, torch.linalg.inv(H_mat)) 292 feature_loss_add_half = torch.unsqueeze(feature_loss_add_half, 0) 293 294 feature_loss = feature_loss.add(feature_loss_add_half)