Code Monkey home page Code Monkey logo

srf's Introduction

Stereo Radiance Fields

Julian Chibane, Aayush Bansal, Verica Lazova, Gerard Pons-Moll
Stereo Radiance Fields (SRF): Learning View Synthesis for Sparse Views of Novel Scenes
In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021

Teaser

Paper - Supplementaty - Video - Project Website - Arxiv - If you find our project useful, please cite us. Citation (Bibtex)

Install

A linux system with python environment manager conda is required for the project.

The following commands clone the repo on your machine and install an environment, "srf", containing all dependencies.

git clone https://github.com/jchibane/srf.git
cd SRF_git
conda env create -f srf_env.yml

Quick Start with Pretrained Model

To synthesise novel views of a pretrained and finetuned model use the following command

python generator.py --config configs/finetune_scan23.txt --generate_specific_samples scan23 --gen_pose 0

where --gen_pose is a camera pose of a video sequence from 0-51 (including both). We also provide a second model that can be used by switching both "23" to "106" in the previous command.

In order to do a 3D reconstruction please run:

python 3d_reconstruction.py --config configs/finetune_scan106.txt --generate_specific_samples scan106

Note: The above configuration uses a batch of 250 rays to render at once, which assumes a ~48GB GPU. Consider adjusting this number in case of memory issues, by adding --N_rays_test X, with a suited number X to previous command. Smaller batches will lead to increased generation time. Moreover, RAM usage can be reduced by setting --render_factor X (with X=8 or 16) for image generation.

Training

Data Setup

With the next commands the DTU MVS dataset is downloaded and put in place.

wget http://roboimagedata2.compute.dtu.dk/data/MVS/Rectified.zip -P data/
unzip data/Rectified.zip -d data/
mv data/Rectified/* data/DTU_MVS
rmdir data/Rectified

Start Training

Start to train a model with a specific configuration file using:

python trainer.py --config configs/train_DTU.txt

####Fine-tuning Next we optimize a model trained in the previous step on a specific scene given by 11 test images.

Create a new experiment folder containing the trained model:

mkdir logs/start_finetuning_scan23
cp logs/train_DTU/<your-val-min-checkpoint>.tar logs/start_finetuning_scan23/

And start fine-tuning with:

python trainer.py --config configs/start_finetuning_scan23.txt

Initial improvements are obtained at 1k iterations, further improvements are obtained around 3k and 13k iterations. After training, novel view synthesis and 3D reconstruction can be performed as seen in the above quickstart, but specifying the corresponding configuration file.

To fine-tune on a different scan, say with ID X, copy the config file configs/start_finetune_scan23.txt

cp configs/start_finetune_scan23.txt configs/start_finetune_scanX.txt

and change "scan23" to "scanX" in the expname, fine_tune and generate_specific_samples variables of the configuration, where X is the ID of the desired scan. Similarly, you'd need to change "scan23" to "scanX" in the above experiment folder name.

Contact

For questions and comments please contact Julian Chibane via mail.

License

Copyright (c) 2021 Julian Chibane, Max-Planck-Gesellschaft

By downloading and using this code you agree to the terms in the LICENSE.

You agree to cite the Stereo Radiance Fields (SRF): Learning View Synthesis for Sparse Views of Novel Scenes paper in any documents that report on research using this software or the manuscript.

Show LICENSE (click to expand) Please read carefully the following terms and conditions and any accompanying documentation before you download and/or use this software and associated documentation files (the "Software").

The authors hereby grant you a non-exclusive, non-transferable, free of charge right to copy, modify, merge, publish, distribute, and sublicense the Software for the sole purpose of performing non-commercial scientific research, non-commercial education, or non-commercial artistic projects.

Any other use, in particular any use for commercial purposes, is prohibited. This includes, without limitation, incorporation in a commercial product, use in a commercial service, or production of other artefacts for commercial purposes. For commercial inquiries, please see above contact information.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You understand and agree that the authors are under no obligation to provide either maintenance services, update services, notices of latent defects, or corrections of defects with regard to the Software. The authors nevertheless reserve the right to update, modify, or discontinue the Software at any time.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

srf's People

Contributors

jchibane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

srf's Issues

What is the N_rand to reproduce paper result?

Hi, I am using a Tesla V100, and I can only run the training script with N_rand set to 64, but the default N_rand is 4096. Are you using that big batch size during the training?

split.pkl was removed from the GitHub repository

Based on the latest version, I got this error:
FileNotFoundError: [Errno 2] No such file or directory: './data/DTU_MVS//split.pkl'

I tried to copy the original split_shuffle.pkl to that location and it works. I guess you should not remove that file?

Multi-GPU Training

Hi @jchibane,

Is your code capable of multi-GPU training? That would be very helpful for training on large datasets.

Thanks!

near and far values in config

Hello, I was wondering how the near and far values were decided upon for ray sampling.
The near value = 500, far =1000 at the moment, how were this decided? and if I were to be trying on a different dataset, on what basis should I choose and near and far values?

How to run it on one GPU(2080Ti)?

Good job, but when I execute the 'generator.py' code, the computer stops working. What are the parameters when there is only one GPU?

How to run it on one GPU(2080Ti)?

Good job, but when I execute the 'generator.py' code, the computer stops working. What are the parameters when there is only one GPU?

training requirement of GPU memory

Hi,

Thank you for releasing the code.

I am trying to train this model on my dataset. I just revised the dataset-setup code. The resolution of my image is 2000x2000. and I set ref_imgs number to 5. The GPU is RTX 2080 with 12GB memory. I try to train this model several times, but I got the following err message:

image

So I want to ask the requirement of GPU memory for training this model.

Best,
Hengfei

name 'images' is not defined

File "E:\OTHERS_WORKS\srf\srf\dataloader.py", line 101, in getitem
imgs, poses, poses_idx = DTU.load_scan_data(sample, self.load_mode, self.num_reference_views + 1, self.cfg, self.load_specific_reference_poses, self.load_fixed, self.shuffle)
File "E:\OTHERS_WORKS\srf\srf\data\load_DTU.py", line 59, in load_scan_data
poses_idx = random.sample(images[scan],num_views)
NameError: name 'images' is not defined

Custom datasets and camera extrinsics.

Hello jchibane, I'm wondering whether your code can be applied to other datasets such as ShapeNet and custom blender datasets.
How did you get the raw pose_extrinsics for the DTU dataset ?
image
Thanks.

Failed to compile torchsearchsorted

Thanks for this valuable work!

I failed to run pip install torchsearchsorted/. I have Ubuntu 18.04 + GCC v8.4 + CUDA 10.1 + python 3.6.12 + pytorch 1.6.
But on another Ubuntu 16.04 (GCC 5.4) machine, it can be compiled successfully.

Is that an error due to any package version issues? Could you please help? Thanks!

Here I show one of the error messages (more detailed error messages can be provided upon request):

    ninja: build stopped: subcommand failed.       
  Traceback (most recent call last):                    
    File "/home/t-yizhouwang/anaconda3/envs/srf/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1515, in _run_ninja_build 
      env=env)                                                                    
    File "/home/t-yizhouwang/anaconda3/envs/srf/lib/python3.6/subprocess.py", line 438, in run
      output=stdout, stderr=stderr)  
  subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1. 

Memory leak during inference

Hi, I am attempting for novel view synthesis by running the pretrained inference with the provided command and code.
Even if I reduce the number of ray samples, the memory was exploding (500G memory + a lot of swap on the machine). Does anybody else experience this? or could the author kindly comment on this?

Obtaining 3D mesh as in Fig6

Hi, I was hoping to obtain the 3D mesh as shown in Figure 6. I assume you'd follow the steps to threshold the density predictions and run Marching cubes on a dense grid of points. Could you perhaps provide the exact detail? or upload the code to obtain the paper's Figure6 mesh output?

thanks,

Pre-trained ckpt files are out of date

When I run inference using the latest code, I got this error:
KeyError: 'sim_combinations' at

srf/model.py

Line 213 in ce97b27

self.model.combis_list = ckpt['sim_combinations']

I guess the pre-trained ckpt files are out of date without this key included? (Comment this line out will work for inference.) Thanks!

coordinate system

Dear author,

can you give more explainations to following two coordinate system?
x_down_y_down_z_cam_dir
x_down_y_up_z_neg_cam_dir

How can I draw to visualize the xyz axises?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.