{"id":13442630,"url":"https://github.com/yenchenlin/nerf-pytorch","last_synced_at":"2025-05-14T12:10:41.813Z","repository":{"id":37464148,"uuid":"253188774","full_name":"yenchenlin/nerf-pytorch","owner":"yenchenlin","description":"A PyTorch implementation of NeRF (Neural Radiance Fields) that reproduces the results.","archived":false,"fork":false,"pushed_at":"2024-07-25T10:27:44.000Z","size":4089,"stargazers_count":5723,"open_issues_count":83,"forks_count":1101,"subscribers_count":51,"default_branch":"master","last_synced_at":"2025-04-09T03:11:14.401Z","etag":null,"topics":[],"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/yenchenlin.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,"publiccode":null,"codemeta":null}},"created_at":"2020-04-05T08:29:57.000Z","updated_at":"2025-04-08T01:30:38.000Z","dependencies_parsed_at":"2024-10-14T12:50:49.830Z","dependency_job_id":null,"html_url":"https://github.com/yenchenlin/nerf-pytorch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yenchenlin%2Fnerf-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yenchenlin%2Fnerf-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yenchenlin%2Fnerf-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yenchenlin%2Fnerf-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yenchenlin","download_url":"https://codeload.github.com/yenchenlin/nerf-pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140760,"owners_count":22021219,"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":[],"created_at":"2024-07-31T03:01:48.281Z","updated_at":"2025-05-14T12:10:41.754Z","avatar_url":"https://github.com/yenchenlin.png","language":"Python","funding_links":[],"categories":["Python","Implementations","Tools, Pipeline \u0026 Utilities"],"sub_categories":["Photogrammetry \u0026 3D Scanning"],"readme":"# NeRF-pytorch\n\n\n[NeRF](http://www.matthewtancik.com/nerf) (Neural Radiance Fields) is a method that achieves state-of-the-art results for synthesizing novel views of complex scenes. Here are some videos generated by this repository (pre-trained models are provided below):\n\n![](https://user-images.githubusercontent.com/7057863/78472232-cf374a00-7769-11ea-8871-0bc710951839.gif)\n![](https://user-images.githubusercontent.com/7057863/78472235-d1010d80-7769-11ea-9be9-51365180e063.gif)\n\nThis project is a faithful PyTorch implementation of [NeRF](http://www.matthewtancik.com/nerf) that **reproduces** the results while running **1.3 times faster**. The code is based on authors' Tensorflow implementation [here](https://github.com/bmild/nerf), and has been tested to match it numerically. \n\n## Installation\n\n```\ngit clone https://github.com/yenchenlin/nerf-pytorch.git\ncd nerf-pytorch\npip install -r requirements.txt\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003e Dependencies (click to expand) \u003c/summary\u003e\n  \n  ## Dependencies\n  - PyTorch 1.4\n  - matplotlib\n  - numpy\n  - imageio\n  - imageio-ffmpeg\n  - configargparse\n  \nThe LLFF data loader requires ImageMagick.\n\nYou will also need the [LLFF code](http://github.com/fyusion/llff) (and COLMAP) set up to compute poses if you want to run on your own real data.\n  \n\u003c/details\u003e\n\n## How To Run?\n\n### Quick Start\n\nDownload data for two example datasets: `lego` and `fern`\n```\nbash download_example_data.sh\n```\n\nTo train a low-res `lego` NeRF:\n```\npython run_nerf.py --config configs/lego.txt\n```\nAfter training for 100k iterations (~4 hours on a single 2080 Ti), you can find the following video at `logs/lego_test/lego_test_spiral_100000_rgb.mp4`.\n\n![](https://user-images.githubusercontent.com/7057863/78473103-9353b300-7770-11ea-98ed-6ba2d877b62c.gif)\n\n---\n\nTo train a low-res `fern` NeRF:\n```\npython run_nerf.py --config configs/fern.txt\n```\nAfter training for 200k iterations (~8 hours on a single 2080 Ti), you can find the following video at `logs/fern_test/fern_test_spiral_200000_rgb.mp4` and `logs/fern_test/fern_test_spiral_200000_disp.mp4`\n\n![](https://user-images.githubusercontent.com/7057863/78473081-58ea1600-7770-11ea-92ce-2bbf6a3f9add.gif)\n\n---\n\n### More Datasets\nTo play with other scenes presented in the paper, download the data [here](https://drive.google.com/drive/folders/128yBriW1IG_3NJ5Rp7APSTZsJqdJdfc1). Place the downloaded dataset according to the following directory structure:\n```\n├── configs                                                                                                       \n│   ├── ...                                                                                     \n│                                                                                               \n├── data                                                                                                                                                                                                       \n│   ├── nerf_llff_data                                                                                                  \n│   │   └── fern                                                                                                                             \n│   │   └── flower  # downloaded llff dataset                                                                                  \n│   │   └── horns   # downloaded llff dataset\n|   |   └── ...\n|   ├── nerf_synthetic\n|   |   └── lego\n|   |   └── ship    # downloaded synthetic dataset\n|   |   └── ...\n```\n\n---\n\nTo train NeRF on different datasets: \n\n```\npython run_nerf.py --config configs/{DATASET}.txt\n```\n\nreplace `{DATASET}` with `trex` | `horns` | `flower` | `fortress` | `lego` | etc.\n\n---\n\nTo test NeRF trained on different datasets: \n\n```\npython run_nerf.py --config configs/{DATASET}.txt --render_only\n```\n\nreplace `{DATASET}` with `trex` | `horns` | `flower` | `fortress` | `lego` | etc.\n\n\n### Pre-trained Models\n\nYou can download the pre-trained models [here](https://drive.google.com/drive/folders/1jIr8dkvefrQmv737fFm2isiT6tqpbTbv). Place the downloaded directory in `./logs` in order to test it later. See the following directory structure for an example:\n\n```\n├── logs \n│   ├── fern_test\n│   ├── flower_test  # downloaded logs\n│   ├── trex_test    # downloaded logs\n```\n\n### Reproducibility \n\nTests that ensure the results of all functions and training loop match the official implentation are contained in a different branch `reproduce`. One can check it out and run the tests:\n```\ngit checkout reproduce\npy.test\n```\n\n## Method\n\n[NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis](http://tancik.com/nerf)  \n [Ben Mildenhall](https://people.eecs.berkeley.edu/~bmild/)\\*\u003csup\u003e1\u003c/sup\u003e,\n [Pratul P. Srinivasan](https://people.eecs.berkeley.edu/~pratul/)\\*\u003csup\u003e1\u003c/sup\u003e,\n [Matthew Tancik](http://tancik.com/)\\*\u003csup\u003e1\u003c/sup\u003e,\n [Jonathan T. Barron](http://jonbarron.info/)\u003csup\u003e2\u003c/sup\u003e,\n [Ravi Ramamoorthi](http://cseweb.ucsd.edu/~ravir/)\u003csup\u003e3\u003c/sup\u003e,\n [Ren Ng](https://www2.eecs.berkeley.edu/Faculty/Homepages/yirenng.html)\u003csup\u003e1\u003c/sup\u003e \u003cbr\u003e\n \u003csup\u003e1\u003c/sup\u003eUC Berkeley, \u003csup\u003e2\u003c/sup\u003eGoogle Research, \u003csup\u003e3\u003c/sup\u003eUC San Diego  \n  \\*denotes equal contribution  \n  \n\u003cimg src='imgs/pipeline.jpg'/\u003e\n\n\u003e A neural radiance field is a simple fully connected network (weights are ~5MB) trained to reproduce input views of a single scene using a rendering loss. The network directly maps from spatial location and viewing direction (5D input) to color and opacity (4D output), acting as the \"volume\" so we can use volume rendering to differentiably render new views\n\n\n## Citation\nKudos to the authors for their amazing results:\n```\n@misc{mildenhall2020nerf,\n    title={NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis},\n    author={Ben Mildenhall and Pratul P. Srinivasan and Matthew Tancik and Jonathan T. Barron and Ravi Ramamoorthi and Ren Ng},\n    year={2020},\n    eprint={2003.08934},\n    archivePrefix={arXiv},\n    primaryClass={cs.CV}\n}\n```\n\nHowever, if you find this implementation or pre-trained models helpful, please consider to cite:\n```\n@misc{lin2020nerfpytorch,\n  title={NeRF-pytorch},\n  author={Yen-Chen, Lin},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished={\\url{https://github.com/yenchenlin/nerf-pytorch/}},\n  year={2020}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyenchenlin%2Fnerf-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyenchenlin%2Fnerf-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyenchenlin%2Fnerf-pytorch/lists"}