MCPcopy Create free account
hub / github.com/CompVis/diff2flow / __call__

Method __call__

diff2flow/metrics.py:70–91  ·  view source on GitHub ↗

Assumes target and pred in [-1, 1] range

(self, target, pred)

Source from the content-addressed store, hash-verified

68 self.quantiles = (0.795, 46.679) # DIODE quantiles
69
70 def __call__(self, target, pred):
71 """ Assumes target and pred in [-1, 1] range """
72 target = target.mean(dim=1, keepdim=True)
73 pred = pred.mean(dim=1, keepdim=True)
74
75 # unnormalize ground truth depth
76 target = target / 2 + 0.5
77 q_min, q_max = self.quantiles
78 q_min = torch.log(torch.tensor(q_min))
79 q_max = torch.log(torch.tensor(q_max))
80 log_target = target * (q_max - q_min) + q_min
81 target = torch.exp(log_target)
82
83 # scale and shift invariance
84 pred = apply_scale_and_shift(pred=pred, gt=log_target)
85 pred = pred.exp()
86
87 # compute metrics
88 relabs = abs_rel_error(pred, target)
89 self.relabs.append(relabs)
90 delta1 = delta1_accuracy(pred, target)
91 self.delta1s.append(delta1)
92
93 def reset(self):
94 self.delta1s = []

Callers

nothing calls this directly

Calls 3

apply_scale_and_shiftFunction · 0.90
abs_rel_errorFunction · 0.90
delta1_accuracyFunction · 0.90

Tested by

no test coverage detected