-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/nerfstudio-project/nerfstudio…
… into rejection_mask_sampling
- Loading branch information
Showing
100 changed files
with
814 additions
and
722 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,44 +119,44 @@ ENV PATH="${PATH}:/home/user/.local/bin" | |
SHELL ["/bin/bash", "-c"] | ||
|
||
# Upgrade pip and install packages. | ||
RUN python3.10 -m pip install --upgrade pip setuptools pathtools promise pybind11 | ||
RUN python3.10 -m pip install --no-cache-dir --upgrade pip setuptools pathtools promise pybind11 | ||
# Install pytorch and submodules | ||
RUN CUDA_VER=${CUDA_VERSION%.*} && CUDA_VER=${CUDA_VER//./} && python3.10 -m pip install \ | ||
RUN CUDA_VER=${CUDA_VERSION%.*} && CUDA_VER=${CUDA_VER//./} && python3.10 -m pip install --no-cache-dir \ | ||
torch==2.0.1+cu${CUDA_VER} \ | ||
torchvision==0.15.2+cu${CUDA_VER} \ | ||
--extra-index-url https://download.pytorch.org/whl/cu${CUDA_VER} | ||
# Install tynyCUDNN (we need to set the target architectures as environment variable first). | ||
ENV TCNN_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES} | ||
RUN python3.10 -m pip install git+https://github.com/NVlabs/[email protected]#subdirectory=bindings/torch | ||
RUN python3.10 -m pip install --no-cache-dir git+https://github.com/NVlabs/[email protected]#subdirectory=bindings/torch | ||
|
||
# Install pycolmap, required by hloc. | ||
RUN git clone --branch v0.4.0 --recursive https://github.com/colmap/pycolmap.git && \ | ||
cd pycolmap && \ | ||
python3.10 -m pip install . && \ | ||
python3.10 -m pip install --no-cache-dir . && \ | ||
cd .. | ||
|
||
# Install hloc 1.4 as alternative feature detector and matcher option for nerfstudio. | ||
RUN git clone --branch master --recursive https://github.com/cvg/Hierarchical-Localization.git && \ | ||
cd Hierarchical-Localization && \ | ||
git checkout v1.4 && \ | ||
python3.10 -m pip install -e . && \ | ||
python3.10 -m pip install --no-cache-dir -e . && \ | ||
cd .. | ||
|
||
# Install pyceres from source | ||
RUN git clone --branch v1.0 --recursive https://github.com/cvg/pyceres.git && \ | ||
cd pyceres && \ | ||
python3.10 -m pip install -e . && \ | ||
python3.10 -m pip install --no-cache-dir -e . && \ | ||
cd .. | ||
|
||
# Install pixel perfect sfm. | ||
RUN git clone --recursive https://github.com/cvg/pixel-perfect-sfm.git && \ | ||
cd pixel-perfect-sfm && \ | ||
git reset --hard 40f7c1339328b2a0c7cf71f76623fb848e0c0357 && \ | ||
git clean -df && \ | ||
python3.10 -m pip install -e . && \ | ||
python3.10 -m pip install --no-cache-dir -e . && \ | ||
cd .. | ||
|
||
RUN python3.10 -m pip install omegaconf | ||
RUN python3.10 -m pip install --no-cache-dir omegaconf | ||
# Copy nerfstudio folder and give ownership to user. | ||
ADD . /home/user/nerfstudio | ||
USER root | ||
|
@@ -165,7 +165,7 @@ USER ${USER_ID} | |
|
||
# Install nerfstudio dependencies. | ||
RUN cd nerfstudio && \ | ||
python3.10 -m pip install -e . && \ | ||
python3.10 -m pip install --no-cache-dir -e . && \ | ||
cd .. | ||
|
||
# Change working directory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# PyNeRF | ||
|
||
<h4>Pyramidal Neural Radiance Fields</h4> | ||
|
||
|
||
```{button-link} https://haithemturki.com/pynerf/ | ||
:color: primary | ||
:outline: | ||
Paper Website | ||
``` | ||
|
||
```{button-link} https://github.com/hturki/pynerf | ||
:color: primary | ||
:outline: | ||
Code | ||
``` | ||
|
||
<video id="teaser" muted autoplay playsinline loop controls width="100%"> | ||
<source id="mp4" src="https://haithemturki.com/pynerf/vids/ficus.mp4" type="video/mp4"> | ||
</video> | ||
|
||
**A fast NeRF anti-aliasing strategy.** | ||
|
||
|
||
## Installation | ||
|
||
First, install Nerfstudio and its dependencies. Then install the PyNeRF extension and [torch-scatter](https://github.com/rusty1s/pytorch_scatter): | ||
``` | ||
pip install git+https://github.com/hturki/pynerf | ||
pip install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH_VERSION}+${CUDA}.html | ||
``` | ||
|
||
## Running PyNeRF | ||
|
||
There are three default configurations provided which use the MipNeRF 360 and Multicam dataparsers by default. You can easily use other dataparsers via the ``ns-train`` command (ie: ``ns-train pynerf nerfstudio-data --data <your data dir>`` to use the Nerfstudio data parser) | ||
|
||
The default configurations provided are: | ||
|
||
| Method | Description | Scene type | Memory | | ||
| ----------------------- |---------------------------------------------------| ------------------------------ |--------| | ||
| `pynerf ` | Tuned for outdoor scenes, uses proposal network | outdoors | ~5GB | | ||
| `pynerf-synthetic` | Tuned for synthetic scenes, uses proposal network | synthetic | ~5GB | | ||
| `pynerf-occupancy-grid` | Tuned for Multiscale blender, uses occupancy grid | synthetic | ~5GB | | ||
|
||
|
||
The main differences between them is whether they are suited for synthetic/indoor or real-world unbounded scenes (in case case appearance embeddings and scene contraction are enabled), and whether sampling is done with a proposal network (usually better for real-world scenes) or an occupancy grid (usally better for single-object synthetic scenes like Blender). | ||
|
||
## Method | ||
|
||
Most NeRF methods assume that training and test-time cameras capture scene content from a roughly constant distance: | ||
|
||
<table> | ||
<tbody> | ||
<tr> | ||
<td style="width: 48%;"> | ||
<div style="display: flex; justify-content: center; align-items: center;"> | ||
<img src="https://haithemturki.com/pynerf/images/ficus-cameras.jpg"> | ||
</div> | ||
</td> | ||
<td style="width: 4%;"><img src="https://haithemturki.com/pynerf/images/arrow-right-white.png" style="width: 100%;"></td> | ||
<td style="width: 48%;"> | ||
<video width="100%" autoplay loop controls> | ||
<source src="https://haithemturki.com/pynerf/vids/ficus-rotation.mp4" type="video/mp4" poster="https://haithemturki.com/pynerf/images/ficus-rotation.jpg"> | ||
</video> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
They degrade and render blurry views in less constrained settings: | ||
|
||
<table> | ||
<tbody> | ||
<tr> | ||
<td style="width: 48%;"> | ||
<div style="display: flex; justify-content: center; align-items: center;"> | ||
<img src="https://haithemturki.com/pynerf//images/ficus-cameras-different.jpg"> | ||
</div> | ||
</td> | ||
<td style="width: 4%;"><img src="https://haithemturki.com/pynerf/images/arrow-right-white.png" style="width: 100%;"></td> | ||
<td style="width: 48%;"> | ||
<video width="100%" autoplay loop controls> | ||
<source src="https://haithemturki.com/pynerf/vids/ficus-zoom-nerf.mp4" type="video/mp4" poster="https://haithemturki.com/pynerf/images/ficus-zoom-nerf.jpg"> | ||
</video> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
This is due to NeRF being scale-unaware, as it reasons about point samples instead of volumes. We address this by training a pyramid of NeRFs that divide the scene at different resolutions. We use "coarse" NeRFs for far-away samples, and finer NeRF for close-up samples: | ||
|
||
<img src="https://haithemturki.com/pynerf/images/model.jpg" width="70%" style="display: block; margin-left: auto; margin-right: auto"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Gaussian Splatting | ||
[3D Gaussian Splatting](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/) was proposed in SIGGRAPH 2023 from INRIA, and is a completely | ||
different method of representing radiance fields by explicitly storing a collection of 3D volumetric gaussians. These can be "splatted", or projected, onto a 2D image | ||
provided a camera pose, and rasterized to obtain per-pixel colors. Because rasterization is very fast on GPUs, this method can render much faster than neural representations | ||
of radiance fields. | ||
|
||
### Installation | ||
Nerfstudio uses [gsplat](https://github.com/nerfstudio-project/gsplat) as its gaussian rasterization backend, an in-house re-implementation which is meant to be more developer friendly. This can be installed with `pip install gsplat`. The associated CUDA code will be compiled the first time gaussian splatting is executed. Some users with PyTorch 2.0 have experienced issues with this, which can be resolved by either installing gsplat from source, or upgrading torch to 2.1. | ||
|
||
### Data | ||
Gaussian Splatting works much better if you initialize it from pre-existing geometry, such as SfM points rom COLMAP. COLMAP datasets or datasets from `ns-process-data` will automatically save these points and initialize gaussians on them. Other datasets currently do not support initialization, and will initialize gaussians randomly. Initializing from other data inputs (i.e. depth from phone app scanners) may be supported in the future. | ||
|
||
Because gaussian splatting trains on *full images* instead of bundles of rays, there is a new datamanager in `full_images_datamanager.py` which undistorts input images, caches them, and provides single images at each train step. | ||
|
||
|
||
### Running the Method | ||
To run gaussian splatting, run `ns-train gaussian-splatting --data <data>`. Just like NeRF methods, the splat can be interactively viewed in the web-viewer, rendered, and exported. | ||
|
||
### Details | ||
For more details on the method, see the [original paper](https://arxiv.org/abs/2308.04079). Additionally, for a detailed derivation of the gradients used in the gsplat library, see [here](https://arxiv.org/abs/2312.02121). | ||
|
||
### Exporting splats | ||
Gaussian splats can be exported as a `.ply` file which are ingestable by a variety of online web viewers. You can do this via the viewer, or `ns-export gaussian-splat`. Currently splats can only be exported from trained splats, not from nerfacto. | ||
|
||
### FAQ | ||
- Can I export a mesh or pointcloud? | ||
Currently these export options are not supported, but may in the future and contributions are always welcome! | ||
- Can I render fisheye, equirectangular, orthographic images? | ||
Currently, no. Gaussian splatting assumes a perspective camera for its rasterization pipeline. Implementing other camera models is of interest but not currently planned. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.