MCPcopy Create free account
hub / github.com/KinkangLiu/Monocular_Distance_Detect / compute_depth_errors

Function compute_depth_errors

layers.py:251–269  ·  view source on GitHub ↗

Computation of error metrics between predicted and ground truth depths

(gt, pred)

Source from the content-addressed store, hash-verified

249
250
251def compute_depth_errors(gt, pred):
252 """Computation of error metrics between predicted and ground truth depths
253 """
254 thresh = torch.max((gt / pred), (pred / gt))
255 a1 = (thresh < 1.25 ).float().mean()
256 a2 = (thresh < 1.25 ** 2).float().mean()
257 a3 = (thresh < 1.25 ** 3).float().mean()
258
259 rmse = (gt - pred) ** 2
260 rmse = torch.sqrt(rmse.mean())
261
262 rmse_log = (torch.log(gt) - torch.log(pred)) ** 2
263 rmse_log = torch.sqrt(rmse_log.mean())
264
265 abs_rel = torch.mean(torch.abs(gt - pred) / gt)
266
267 sq_rel = torch.mean((gt - pred) ** 2 / gt)
268
269 return abs_rel, sq_rel, rmse, rmse_log, a1, a2, a3

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected