ClementPinard / SfmLearner-Pytorch

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

inference depth with strange results #124

Closed songzhan66 closed 2 years ago

songzhan66 commented 3 years ago

Thanks for the codes!

When I use the pretrained model to inference disp and depth on Kitti images, the disp looks reasonable but the depth result looks all red, different from the demo.

0000000003 0000000003_disp 0000000003_depth

Is this normal? I think it is because of the colormap settings, in the opencv_rainbow function in utils.py

ClementPinard commented 3 years ago

Hi, yes it's only a problem of depth map colormap. Besides, the depth map is not normalized, contrary to the disp map, which explains why it's mostly red. The main point of this map is to show where we stand in the network range. If you look at the code, you can see that the network can output values from 10cm and 100m, but the map shows that most values are way below 10m, which lets us believe that the network output is not centered, we are mostly on the edge of the output sigmoid.

It's just an insight, no other work has been done to try to by a little bit more in the center of the sigmoid, but if you prefer to have a normalized depth map, or a more saturated depth (with e.g. max depth at 3meters), you can change the code here : https://github.com/ClementPinard/SfmLearner-Pytorch/blob/master/run_inference.py#L81 (change max_value parameter)