Code Monkey home page Code Monkey logo

taichi-nerfs's Introduction

Taichi NeRFs

A PyTorch + Taichi implementation of instant-ngp NeRF training pipeline.

Installation

  1. Install PyTorch by python -m pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu116 (update the url with your installed CUDA Toolkit version number).
  2. Install taichi nightly via pip install -U pip && pip install -i https://pypi.taichi.graphics/simple/ taichi-nightly.
  3. Install requirements by pip install -r requirements.txt.
  4. If you plan to train with your own video, please install colmap via sudo apt install colmap or follow instructions at https://colmap.github.io/install.html.

Train with preprocessed datasets

Synthetic NeRF

Download Synthetic NeRF dataset and unzip it. Please keep the folder name unchanged.

We also provide a script to train the Lego scene from scratch, and display an interactive GUI at the end of the training.

./scripts/train_nsvf_lego.sh

Performance is measured on a Ubuntu 20.04 with an RTX3090 GPU.

Scene avg PSNR Training Time(20 epochs) GPU
Lego 35.0 208s RTX3090

To reach the best performance, here are the steps to follow:

  1. Your work station is running on Linux and has RTX 3090 Graphics card
  2. Follow the steps in Installation Section
  3. Uncomment --half2_opt to enable half2 optimization in the script, then ./scripts/train_nsvf_lego.sh. For now, half2 optimization is only supported on Linux with Graphics Card Architecture >Pascal.

360_v2 dataset

Download 360 v2 dataset and unzip it. Please keep the folder name unchanged. The default batch_size=8192 takes up to 18GB RAM on a RTX3090. Please adjust batch_size according to your hardware spec.

./scripts/train_360_v2_garden.sh

Train with your own video

Place your video in data folder and pass the video path to the script. There are several key parameters for producing a sound dataset for NeRF training. For a real scene, scale is recommended to set to 16. video_fps determines the number of images generated from the video, typically 150~200 images are sufficient. For a one minute video, 2 is a suitable number. Running this script will preprocess your video and start training a NeRF out of it:

./scripts/train_from_video.sh -v {your_video_name} -s {scale} -f {video_fps}

[Preview] Mobile Deployment

Using Taichi AOT, you can easily deploy a NeRF rendering pipeline on any mobile devices!

We're able to acheive real-time interactive on iOS devices.

Performance iPad Pro (M1) iPhone 14 Pro Max iPhone 14
Taichi Instant NGP 22.4 fps 18 fps 13.5 fps

Stay tuned, more cool demos are on the way! For business inquiries, please reach out us at [email protected].

Frequently asked questions (FAQ)

Q: Is CUDA the only supported Taichi backend? How about vulkan backend?

A: For the most efficient interop with PyTorch CUDA backend, training is mostly tested with Taichi CUDA backend. However it's pretty straightforward to switch to Taichi vulkan backend if interop is removed, check out this awesome taichi-ngp inference demo!

Q: I got OOM(Out of Memory) error on my GPU, what can I do?

A: Reduce batch_size passed to train.py! By default it's 8192 which fits a RTX3090, you should reduce this accordingly. For instance, batch_size=2048 is recommended on a RTX3060Ti.

Acknowledgement

The PyTorch interface of the training pipeline and colmap preprocessing are highly referred to:

taichi-nerfs's People

Contributors

jim19930609 avatar ailzhang avatar rexwangcc avatar erizmr avatar taichi-gardener avatar linyou avatar identxxy avatar

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.