PJLab-ADG / neuralsim

neuralsim: 3D surface reconstruction and simulation based on 3D neural rendering.
MIT License
582 stars 31 forks source link

neuralsim

3D surface reconstruction and simulation based on 3D neural rendering.

This repository primarily addresses two topics:

TOC

Implicit surface is all you need !

Single-object / multi-object / indoor / outdoor / large-scale surface reconstruction and multi-modal sensor simulation
:rocket: Object surface reconstruction in minutes !
Input: posed images without mask
Get started: neus_in_10_minutes
Credits: Jianfei Guo
teaser_training_bmvs_gundam
:rocket: Outdoor surface reconstruction in minutes !
Input: posed images without mask
Get started: neus_in_10_minutes
Credits: Jianfei Guo
teaser_training_bmvs_village_house
:rocket: Indoor surface reconstruction in minutes !
Input: posed images, monocular cues
Get started: neus_in_10_minutes#indoor
Credits: Jianfei Guo
:car: Categorical surface reconstruction in the wild !
Input: multi-instance multi-view categorical images
[To be released 2023.09]
Credits: Qiusheng Huang, Jianfei Guo, Xinyang Li
:motorway: Street-view surface reconstruction in 2 hours !
Input: posed images, monocular cues (and optional LiDAR)
Get started: streetsurf
Credits: Jianfei Guo, Nianchen Deng
(Refresh if video won't play)
:motorway: Street-view multi-modal sensor simulation !
Using reconstructed asset-bank
Get started: streetsurf#lidarsim
Credits: Jianfei Guo, Xinyu Cai, Nianchen Deng
(Refresh if video won't play)
:motorway: Street-view multi-object surfaces reconstruction in hours !
Input: posed images, LiDAR, 3D tracklets
Get started:
Credits: Jianfei Guo, Nianchen Deng
(Refresh if video won't play)
:motorway: Street-view multi-dynamic-object surfaces reconstruction in hours !
:rocket: Support dynamic pedestrians, cyclists, etc.
Credits: Jianfei Guo
(Refresh if video won't play)
:motorway: Street-view scenario editing !
Using reconstructed asset-bank
Credits: Jianfei Guo, Nianchen Deng (Refresh if video won't play)
:motorway: Street-view light editing ... (WIP)

Highlighted implementations

Methods :rocket: Get started Official / Un-official Notes, major difference from paper, etc.
StreetSurf readme Official - LiDAR loss improved
NeuralSim readme Official - support foreground categories: vehicles, pedestrians, cyclists, etc.
- support arbitrary unannotated dynamic objects
- support decomposition of camera lens dirt, lens flares, etc.
NeuS in minutes readme Un-official - support object-centric datasets as well as indoor datasets
- fast and stable convergence without needing mask
- support using NGP / LoTD or MLPs as fg&bg representations
- large pixel batch size (4096) & pixel error maps
NGP with LiDAR readme Un-official - using Urban-NeRF's LiDAR loss

Updates

Highlights

:hammer_and_wrench: Multi-object volume rendering

Code: app/renderers/buffer_compose_renderer.py

> Scene graph structure

Code: app/resources/scenes.py app/resources/nodes.py

To streamline the organization of assets and transformations, we adopt the concept of generic scene graphs used in modern graphics engines like magnum.

Any entity that possesses a pose or position is considered a node. Certain nodes are equipped with special functionalities, such as camera operations or drawable models (i.e. renderable assets in AssetBank).

scene_graph

Real-data scene graph Real-data frustum culling
vis_scene_graph vis_frustum_culling

> Efficient and universal

We provide a universal implementation of multi-object volume rendering that supports any kind of methods built for volume rendering, as long as a model can be queried with rays and can output opacity_alpha, depth samples t, and other optional fields like rgb, nablas, features, etc.

This renderer is efficient mainly due to:

The figure below depicts the idea of the whole rendering process.

We ray-march every model first, then sort the samples with different model sources on each ray to jointly volume render multiple objects.

multi_object_volume_render

> Support dynamic (non-rigid) categories and allow un-annotated dynamics

We also support efficient neural surface reconstruction for pedestrians, cyclists and other dynamic / non-rigid categories.

Multi-instance occ. grids
accumulated in training
Multi-timestamp occ. grids
accumulated in training
occ_grid_batched occ_grid_dynamic
Multi-instance & multi-frame occupancy grids accumulated in training
x-axis for different instances of pedestrians
y-axis for different timestamps for one pedestrian
occ_grid_batched_dynamic

Robust reconstruction in the wild

> Pose estimation for ego motion and other objects

Accomplished by the Attribute implementation in [nr3d_lib/attributes]

> Camera effect disentanglement

Lens flare Lens dirt / raindrop
lens_flare_9385013 lens_dirt_1009661

:bank: Editable assetbank

Code: code_multi/tools/manipulate.py (WIP)

Given that different objects are represented by unique networks (for categorical or shared models, they have unique latents or embeddings), it's possible to explicitly add, remove or modify the reconstructed assets in a scene.

We offer a toolkit for performing such scene manipulations. Some of the intriguing edits are showcased below.

:dancer: Let them dance ! :twisted_rightwards_arrows: Multi-verse :art: Change their style !
(Refresh if video won't play) (Refresh if video won't play) (Refresh if video won't play)
Credits to Qiusheng Huang and Xinyang Li.

Please note, this toolkit is currently in its early development stages and only basic edits have been released. Stay tuned for updates, and contributions are always welcome :)

:camera: Multi-modal sensor simulation

> LiDARs

Code: app/resources/observers/lidars.py

Get started:

Credits to Xinyu Cai's team work, we now support simulation of various real-world LiDAR models.

The volume rendering process is guided by our reconstructed implicit surface scene geometry, which guarantees accurate depths. More details on this are in our StreetSurf paper section 5.1.

> Cameras

Code: app/resources/observers/cameras.py

We now support pinhole camera, standard OpenCV camera models with distortion, and an experimental fisheye camera model.

Usage

Installation

First, clone with submodules:

git clone https://github.com/pjlab-ADG/neuralsim --recurse-submodules -j8 ...

Then, cd into nr3d_lib and refer to nr3d_lib/README.md for the following steps.

code_single Single scene

Please refer to code_single/README.md

code_multi Multi-object scene

Please refer to code_multi/README.md

Roadmap & TODOs

Pull requests and collaborations are warmly welcomed :hugs:! Please follow our code style if you want to make any contribution.

Feel free to open an issue or contact Jianfei Guo (ffventus@gmail.com) or Nianchen Deng (dengnianchen@pjlab.org.cn) if you have any questions or proposals.

Acknowledgements & citations

@article{guo2023streetsurf,
  title = {StreetSurf: Extending Multi-view Implicit Surface Reconstruction to Street Views},
  author = {Guo, Jianfei and Deng, Nianchen and Li, Xinyang and Bai, Yeqi and Shi, Botian and Wang, Chiyu and Ding, Chenjing and Wang, Dongliang and Li, Yikang},
  journal = {arXiv preprint arXiv:2306.04988},
  year = {2023}
}
@inproceedings{wang2021neus,
    title={NeuS: Learning Neural Implicit Surfaces by Volume Rendering for Multi-view Reconstruction},
    author={Wang, Peng and Liu, Lingjie and Liu, Yuan and Theobalt, Christian and Komura, Taku and Wang, Wenping},
    booktitle={Proc. Advances in Neural Information Processing Systems (NeurIPS)},
    volume={34},
    pages={27171--27183},
    year={2021}
}