zhyever / Monocular-Depth-Estimation-Toolbox

Monocular Depth Estimation Toolbox based on MMSegmentation.
Apache License 2.0
903 stars 104 forks source link

How to provide valid_mask for training ? #97

Closed SimondeMoreau closed 6 months ago

SimondeMoreau commented 6 months ago

Hello,

I would like to train depthformer using sparse depth map (private dataset). My depth maps are obtained from lidar projected point with a max range of 100m. All the pixels without projected lidar point are pixel we don't want to consider for training.

I put them to +inf value but I didn't found how to provide the valid mask excluding point > max_depth. And I don't think it's already done because the training don't converge at all. And the valid mask provided inside the dataset class seems to be used only for eval.

Any ideas how I can exclude those pixels from the loss calculation ?

zhyever commented 6 months ago

Hi, you can check https://github.com/zhyever/Monocular-Depth-Estimation-Toolbox/blob/7c0c89c8db07631fec1737f3087e4f1f540ccd53/depth/models/losses/sigloss.py#L8

You can set the depth of invalid pixels as zero and set the max_depth in sigloss as 100.

SimondeMoreau commented 6 months ago

Hi,

It worked ! Thank you !