ClementPinard / SfmLearner-Pytorch

Pytorch version of SfmLearner from Tinghui Zhou et al.
MIT License
1.01k stars 224 forks source link

Query regarding depth map. #133

Closed rohitcmohite closed 1 year ago

rohitcmohite commented 2 years ago

Hi , Thanks a lot for your work, its very inspiring.

  1. After executing run_inference.py the depth image obtained is a 3 channel image, so how can I get the actual depth of each pixel in the image? Does any of those 3 channels represent the depth of the corresponding pixel?

  2. Also, what I understood by now is that, the depthmap obtained from the network dosent provide the direct actual depth but it is the scaled depth. So I need to compare the scaled depth obtained from the network with the ground truth value and find the scaling factor. And this scaling factor I can use it everytime further to get the actual depth from the scaled depth. Could you please confirm if I am understanding it correctly.

  3. I am currently trying it on KITTI dataset. Could it be possible to calculate the depthmap ourself using the disparity map obtained from the model?

Thank You.

ClementPinard commented 2 years ago

Hi,

  1. No, it's juste a vizualisation. If you want to output actual depth, you can this line here. Careful, it will be much heavier as it's uncompressed floats.
    np.save(output_dir/'{}_depth.npy'.format(file_name), depth)
  2. The scale factor is undetermined. That's the main pain point of this work, it's not constant with the network, you need to find it each time. You could try a scale factor that works for most images, but there is no guarantee at all. The method to get it in the original paper is to compare the median of prediction with median of groundtruth. The proposed alternitve method here is to compare movement magnitude prediction with Posent with groundtruth odometry, either from GPS or from integrating wheel speed.
  3. As said above, the depth map needs a scale factor to be computed. It's up to you how you get it since KITTI features both Lidar and odometry. Odometry is more realistic if you plan to use it on your own device where chances are that you have Lidar data
rohitcmohite commented 2 years ago

Hello, Thank you. Will definitely try it out.