YvanYin/VNL_Monocular_Depth_Prediction

how can i get real depth from depth map?

kimwongyuda opened this issue · 3 comments

_, pred_depth_softmax= model.module.depth_model(img_torch)
pred_depth = bins_to_depth(pred_depth_softmax)
pred_depth = pred_depth.cpu().numpy().squeeze()

i get a depth map from this code in test_any_images.py
and finally i want to calculate real depth when i know max_depth, min_depth in the real world.

do you have related codes about that?

Actually it is really hard to recover the metric depth in the real world, especially you use different camera to take these photoes.

I used my own dataset which has fixed max depth and min depth in all images for training. Also i know focal length of camera.
I can't recover real depth?

And i am curious of what output of model means(the depth map). It results in numbers, 0~. What do these numbers mean? Those are not real depth?

When I train the model on NYU dataset, the depth range is 0-10m. I normalize the depth to 0-1. Therefore, when the model predicts the depth, we multiply the output with 10, then we can recover the metric depth on the NYU dataset. If we train it on KITTI, similar pipeline is applied, but the depth range is 0-80m.
You can use our released model on your data, but I am not sure the model can work well on your scenes. If you do it, you should scale the predicted depth with different factor, which depends on which model you use. E.g. you use NYU model, you should scale it with 10. After that, you should take the following :
d = d_{s} * f_{your} / f_{dataset}
d_{s} is the mentioned scaled depth, f_{your} is your camera focal length, f_{dataset} is the focal length of the training dataset.