diff --git a/packnet_sfm/losses/supervised_loss.py b/packnet_sfm/losses/supervised_loss.py index 4ff67918..2e04e2d1 100644 --- a/packnet_sfm/losses/supervised_loss.py +++ b/packnet_sfm/losses/supervised_loss.py @@ -49,8 +49,9 @@ def forward(self, pred, gt): huber_mask = (diff > huber_c).detach() diff2 = diff[huber_mask] - diff2 = diff2 ** 2 - return torch.cat((diff, diff2)).mean() + diff2 = (diff2 ** 2 + huber_c ** 2) / (2 * huber_c) #diff2 ** 2 + return (torch.sum(diff) + torch.sum(diff2)) / sum(diff.size() + diff2.size()) + #return torch.cat((diff, diff2)).mean() class SilogLoss(nn.Module): def __init__(self, ratio=10, ratio2=0.85): @@ -179,4 +180,4 @@ def forward(self, inv_depths, gt_inv_depth, return { 'loss': loss.unsqueeze(0), 'metrics': self.metrics, - } \ No newline at end of file + }