zhyever / Monocular-Depth-Estimation-Toolbox

Monocular Depth Estimation Toolbox based on MMSegmentation.
Apache License 2.0
907 stars 104 forks source link

Point Cloud generation with the KITTI dataset #50

Open roa0762 opened 2 years ago

roa0762 commented 2 years ago

Hi Zhenyu,

the point cloud generation script https://github.com/zhyever/Monocular-Depth-Estimation-Toolbox/blob/main/tools/misc/visualize_point-cloud.py

seems to be specific for the NYU dataset. It would be great to have the script also for the KITTI dataset. I have mananged to adapt it to the KITTI dataset with the following changes:

    h, w = 375 - 23, 1242 - 26
    fx = 721.5377
    fy = 721.5377
    cx = 609.5593
    cy = 172.854

    img_tensor = torch.tensor(img[11:375-12, 13:1242-13, :], dtype=torch.uint8)  #NOT sure here whether 11:375 - 12 or 12:375 - 11

One also needs an eval_pipeline for KITTI in

https://github.com/zhyever/Monocular-Depth-Estimation-Toolbox/blob/main/configs/_base_/datasets/kitti.py

I have choses the following one:

eval_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadKITTICamIntrinsic'), dict(type='KBCrop', depth=False), dict(type='RandomFlip', prob=0.0), # set to zero dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img'], meta_keys=('filename', 'ori_filename', 'ori_shape', 'img_shape', 'pad_shape', 'scale_factor', 'flip', 'flip_direction', 'img_norm_cfg', 'cam_intrinsic')), ]

It would be great if you could check my adaptation and include them on main. Thank you very much.

zhyever commented 2 years ago

Thanks a lot for your contributions. I will consider it carefully and enhance this toolbox! To be honest, it is interesting to visualize the depth results, which makes the model training not only evaluation numbers.