TRI-ML / packnet-sfm

TRI-ML Monocular Depth Estimation Repository
https://tri-ml.github.io/packnet-sfm/
MIT License
1.24k stars 243 forks source link

Conversion inverse depth map to real distance for custom images? #23

Closed trnmentoring closed 4 years ago

trnmentoring commented 4 years ago

If i want to get real distance per pixel for custom image, should i apply inv2depth function to infer.py output (depth from model_wrapper.depth)? Cause as for now, predicted distanced are pretty different from the real ones.

VitorGuizilini-TRI commented 4 years ago

Yes, the output of our depth networks is actually inverse depth, so you need to apply inv2depth. Also, if you are using a self-supervised model the output will not be metrically accurate, so you need to scale it first.

trnmentoring commented 4 years ago

Exactly, thanks for so fast reply. Do you have a script for scaling in your repo?

VitorGuizilini-TRI commented 4 years ago

I don't think we have it as a standalone function, but you can see how it's done here:

https://github.com/TRI-ML/packnet-sfm/blob/f44a19663159b521a2f7209c12c40cfe3ead7bd9/packnet_sfm/utils/depth.py#L248

trnmentoring commented 4 years ago

Ah, i see. thank you for your patience!