• Stars
    star
    142
  • Rank 258,442 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created over 2 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[CVPR 2022] Code for StylizedNeRF: Consistent 3D Scene Stylization as Stylized NeRF via 2D-3D mutual learning

StylizedNeRF (Jittor): Consistent 3D Scene Stylization as Stylized NeRF via 2D-3D mutual learning

Introduction

This repository is code release for StylizedNeRF: Consistent 3D Scene Stylization as Stylized NeRF via 2D-3D mutual learning.

3D scene stylization aims at generating stylized images of the scene from arbitrary novel views following a given set of style examples, while ensuring consistency when rendered from different views. Directly applying methods for image or video stylization to 3D scenes cannot achieve such consistency. Thanks to recently proposed neural radiance fields (NeRF), we are able to represent a 3D scene in a consistent way. Consistent 3D scene stylization can be effectively achieved by stylizing the corresponding NeRF. However, there is a significant domain gap between style examples which are 2D images and NeRF which is an implicit volumetric representation. To address this problem, we propose a novel mutual learning framework for 3D scene stylization that combines a 2D image stylization network and NeRF to fuse the stylization ability of 2D stylization network with the 3D consistency of NeRF. We first pre-train a standard NeRF of the 3D scene to be stylized and replace its color prediction module with a style network to obtain a stylized NeRF. It is followed by distilling the prior knowledge of spatial consistency from NeRF to the 2D stylization network through an introduced consistency loss. We also introduce a mimic loss to supervise the mutual learning of the NeRF style module and fine-tune the 2D stylization decoder. In order to further make our model handle ambiguities of 2D stylization results, we introduce learnable latent codes that obey the probability distributions conditioned on the style. They are attached to training samples as conditional inputs to better learn the style module in our novel stylized NeRF. Experimental results demonstrate that our method is superior to existing approaches in both visual quality and long-range consistency.

Installation

The code is tested with Ubuntu 18.04, Python 3.8, Jittor 1.2.2.58, CUDA 10.0 and cuDNN v7.5.

Set Up Environment

[1] Run 'virtualenv stylenerf -p python3.7' to build a environment and 'source ./stylenerf/bin/activate' to activate it
[2] Run 'pip install -r requirements.txt' to install libraries (Notice that pytorch3d should be of version 0.4.0 !!!)

For the jittor installation, please refer to this link.

Data preprocessing

[1] Download the llff example data from official website http://cseweb.ucsd.edu/~viscomp/projects/LF/papers/ECCV20/nerf/nerf_example_data.zip
[2] Prepare style images in ./style for stylized NeRF training and ./all_styles for VAE

Pre-trained Model Preparation

[1] Download the checkpoints of the VGG to ./pretrained
[2] Train the decoder of AdaIN from scratch by running 'python train_style_modules.py --task finetune_decoder' or put the existing checkpoints of the decoder of AdaIN to ./pretrained
[3] Run 'python train_style_modules.py --task vae' to pre-train the VAE

Train and Evaluate a Stylized NeRF

[1] Run 'python run_stylenerf.py --config ./configs/fern.txt' to train our model
[2] Run 'python run_stylenerf.py --config ./configs/fern.txt --render_train_style --chunk 512' to check the outputs of the traning views
[3] Run 'python run_stylenerf.py --config ./configs/fern.txt --render_valid_style --chunk 512' to check the outputs of the novel views

Citation

If you find our work useful in your research, please consider citing:

@inproceedings{Huang22StylizedNeRF,
    author = {Huang, Yi-Hua and He, Yue and Yuan, Yu-Jie and Lai, Yu-Kun and Gao, Lin},
    title = {StylizedNeRF: Consistent 3D Scene Stylization as Stylized NeRF via 2D-3D Mutual Learning },
    booktitle={Computer Vision and Pattern Recognition (CVPR)},
    year = {2022},
}

@article{hu2020jittor,
  title={Jittor: a novel deep learning framework with meta-operators and unified graph execution},
  author={Hu, Shi-Min and Liang, Dun and Yang, Guo-Ye and Yang, Guo-Wei and Zhou, Wen-Yang},
  journal={Science China Information Sciences},
  volume={63},
  number={222103},
  pages={1--21},
  year={2020}
}

More Repositories

1

DeepFaceDrawing-Jittor

Python
756
star
2

DeepFaceEditing-Jittor

Python
282
star
3

NeRF-Editing

[CVPR 2022] Code for "NeRF-Editing: Geometry Editing of Neural Radiance Fields"
C++
186
star
4

NeUDF

The code for "NeUDF: Leaning Neural Unsigned Distance Fields with Volume Rendering (CVPR 2023)"
Python
153
star
5

DeepFaceVideoEditing

Python
110
star
6

SketchFaceNeRF

Python
102
star
7

DSG-Net

Code for 'DSG-Net: Learning Disentangled Structure and Geometry for 3D Shape Generation'
Python
84
star
8

NeRFFaceLighting

[TOG'23] NeRFFaceLighting: Implicit and Disentangled Face Lighting Representation Leveraging Generative Prior in Neural Radiance Fields
Jupyter Notebook
76
star
9

OctField

Code for "OctField: Hierarchical Implicit Functions for 3D Modeling (NeurIPS 2021)"
Python
61
star
10

IBSR_jittor

Code for 'Single Image 3D Shape Retrieval via Cross-Modal Instance and Category Contrastive Learning', ICCV 2021
Python
52
star
11

SketchDream

Python
43
star
12

RisaNET

Code for "RISA-Net: Rotation-Invariant and Structure-Aware Network for Fine-grained 3D Shape Retrieval"
Python
40
star
13

PRS-Net

Python
34
star
14

TM-NET

Python
33
star
15

MeshPooling

Code for 'Mesh Variational Autoencoders with Edge Contraction Pooling'
Python
33
star
16

RGBDNeRF

Code for "Neural Radiance Fields from Sparse RGB-D Images for High-Quality View Synthesis"
Python
27
star
17

NeRFFaceEditing

[SIGGRAPH Asia'22] NeRFFaceEditing: Disentangled Face Editing in Neural Radiance Fields
Jupyter Notebook
25
star
18

MeshVAE_neural_editing

Python
24
star
19

NEURALSLICE

The code of "NEURALSLICE: Neural 3D Triangle Mesh Reconstruction via Slicing 4D Tetrahedral Meshes (ICML 2023)"
Roff
23
star
20

TM-NET-Jittor

Python
20
star
21

PRS-NET-Jittor

Python
20
star
22

Stylemotion

Python
19
star
23

Farthestsampling

Furthest sampling and Voronoi sampling on 3D mesh
C++
19
star
24

DynamicHumanGeneration_Jittor

Python
17
star
25

intrinsicSym-Jittor

C++
17
star
26

HSDF-Net

The code for "HSDF: Hybrid Sign and Distance Field for Modeling Surfaces with Arbitrary Topologies (NeurIPS 2022)"
Python
15
star
27

MT_DE-Jittor

Python
13
star
28

PRS-Net_stamp

Python
12
star
29

GLIM-Net

Python
2
star
30

Fungal_Keratitis_Classification

Python
1
star