Computation of error metrics between predicted and ground truth depths
(gt, pred)
| 249 | |
| 250 | |
| 251 | def 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 |
nothing calls this directly
no outgoing calls
no test coverage detected