Skip to content

Commit

Permalink
Changed the loss function to improve training
Browse files Browse the repository at this point in the history
  • Loading branch information
zhen-he committed Aug 2, 2019
1 parent 81a0766 commit 2f9a239
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/loss_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ def forward(self, output, target, area, **kwargs):
losses = {}

# Reconstruction loss
loss_recon = self.mse(output, target)
if 'Y_b' in kwargs.keys():
Y_b = kwargs['Y_b']
loss_recon = self.mse(output, target) + self.mse((output - Y_b).abs(), (target - Y_b).abs())
else
loss_recon = self.mse(output, target)
loss = loss_recon
losses['recon'] = loss_recon.data[0]

Expand Down

0 comments on commit 2f9a239

Please sign in to comment.