zhyever / Monocular-Depth-Estimation-Toolbox

Monocular Depth Estimation Toolbox based on MMSegmentation.
Apache License 2.0
908 stars 105 forks source link

Question about custom depth dataset depth-scale. #99

Open supremewu11 opened 1 month ago

supremewu11 commented 1 month ago

Thanks to your contribution in depth estimation aera. I have a question—— how to define depth-scale in my own custom depth dasaset.

zhyever commented 1 week ago

Thanks! Sorry for the late reply and I just finished some work. As far as I see, you can loop over the entire dataset and simply look for the max value in your depth dataset. Note that you might need to convert the raw depth value correctly.

supremewu11 commented 1 week ago

It's OK, thanks for your reply , I'll have a try for the max value in my depth dataset. If I define the depth-scale as the max value in my dataset, then the depth ground-truth is between 0 to 1, in this case, the calculation of the depth metrics would be wrong in order of magnitudes. Do I need to let the predition depth values multiply depth-scale to recover original depth? And how to convert the raw depth value correctly, what do I need to do. Looking forward to your reply, these questions confuse me for a long time.

zhyever commented 1 week ago

Suppose the depth range of your dataset is from 0 to 5m. What you need to do is to set the max_depth in model config to 5. For example, this line defines the max prediction depth for binsformer model. Moreover, please also check the dataset process pipeline to ensure the depth fed to the loss function is in the right range.

The idea is simple. Suppose you are supervising the model with a gt from range of a to b. The model will predict depth from a to b. If you have construct a map from the real depth to the gt (a to b), you can simply convert the prediction depth back to the real depth range from the inversed map function.

For loading the raw depth, it depends on your file format.

supremewu11 commented 1 week ago

Got it. I'll try it immediately. Thank you so much.