liuyuan-pal / NeuRay

[CVPR2022] Neural Rays for Occlusion-aware Image-based Rendering
GNU General Public License v3.0
408 stars 31 forks source link

What's the difference of use_src_img and not use_src_img? #18

Closed EchoTHChen closed 2 years ago

EchoTHChen commented 2 years ago

Hello. This is a great work. But I meet some problem in understanding this code.

In dataset/train_dataset.py, there are some code I do not understand.

ref_imgs_info, ref_cv_idx, ref_real_idx = build_src_imgs_info_select(database,ref_ids,ref_ids_all,self.cfg['cost_volume_nn_num'])
....
if self.cfg['use_src_imgs']:
    src_imgs_info = ref_imgs_info.copy()
    ref_imgs_info = imgs_info_slice(ref_imgs_info, ref_real_idx)
    ref_imgs_info['nn_ids'] = ref_cv_idx
else:
    # 'nn_ids' used in constructing cost volume (specify source image ids)
    ref_imgs_info['nn_ids'] = ref_idx.astype(np.int64)

What do the src_imgs and ref_imgs mean respectively? Why do you directly assign the copy of ref_imgs_info to src_imgs_info?

And what do ref_cv_idx and ref_real_idx respectively mean?

liuyuan-pal commented 2 years ago

Hi, for rendering a query image, we will use 8 neighboring reference images. In order to construct cost volume on each reference image, we will further select source images whose poses are neighboring to the reference image.

use_src_img indicates how we select source images.

  1. If use_src_img=False, then we will select source images from these 8 reference images.
  2. If use_src_img=True, we will select source images from all input images. In this case, we will include more than 8 images in computation. ref_cv_idx indicates which images are used as source images for a specific reference image. ref_real_idx indicates the selected 8 reference images for rendering the query image.
EchoTHChen commented 2 years ago

Thanks!