{"id":13441138,"url":"https://github.com/VISION-SJTU/Lightning-NeRF","last_synced_at":"2025-03-20T11:35:29.333Z","repository":{"id":226749615,"uuid":"764785290","full_name":"VISION-SJTU/Lightning-NeRF","owner":"VISION-SJTU","description":"[ICRA 2024] Lightning NeRF: Efficient Hybrid Scene Representation for Autonomous Driving","archived":false,"fork":false,"pushed_at":"2024-07-22T06:38:29.000Z","size":193,"stargazers_count":99,"open_issues_count":4,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-08-01T03:33:16.965Z","etag":null,"topics":["3d-scene-reconstruction","nerf","nerfstudio","outdoor-scene-reconstruction","pytorch-implementation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VISION-SJTU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-28T17:51:49.000Z","updated_at":"2024-07-27T15:27:05.000Z","dependencies_parsed_at":"2024-04-18T02:47:02.714Z","dependency_job_id":"fc03e524-8f18-4e10-82b0-444246d3d10d","html_url":"https://github.com/VISION-SJTU/Lightning-NeRF","commit_stats":null,"previous_names":["vision-sjtu/lightning-nerf"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VISION-SJTU%2FLightning-NeRF","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VISION-SJTU%2FLightning-NeRF/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VISION-SJTU%2FLightning-NeRF/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VISION-SJTU%2FLightning-NeRF/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VISION-SJTU","download_url":"https://codeload.github.com/VISION-SJTU/Lightning-NeRF/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221752311,"owners_count":16874958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-scene-reconstruction","nerf","nerfstudio","outdoor-scene-reconstruction","pytorch-implementation"],"created_at":"2024-07-31T03:01:30.369Z","updated_at":"2024-10-28T00:31:58.385Z","avatar_url":"https://github.com/VISION-SJTU.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Lightning-NeRF ICRA 2024\n\n:page_facing_up: Lightning NeRF: Efficient Hybrid Scene Representation for Autonomous Driving\n\n:boy: Junyi Cao, Zhichao Li, Naiyan Wang, Chao Ma\n\n**Please consider citing our paper if you find it interesting or helpful to your research.**\n```\n@inproceedings{cao2024lightning,\n  title={{Lightning NeRF}: Efficient Hybrid Scene Representation for Autonomous Driving},\n  author={Cao, Junyi and Li, Zhichao and Wang, Naiyan and Ma, Chao},\n  booktitle={IEEE International Conference on Robotics and Automation (ICRA)},\n  year={2024}\n}\n```\n\n---\n\n### Introduction\n\nThis repository provides code to integrate the Lightning NeRF into [NeRFStudio](https://github.com/nerfstudio-project/nerfstudio/). Lightning NeRF is an efficient novel view synthesis framework for outdoor scenes that integrates point clouds and images. \n\nWe have provided a supplementary video that includes additional novel view synthesis results achieved by the method. Please access the video through these links: [Original Version](https://sjtueducn-my.sharepoint.com/:v:/g/personal/junyicao_sjtu_edu_cn/ES64j3f2_zVOlgASz5koaesB5hGixUalLpUtvRK0JwlQdQ?nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJPbmVEcml2ZUZvckJ1c2luZXNzIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXciLCJyZWZlcnJhbFZpZXciOiJNeUZpbGVzTGlua0NvcHkifX0\u0026e=R8Vp2g) (~170 MB) or [Compressed Version](https://sjtueducn-my.sharepoint.com/:v:/g/personal/junyicao_sjtu_edu_cn/EVL63zd6o6xMgd6HKGAYBTMBnTg73AYd2Op32fsjYtOB9A?nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJPbmVEcml2ZUZvckJ1c2luZXNzIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXciLCJyZWZlcnJhbFZpZXciOiJNeUZpbGVzTGlua0NvcHkifX0\u0026e=Yeal1b) (~20 MB).\n\n\n### Dependencies\n- [PyTorch](https://pytorch.org/get-started/previous-versions) 1.13.1\n- [NeRFAcc](https://github.com/KAIR-BAIR/nerfacc) 0.5.2\n- [Tiny CUDA Neural Networks](https://github.com/NVlabs/tiny-cuda-nn)\n- [nr3d_lib](https://github.com/PJLab-ADG/nr3d_lib) 0.3.1 (commit: `e4eba51`) [^1]\n- [NeRFStudio](https://github.com/nerfstudio-project/nerfstudio) 0.2.2\n\n\n[^1]: If you use the version 0.6.0, you may need to modify the code in `Lightning-NeRF/lightning_nerf/sampler.py`. See discussion [here](https://github.com/VISION-SJTU/Lightning-NeRF/issues/2).\n\n### Installation\n0. Make sure the dependencies are resolved.\n1. Clone the repository:\n    ```bash\n    git clone https://github.com/VISION-SJTU/Lightning-NeRF.git\n    ```\n1. Install Lightning NeRF:\n    ```bash\n    cd Lightning-NeRF\n    pip install -e .\n    ```\n\n### Data\n0. **Use our data pack.** You may skip the following steps 1 and 2 by downloading the data pack used in our experiments. \n    - [Download link](https://sjtueducn-my.sharepoint.com/:f:/g/personal/junyicao_sjtu_edu_cn/EjVxCRCWR_BOqMHqwLnt6w4BlHYhOQviOZWDAnF221dEJQ).\n    - Password: `)!4gkJTo`.\n1. **Download source data.** We use [KITTI-360](https://www.cvlibs.net/datasets/kitti-360/index.php) and [Argoverse2 (Sensor Dataset)](https://argoverse.github.io/user-guide/datasets/sensor.html) for experiments. Please download the original data from the offical webpages. Here, we list the chosen scenes presented in our paper.\n\n\u003cdiv align=center\u003e\n\n\u003cimg \n    src=\"KITTI.png\" \n    title=\"KITTI-360\"\n    alter=\"KITTI-360\" \n    width=\"400px\"\u003e\n\n\u003cimg \n    src=\"Argo.png\" \n    title=\"Argoverse2\"\n    alter=\"Argoverse2\" \n    width=\"400px\"\u003e\n\n\u003c/div\u003e\n\n2. **Preprocess the data.** You need to extract camera poses, RGB images, and LiDAR pointcloud from the original data. We've provided the [code](https://drive.google.com/file/d/1FvDp_AyugRIMvIzrN7_JaEdq3eMVkjb6/view?usp=sharing) for preprocessing Argoverse2[^2].\n3. **Implement the dataparser.** You need to create the corresponding `dataparser` script for loading the datasets in NeRFStudio. If you would like to use our dataparsers, you may download the scripts via the link below.\n    - [Download link](https://sjtueducn-my.sharepoint.com/:f:/g/personal/junyicao_sjtu_edu_cn/Eq2UpGHPvmRMlXQolta2-SUBeCG9UN4urTZgtMzs0SxB1g?e=YHNg3G).\n    - Password: `_8Q9+EJc`.\n\n[^2]: When calculating the foreground region (aabb) from Argoverse2's camera information, we clip the height (z-axis) of the view frustums to have a minimum value of -5m in the world coordinate to avoid wasting much space on underground areas.\n\n### Training\n\nTo train the model with default parameters, run the following command in the console:\n\n\u003cdetails\u003e\n\u003csummary\u003eOn KITTI-360\u003c/summary\u003e\n\n```bash\nns-train lightning_nerf \\\n    --mixed-precision True \\\n    --pipeline.model.point-cloud-path path/to/pcd.ply \\\n    --pipeline.model.frontal-axis x \\\n    --pipeline.model.init-density-value 10.0 \\\n    --pipeline.model.density-grid-base-res 256 \\\n    --pipeline.model.density-log2-hashmap-size 24 \\\n    --pipeline.model.bg-density-grid-res 32 \\\n    --pipeline.model.bg-density-log2-hashmap-size 18 \\\n    --pipeline.model.near-plane 0.01 \\\n    --pipeline.model.far-plane 6.0 \\\n    --pipeline.model.vi-mlp-num-layers 3 \\\n    --pipeline.model.vi-mlp-hidden-size 64 \\\n    --pipeline.model.vd-mlp-num-layers 2 \\\n    --pipeline.model.vd-mlp-hidden-size 32 \\\n    --pipeline.model.color-grid-base-res 128 \\\n    --pipeline.model.color-grid-max-res 2048 \\\n    --pipeline.model.color-grid-fpl 2 \\\n    --pipeline.model.color-grid-num-levels 8 \\\n    --pipeline.model.bg-color-grid-base-res 32 \\\n    --pipeline.model.bg-color-grid-max-res 128 \\\n    --pipeline.model.bg-color-log2-hashmap-size 16 \\\n    --pipeline.model.alpha-thre 0.01 \\\n    --pipeline.model.occ-grid-base-res 256 \\\n    --pipeline.model.occ-grid-num-levels 2 \\\n    --pipeline.model.occ-num-samples-per-ray 750 \\\n    --pipeline.model.occ-grid-update-warmup-step 256 \\\n    --pipeline.model.pdf-num-samples-per-ray 8 \\\n    --pipeline.model.pdf-samples-warmup-step 100000 \\\n    --pipeline.model.pdf-samples-fixed-step 100000 \\\n    --pipeline.model.pdf-samples-fixed-ratio 0.5 \\\n    --pipeline.model.appearance-embedding-dim 0 \\\n    ${dataparser_name} \\\n    --data \u003cdata-folder\u003e \\\n    --orientation-method none\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eOn Argoverse2\u003c/summary\u003e\n\n```bash\nns-train lightning_nerf \\\n    --mixed-precision True \\\n    --pipeline.model.point-cloud-path path/to/pcd.ply \\\n    --pipeline.model.frontal-axis x \\\n    --pipeline.model.init-density-value 10.0 \\\n    --pipeline.model.density-grid-base-res 256 \\\n    --pipeline.model.density-log2-hashmap-size 24 \\\n    --pipeline.model.bg-density-grid-res 32 \\\n    --pipeline.model.bg-density-log2-hashmap-size 18 \\\n    --pipeline.model.near-plane 0.01 \\\n    --pipeline.model.far-plane 10.0 \\\n    --pipeline.model.vi-mlp-num-layers 3 \\\n    --pipeline.model.vi-mlp-hidden-size 64 \\\n    --pipeline.model.vd-mlp-num-layers 2 \\\n    --pipeline.model.vd-mlp-hidden-size 32 \\\n    --pipeline.model.color-grid-base-res 128 \\\n    --pipeline.model.color-grid-max-res 2048 \\\n    --pipeline.model.color-grid-fpl 2 \\\n    --pipeline.model.color-grid-num-levels 8 \\\n    --pipeline.model.bg-color-grid-base-res 32 \\\n    --pipeline.model.bg-color-grid-max-res 128 \\\n    --pipeline.model.bg-color-log2-hashmap-size 16 \\\n    --pipeline.model.alpha-thre 0.02 \\\n    --pipeline.model.occ-grid-base-res 256 \\\n    --pipeline.model.occ-grid-num-levels 4 \\\n    --pipeline.model.occ-num-samples-per-ray 750 \\\n    --pipeline.model.occ-grid-update-warmup-step 2 \\\n    --pipeline.model.pdf-num-samples-per-ray 8 \\\n    --pipeline.model.pdf-samples-warmup-step 1000 \\\n    --pipeline.model.pdf-samples-fixed-step 3000 \\\n    --pipeline.model.pdf-samples-fixed-ratio 0.5 \\\n    --pipeline.model.appearance-embedding-dim 0 \\\n    ${dataparser_name} \\\n    --data \u003cdata-folder\u003e \\\n    --orientation-method none\n```\n\n\u003c/details\u003e\n\nYou can run `ns-train lightning_nerf --help` to see detailed information of optional arguments.\n\n**Note:** Since NeRFStudio attempts to load all training images to cuda device before training starts, it may occupy a large memory. If OOM is occured, you may consider load a subset of training images once a time by including:\n```bash\n    ...\n    --pipeline.datamanager.train-num-images-to-sample-from 128 \\\n    --pipeline.datamanager.train-num-times-to-repeat-images 256 \\\n    ...\n``` \nin the training script. \n\n### Evaluation\nTo evaluate a model, run the following command in the console:\n```bash\nns-eval --load-config=${PATH_TO_CONFIG} --output-path=${PATH_TO_RESULT}.json\n```\n\n**Note:** There are differences in the calculation of `SSIM` across NeRF variants. We by default adopt the NeRFStuidio version (i.e., implementation from `torchmetrics`) in our experiments. However, in Table 1 of the manuscript, some results are cited from [DNMP](https://arxiv.org/abs/2307.10776). For fairness, we adopt the DNMP version (i.e., implementation from `skimage`) for comparing `SSIM` in this table. See the discussion [here](https://github.com/DNMP/DNMP/issues/16) for details.\n\n**Note:** The center camera from [Argoverse2 (Sensor Dataset)](https://argoverse.github.io/user-guide/datasets/sensor.html) captures the hood of the self-driving vehicle, which should be masked for NeRF's training pipeline. In our data pack, we simply create a mask with the same shape for each input image with the bottom 250 rows set to `0` and other places to `1`. The masks are used [here](https://github.com/nerfstudio-project/nerfstudio/blob/ad706f59c414bd7e0f62b78a6a5822e2de70b6b9/nerfstudio/data/pixel_samplers.py#L64-L67) in NeRFStudio during training. For the evaluation of this dataset, we first *crop* the ground-truth and predicted images by removing the bottom 250 rows and then calculate the corresponding metrics.\n\n### More\nSince Lightning NeRF is integrated into the NeRFStudio project, you may refer to [docs.nerf.studio](https://docs.nerf.studio/) for more functional supports.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVISION-SJTU%2FLightning-NeRF","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVISION-SJTU%2FLightning-NeRF","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVISION-SJTU%2FLightning-NeRF/lists"}