Spaces:
Runtime error
Runtime error
Update mono/utils/do_test.py
Browse files- mono/utils/do_test.py +6 -3
mono/utils/do_test.py
CHANGED
|
@@ -210,10 +210,12 @@ def transform_test_data_scalecano(rgb, intrinsic, data_basic):
|
|
| 210 |
|
| 211 |
rgb = torch.from_numpy(rgb.transpose((2, 0, 1))).float()
|
| 212 |
rgb = torch.div((rgb - mean), std)
|
| 213 |
-
rgb = rgb[None, :, :, :].cuda()
|
|
|
|
| 214 |
|
| 215 |
cam_model = torch.from_numpy(cam_model.transpose((2, 0, 1))).float()
|
| 216 |
-
cam_model = cam_model[None, :, :, :].cuda()
|
|
|
|
| 217 |
cam_model_stacks = [
|
| 218 |
torch.nn.functional.interpolate(cam_model, size=(cam_model.shape[2]//i, cam_model.shape[3]//i), mode='bilinear', align_corners=False)
|
| 219 |
for i in [2, 4, 8, 16, 32]
|
|
@@ -276,7 +278,8 @@ def do_scalecano_test_with_custom_data(
|
|
| 276 |
|
| 277 |
pred_depth = torch.nn.functional.interpolate(pred_depth[None, None, :, :], (gt_depth.shape[0], gt_depth.shape[1]), mode='bilinear').squeeze() # to original size
|
| 278 |
|
| 279 |
-
gt_depth = torch.from_numpy(gt_depth).cuda()
|
|
|
|
| 280 |
|
| 281 |
pred_depth_median = pred_depth * gt_depth[gt_depth != 0].median() / pred_depth[gt_depth != 0].median()
|
| 282 |
pred_global, _ = align_scale_shift(pred_depth, gt_depth)
|
|
|
|
| 210 |
|
| 211 |
rgb = torch.from_numpy(rgb.transpose((2, 0, 1))).float()
|
| 212 |
rgb = torch.div((rgb - mean), std)
|
| 213 |
+
#rgb = rgb[None, :, :, :].cuda()
|
| 214 |
+
rgb = rgb[None, :, :, :]
|
| 215 |
|
| 216 |
cam_model = torch.from_numpy(cam_model.transpose((2, 0, 1))).float()
|
| 217 |
+
#cam_model = cam_model[None, :, :, :].cuda()
|
| 218 |
+
cam_model = cam_model[None, :, :, :]
|
| 219 |
cam_model_stacks = [
|
| 220 |
torch.nn.functional.interpolate(cam_model, size=(cam_model.shape[2]//i, cam_model.shape[3]//i), mode='bilinear', align_corners=False)
|
| 221 |
for i in [2, 4, 8, 16, 32]
|
|
|
|
| 278 |
|
| 279 |
pred_depth = torch.nn.functional.interpolate(pred_depth[None, None, :, :], (gt_depth.shape[0], gt_depth.shape[1]), mode='bilinear').squeeze() # to original size
|
| 280 |
|
| 281 |
+
#gt_depth = torch.from_numpy(gt_depth).cuda()
|
| 282 |
+
gt_depth = torch.from_numpy(gt_depth)
|
| 283 |
|
| 284 |
pred_depth_median = pred_depth * gt_depth[gt_depth != 0].median() / pred_depth[gt_depth != 0].median()
|
| 285 |
pred_global, _ = align_scale_shift(pred_depth, gt_depth)
|