{"id":17222926,"url":"https://github.com/cheind/pure-torch-ngp","last_synced_at":"2025-04-14T00:19:01.768Z","repository":{"id":61849967,"uuid":"553397516","full_name":"cheind/pure-torch-ngp","owner":"cheind","description":"A pure PyTorch based implementation of \"Instant Neural Graphics Primitives with a Multiresolution Hash Encoding\" with tweaks.","archived":false,"fork":false,"pushed_at":"2022-12-12T05:39:02.000Z","size":43785,"stargazers_count":41,"open_issues_count":8,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-27T14:21:22.603Z","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/cheind.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}},"created_at":"2022-10-18T06:40:44.000Z","updated_at":"2025-02-25T07:44:59.000Z","dependencies_parsed_at":"2023-01-27T14:16:00.370Z","dependency_job_id":null,"html_url":"https://github.com/cheind/pure-torch-ngp","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/cheind%2Fpure-torch-ngp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheind%2Fpure-torch-ngp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheind%2Fpure-torch-ngp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheind%2Fpure-torch-ngp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheind","download_url":"https://codeload.github.com/cheind/pure-torch-ngp/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799984,"owners_count":21163404,"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-10-15T04:06:44.570Z","updated_at":"2025-04-14T00:19:01.718Z","avatar_url":"https://github.com/cheind.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pure-torch-ngp\n\nThis repository provides an unofficial implementation of\n\n\u003e \"Instant Neural Graphics Primitives with a Multiresolution Hash Encoding\" by\n\u003e Thomas Müller, Alex Evans, Christoph Schied, Alexander Keller @\n\u003e ACM Transactions on Graphics (SIGGRAPH 2022)\n\nbased on pure PyTorch functionality.\n\nCurrently, the tasks of learning Neural Radiance Fields and approximating Gigapixel images are available. The image below shows three novel viewpoints of a synthetic Lego model. The underlying NeRF model was trained on 100 images for about 2 mins using a NVIDIA GeForce 3090 Ti.\n\n![](etc/lego_val.png?raw=true)\n\n## NeRF Features\n\n-   Multi-Level hash encodings using a hybrid dense/sparse approach\n-   Training with dynamic noise backgrounds to encourage zero density learning for scenes with transparency\n-   Occupancy grid acceleration structure to speed up ray marching\n-   Generation of `Alpha`, `RGB` and `Depth` maps\n-   Model export, volume rasterization and scene setup rendering\n\n## Blender Synth Gen Features\n\nThis repository comes with Scripts to facilitate the generation of synthetic scenes through Blender. In particular the scripts perform the following tasks\n\n-   Automatically generate camera views for scene\n-   Export scene to `transforms.json` for NeRF training\n\n## Installation (using pinned dependencies)\n\nCreate a virtual env, clone the repo and install the dependencies\n\n```shell\ngit clone https://github.com/cheind/pure-torch-ngp.git\n\ncd pure-torch-ngp\npython -m venv .venv\nsource .venv/bin/activate\n```\n\nFor pinned dependencies (Python 3.9) execute\n\n```\npip install pip-tools\npip-sync requirements.txt dev-requirements.txt\n```\n\nOtherwise try\n\n```\npip install -r requirements.in\n```\n\n## Training\n\n```\npython -m torchngp.apps.nerf.train +data=suzanne\n```\n\n[Hydra](https://hydra.cc/docs/intro/) is used for configuration management. The configuration files are stored in `cfgs/`. A folder per run in created in `outputs/` to store intermediate results and model weights.\n\n## Render\n\nTo render images from a spherical coordinate trajectory execute\n\n```shell\npython -m torchngp.apps.nerf.render \\\n    ckpt=\u003cpath/to/model.pth\u003e \\\n    poses.n_poses=60 \\\n    as_grid=False \\\n    rgba_transparent=False \\\n    depth_dynamic_range=True\n```\n\n## More results\n\n### RGBA\n\n![](etc/lego.gif)![](etc/chair.gif)![](etc/hotdog.gif)![](etc/mic.gif)\n\n### Depth maps\n\n![](etc/mic_depth.gif)\n\nDarker is closer, black marks invalid depth.\n\n## Performance considerations\n\nThis implementation is roughly an order of magnitude slower than the original implementation. That is, it takes a minute what takes the original implementation only a few seconds. Furthermore, the PSNR values achieved lag behind those of the original work (e.g LEGO 35dB vs. 28dB using this implementation).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheind%2Fpure-torch-ngp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheind%2Fpure-torch-ngp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheind%2Fpure-torch-ngp/lists"}