Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dense depth map output #166

Open
Deng-King opened this issue Sep 26, 2024 · 1 comment
Open

Dense depth map output #166

Deng-King opened this issue Sep 26, 2024 · 1 comment

Comments

@Deng-King
Copy link

Hi there, thank you for your contributions.

When I ran the demo code following the readme.md tutorial (three images in the folder ./data/kitti_demo/ of this repository) but I only got a relatively sparse depth prediction, how do I get dense depth estimates like it shows in the project page?

What I just got:
20240926-152444
0000000005_merge

What I'm expecting:
image

@Deng-King Deng-King changed the title Dense map output Dense depth map output Sep 26, 2024
@Deng-King
Copy link
Author

I got a good result by running test_vit.sh. I finally figured out that the second row of the visualization output is the Depth Map output, and the third row is GT. Maybe they were captured by Lidar, so it looks relatively sparse.

20240926-163915
0000000005_merge2

But now I cannot seem to get a depth map by using known camera intrinsics (like running test_kitti.sh and test_nyu.sh). I added the test code below line 263 in de_test.py

    ...

    pred_depths, outputs = get_prediction(
        model=model,
        input=torch.stack(rgb_inputs),  # Stack inputs for batch processing
        cam_model=None,
        pad_info=pads,
        scale_info=None,
        gt_depth=None,
        normalize_scale=None,
    )
    print(' -- pred --') # line 263
    print(pred_depths.shape)
    print(pred_depths.max())
    print(pred_depths.mean())
    print(pred_depths.max())
    
    for j, gt_depth in enumerate(gt_depths):
        normal_out = None

    ...

and the cmd output is:

[09/26 16:25:10 root]: Distributed training: False
[09/26 16:25:15 root]: Loading weight '/media/deng/Data/Metric3D/weight/metric_depth_vit_large_800k.pth'
[09/26 16:25:15 root]: Loading weight '/media/deng/Data/Metric3D/weight/metric_depth_vit_large_800k.pth'
[09/26 16:25:16 root]: Successfully loaded weight: '/media/deng/Data/Metric3D/weight/metric_depth_vit_large_800k.pth'
[09/26 16:25:16 root]: Successfully loaded weight: '/media/deng/Data/Metric3D/weight/metric_depth_vit_large_800k.pth'
  0%|                                                                                                                                                                                        | 0/3 [00:00<?, ?it/s]data/nyu_demo/rgb/rgb_00000.jpg
 -- pred --
torch.Size([1, 1, 480, 1216])
tensor(24.2716, device='cuda:0')
tensor(24.2192, device='cuda:0')
tensor(24.2716, device='cuda:0')
/media/deng/Data/Metric3D/mono/utils/do_test.py:322: RankWarning: Polyfit may be poorly conditioned
  pred_global, _ = align_scale_shift(pred_depth, gt_depth)
 33%|██████████████████████████████████████████████████████████▋                                                                                                                     | 1/3 [00:01<00:02,  1.31s/it]data/nyu_demo/rgb/rgb_00050.jpg
 -- pred --
torch.Size([1, 1, 480, 1216])
tensor(24.2716, device='cuda:0')
tensor(24.2192, device='cuda:0')
tensor(24.2716, device='cuda:0')
/media/deng/Data/Metric3D/mono/utils/do_test.py:322: RankWarning: Polyfit may be poorly conditioned
  pred_global, _ = align_scale_shift(pred_depth, gt_depth)
 67%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎                                                          | 2/3 [00:01<00:00,  1.62it/s]data/nyu_demo/rgb/rgb_00100.jpg
 -- pred --
torch.Size([1, 1, 480, 1216])
tensor(24.2716, device='cuda:0')
tensor(24.2196, device='cuda:0')
tensor(24.2716, device='cuda:0')
/media/deng/Data/Metric3D/mono/utils/do_test.py:322: RankWarning: Polyfit may be poorly conditioned
  pred_global, _ = align_scale_shift(pred_depth, gt_depth)
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:01<00:00,  1.90it/s]
missing gt_depth, only save visualizations...

which means the model gives a wrong prediction but IDK why 😭

and the visual is still the same

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant