Code for "NeRS: Neural Reflectance Surfaces for Sparse-View 3D Reconstruction in the Wild," in NeurIPS 2021

Related tags

Deep Learning ners
Overview

Code for Neural Reflectance Surfaces (NeRS)

[arXiv] [Project Page] [Colab Demo] [Bibtex]

This repo contains the code for NeRS: Neural Reflectance Surfaces.

The code was tested with the following dependencies:

  • Python 3.8.6
  • Pytorch 1.7.0
  • Pytorch3d 0.4.0
  • CUDA 11.0

Installation

Setup

We recommend using conda to manage dependencies. Make sure to install a cudatoolkit compatible with your GPU.

git clone [email protected]:jasonyzhang/ners.git
conda create -n ners python=3.8
cond activate pytorch3d
conda install -c pytorch pytorch=1.7.0 torchvision cudatoolkit=11.0
pip install -r requirements.txt

Installing Pytorch3d

Here, we list the recommended steps for installing Pytorch3d. Refer to the official installation directions for troubleshooting and additional details.

mkdir -p external
git clone https://github.com/facebookresearch/pytorch3d.git external/pytorch3d
cd external/pytorch3d
conda install -c conda-forge -c fvcore -c iopath fvcore iopath
conda install -c bottler nvidiacub
python setup.py install

If you need to compile for multiple architectures (e.g. Turing for 2080TI and Maxwell for 1080TI), you can pass the architectures as an environment variable, i.e. TORCH_CUDA_ARCH_LIST="Maxwell;Pascal;Turing;Volta" python setup.py install.

If you get a warning about the default C/C++ compiler on your machine, you should compile Pytorch3D using the same compiler that your pytorch installation uses, likely gcc/g++. Try: CC=gcc CXX=g++ python setup.py install.

Acquiring Object Masks

To get object masks, we recommend using PointRend for COCO classes or GrabCut for other categories.

If using GrabCut, you can try this interactive segmentation tool.

Running the Code

Running on MVMC

Coming Soon!

Running on Your Own Objects

We recommend beginning with the demo notebook so that you can visualize the intermediate outputs. The demo notebook generates the 3D reconstruction and illumination prediction for the espresso machine (data included). You can also run the demo script:

python main.py --instance-dir data/espresso --symmetrize --export-mesh --predict-illumination

We also provide a Colab notebook that runs on a single GPU. Note that the Colab demo does not include the view-dependent illumination prediction. At the end of the demo, you can view the turntable NeRS rendering and download the generated mesh as an obj.

To run on your own objects, you will need to acquire images and masks. See data/espresso for an example of the expected directory structure.

We also provide the images and masks for all objects in the paper. All objects except hydrant and robot should have a --symmetrize flag.

gdown  https://drive.google.com/uc?id=1JWuofTIlcLJmmzYtZYM2SvZVizJCcOU_
unzip -f misc_objects.zip -d data

Citing NeRS

If you use find this code helpful, please consider citing:

@inproceedings{zhang2021ners,
  title={{NeRS}: Neural Reflectance Surfaces for Sparse-view 3D Reconstruction in the Wild},
  author={Zhang, Jason Y. and Yang, Gengshan and Tulsiani, Shubham and Ramanan, Deva},
  booktitle={Conference on Neural Information Processing Systems},
  year={2021}
}
Comments
  • Evaluation set used in paper?

    Evaluation set used in paper?

    @jasonyzhang Thanks for the awesome work and public code!! In this paper, 20 actors in MVMC dataset are used for quantative evaluation, could you please share the actor ids on evalution set for easier comparisons?

    Thanks for your great help!

    opened by wangjksjtu 10
  • RuntimeError: unexpected EOF, expected 206450068 more bytes. The file might be corrupted.

    RuntimeError: unexpected EOF, expected 206450068 more bytes. The file might be corrupted.

    lpips.LPIPS(net=net, verbose=False)

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/hyang/.conda/envs/ners/lib/python3.8/site-packages/lpips/lpips.py", line 84, in __init__
        self.net = net_type(pretrained=not self.pnet_rand, requires_grad=self.pnet_tune)
      File "/home/hyang/.conda/envs/ners/lib/python3.8/site-packages/lpips/pretrained_networks.py", line 99, in __init__
        vgg_pretrained_features = tv.vgg16(pretrained=pretrained).features
      File "/home/hyang/.conda/envs/ners/lib/python3.8/site-packages/torchvision/models/vgg.py", line 152, in vgg16
        model.load_state_dict(model_zoo.load_url(model_urls['vgg16']))
      File "/home/hyang/.conda/envs/ners/lib/python3.8/site-packages/torch/hub.py", line 559, in load_state_dict_from_url
        return torch.load(cached_file, map_location=map_location)
      File "/home/hyang/.conda/envs/ners/lib/python3.8/site-packages/torch/serialization.py", line 595, in load
        return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
      File "/home/hyang/.conda/envs/ners/lib/python3.8/site-packages/torch/serialization.py", line 781, in _legacy_load
        deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
    RuntimeError: unexpected EOF, expected 206450068 more bytes. The file might be corrupted.
    
    opened by SimonCK666 3
  • How to generate dataset  metadata.json

    How to generate dataset metadata.json

    Hello, Thank you for giving an excellent nerf variant! Now i would like to make myself dataset for the wild using this, then could you please show me how to generate the data using which tool? especially how to generate the metadata.json.

    Regards

    opened by hzhshok 1
  • Specifying cuboid extents

    Specifying cuboid extents

    I really appreciate the time and effort you put into this project, it would be great if someone would elaborate the how to specify cuboid extents in json file.

    opened by hniksoleimani 1
  • Running on existing datasets like SRN

    Running on existing datasets like SRN

    Hi, Really interesting paper. I was trying to run the notebook on SRN data which contains pose information and camera intrinsic. But using that pose seems to be giving incorrect results in visualization. image In this, I am taking the inverse of the rotation matrix available with these images. Any help would be really appreciated!

    Thanks

    opened by subClassy 1
  • How to get better result?

    How to get better result?

    Hi, Thanks for the wonderful repo, which generates 3D models for real-life photos in the wild !! I tried applying it for images of a doll. Gave 8 images as input covering different angles, in colab notebook. But results aren't good. (PFA). What can be done to improve the results?

    https://user-images.githubusercontent.com/110157037/194704276-03d51202-4940-474d-99ee-7dcf7787d1a5.mp4

    image

    opened by mln-wave 1
  • Creating metadata.json file for my own dataset

    Creating metadata.json file for my own dataset

    Hi I want to run this net on my own dataset I have images and masks also the calibration file that I got from metashep including interior and exterior orientations but I dont know how to create metadata.json file as it is required to run your code

    would you please let me know how can I create this file

    best regards Ali

    opened by AliKaramiFBK 4
Companion code for the paper "An Infinite-Feature Extension for Bayesian ReLU Nets That Fixes Their Asymptotic Overconfidence" (NeurIPS 2021)

ReLU-GP Residual (RGPR) This repository contains code for reproducing the following NeurIPS 2021 paper: @inproceedings{kristiadi2021infinite, title=

Agustinus Kristiadi 4 Dec 26, 2021
This repo includes our code for evaluating and improving transferability in domain generalization (NeurIPS 2021)

Transferability for domain generalization This repo is for evaluating and improving transferability in domain generalization (NeurIPS 2021), based on

gordon 9 Nov 29, 2022
Code for MarioNette: Self-Supervised Sprite Learning, in NeurIPS 2021

MarioNette | Webpage | Paper | Video MarioNette: Self-Supervised Sprite Learning Dmitriy Smirnov, Michaël Gharbi, Matthew Fisher, Vitor Guizilini, Ale

Dima Smirnov 28 Nov 18, 2022
Code for Parameter Prediction for Unseen Deep Architectures (NeurIPS 2021)

Parameter Prediction for Unseen Deep Architectures (NeurIPS 2021) authors: Boris Knyazev, Michal Drozdzal, Graham Taylor, Adriana Romero-Soriano Overv

Facebook Research 462 Jan 3, 2023
Code for our NeurIPS 2021 paper 'Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation'

Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation (NeurIPS 2021) Code for our NeurIPS 2021 paper 'Exploiting the Intri

Shiqi Yang 53 Dec 25, 2022
Official code for On Path Integration of Grid Cells: Group Representation and Isotropic Scaling (NeurIPS 2021)

On Path Integration of Grid Cells: Group Representation and Isotropic Scaling This repo contains the official implementation for the paper On Path Int

Ruiqi Gao 39 Nov 10, 2022
This GitHub repository contains code used for plots in NeurIPS 2021 paper 'Stochastic Multi-Armed Bandits with Control Variates.'

About Repository This repository contains code used for plots in NeurIPS 2021 paper 'Stochastic Multi-Armed Bandits with Control Variates.' About Code

Arun Verma 1 Nov 9, 2021
Code for "Adversarial Attack Generation Empowered by Min-Max Optimization", NeurIPS 2021

Min-Max Adversarial Attacks [Paper] [arXiv] [Video] [Slide] Adversarial Attack Generation Empowered by Min-Max Optimization Jingkang Wang, Tianyun Zha

Jingkang Wang 12 Nov 23, 2022
[NeurIPS 2021] Code for Unsupervised Learning of Compositional Energy Concepts

Unsupervised Learning of Compositional Energy Concepts This is the pytorch code for the paper Unsupervised Learning of Compositional Energy Concepts.

null 45 Nov 30, 2022
Source code of NeurIPS 2021 Paper ''Be Confident! Towards Trustworthy Graph Neural Networks via Confidence Calibration''

CaGCN This repo is for source code of NeurIPS 2021 paper "Be Confident! Towards Trustworthy Graph Neural Networks via Confidence Calibration". Paper L

null 6 Dec 19, 2022
Code repo for "RBSRICNN: Raw Burst Super-Resolution through Iterative Convolutional Neural Network" (Machine Learning and the Physical Sciences workshop in NeurIPS 2021).

RBSRICNN: Raw Burst Super-Resolution through Iterative Convolutional Neural Network An official PyTorch implementation of the RBSRICNN network as desc

Rao Muhammad Umer 6 Nov 14, 2022
[NeurIPS 2021 Spotlight] Code for Learning to Compose Visual Relations

Learning to Compose Visual Relations This is the pytorch codebase for the NeurIPS 2021 Spotlight paper Learning to Compose Visual Relations. Demo Imag

Nan Liu 88 Jan 4, 2023
Code for Subgraph Federated Learning with Missing Neighbor Generation (NeurIPS 2021)

To run the code Unzip the package to your local directory; Run 'pip install -r requirements.txt' to download required packages; Open file ~/nips_code/

null 32 Dec 26, 2022
Code for NeurIPS 2021 paper: Invariant Causal Imitation Learning for Generalizable Policies

Invariant Causal Imitation Learning for Generalizable Policies Ioana Bica, Daniel Jarrett, Mihaela van der Schaar Neural Information Processing System

Ioana Bica 17 Dec 1, 2022
Official implementation of NeurIPS 2021 paper "One Loss for All: Deep Hashing with a Single Cosine Similarity based Learning Objective"

Official implementation of NeurIPS 2021 paper "One Loss for All: Deep Hashing with a Single Cosine Similarity based Learning Objective"

Ng Kam Woh 71 Dec 22, 2022
[NeurIPS 2021] Galerkin Transformer: a linear attention without softmax

[NeurIPS 2021] Galerkin Transformer: linear attention without softmax Summary A non-numerical analyst oriented explanation on Toward Data Science abou

Shuhao Cao 159 Dec 20, 2022
Reducing Information Bottleneck for Weakly Supervised Semantic Segmentation (NeurIPS 2021)

Reducing Information Bottleneck for Weakly Supervised Semantic Segmentation (NeurIPS 2021) The implementation of Reducing Infromation Bottleneck for W

Jungbeom Lee 81 Dec 16, 2022
[NeurIPS 2021] “Improving Contrastive Learning on Imbalanced Data via Open-World Sampling”,

Improving Contrastive Learning on Imbalanced Data via Open-World Sampling Introduction Contrastive learning approaches have achieved great success in

VITA 24 Dec 17, 2022
[NeurIPS 2021 Spotlight] Aligning Pretraining for Detection via Object-Level Contrastive Learning

SoCo [NeurIPS 2021 Spotlight] Aligning Pretraining for Detection via Object-Level Contrastive Learning By Fangyun Wei*, Yue Gao*, Zhirong Wu, Han Hu,

Yue Gao 139 Dec 14, 2022