Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the use of 1.312 on line 47 in DistDepth/utils.py? #27

Open
ch654833197 opened this issue Nov 12, 2023 · 3 comments
Open

What is the use of 1.312 on line 47 in DistDepth/utils.py? #27

ch654833197 opened this issue Nov 12, 2023 · 3 comments

Comments

@ch654833197
Copy link

What is the use of 1.312 on line 47 in DistDepth/utils.py? Why is the scale factor here calculated like this? Without using stereo matching? Can you explain the principle? Thanks!

@choyingw
Copy link
Collaborator

The term is associated with 13.12cm stereo baseline used to render SimSIN Dataset of the during training. The unit of stereo_baseline used for training is 10cm (

stereo_T[0, 3] = side_sign * baseline_sign * 0.1
), so we x 1.312 to match the scale learned for trained on SimSIN. The logic is the same as STEREO_SCALE_FACTOR in MonoDepth2 test script (https://github.com/nianticlabs/monodepth2/blob/master/test_simple.py)

@ch654833197
Copy link
Author

The term is associated with 13.12cm stereo baseline used to render SimSIN Dataset of the during training. The unit of stereo_baseline used for training is 10cm (

stereo_T[0, 3] = side_sign * baseline_sign * 0.1

), so we x 1.312 to match the scale learned for trained on SimSIN. The logic is the same as STEREO_SCALE_FACTOR in MonoDepth2 test script (https://github.com/nianticlabs/monodepth2/blob/master/test_simple.py)

Thank you very much for your reply! Can I understand that the formula Depth= Baseline*focal/disparity is applied to this part of the code? Baseline corresponds to 1.312, is scaled_out equivalent to disparity/focal? Is the output of the network actually a disparity? For example, here, normalizing to [0,10] is equivalent to doing focal length transformation? In supervised training, what will be the result if normalization is not performed here?

min_out = 1 / max_depth
max_out = 1 / min_depth
scaled_out = min_out + (max_out - min_out) * level
depth = 1.312 / scaled_out

@choyingw
Copy link
Collaborator

One view is as you said the scaled_out is focal/disparity under 10cm baseline. So just scale up with wider baseline.

Another view: it is a ratio problem. Suppose a network learns depth from intrinsic/ extrinsic projection in the definition of baseline 10cm (and since it is self-supervised no groudtruth are provided to correct the scale), but actually it is 13.12cm. From the equation depth = baseline*focal/disparity the same image with the same focal and disparity, the depth is proportional to baseline, and thus the actual depth is *1.312

Normalizing to [0, 10] gives a range prior of depth in views, which can actually cause a bit scale not matching to test scene, as the same issue of MonoDepth works. In supervised learning, you will have all metric stuff and doesn't need scaling. Even learned in inverse depth, you also have metric inverse depth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants