facebookresearch / localrf

An algorithm for reconstructing the radiance field of a large-scale scene from a single casually captured video.
MIT License
956 stars 62 forks source link

Masking ray sampling #12

Open Khoa-NT opened 1 year ago

Khoa-NT commented 1 year ago

Hi,

Because my dataset has black regions in the images, I would like to ask how I can add my mask for ray sampling to avoid those black regions.

I checked the code and I think I should start from idx_sample. Do I have to be aware anywhere else? Thank you.

ameuleman commented 1 year ago

The easiest would be to add a mask that zeros the loss. Would this suit your needs?

ameuleman commented 1 year ago

Hi, The dataloader uses the valid masks in ${SCENE_DIR}/masks if they exist. Masks should have the same names as the files in images except for the extension that should be .png. Masks are then used to weigh the loss so that zero areas don't affect the training.

Khoa-NT commented 1 year ago

Hi, Thank you for updating the code. Currently, I'm using my modified version at this line which is random.choice only index inside the mask.

I will test your new update and compare it.