Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunjp authored Jul 17, 2020
1 parent cc780e9 commit f0a7369
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.utils as v_utils
Expand Down Expand Up @@ -35,6 +36,7 @@ def normalize_img(img):

def point_score(outputs, imgs):

loss_func_mse = nn.MSELoss(reduction='none')
error = loss_func_mse((outputs[0]+1)/2,(imgs[0]+1)/2)
normal = (1-torch.exp(-error))
score = (torch.sum(normal*loss_func_mse((outputs[0]+1)/2,(imgs[0]+1)/2)) / torch.sum(normal)).item()
Expand Down

0 comments on commit f0a7369

Please sign in to comment.