2021-02-23 09:20:50 +01:00
|
|
|
# NeRF Tutorial
|
|
|
|
|
|
|
|
This example code is largely inspried from the Jupyter Notebook given by
|
2021-02-23 09:29:09 +01:00
|
|
|
[the pytorch repository](https://github.com/facebookresearch/pytorch3d/blob/master/docs/tutorials/fit_simple_neural_radiance_field.ipynb).
|
2021-02-23 09:20:50 +01:00
|
|
|
|
|
|
|
It has been adapted to be ran inside a python sheel and not a jupyer notebook.
|
|
|
|
It is GPU only, there is support for CPU.
|
|
|
|
|
|
|
|
It cannot run my lab computer: NVIDIA GeForce RTX 2060 (6GiB of VRAM)
|
|
|
|
and thus need to be run on the cluster which has more VRAM.
|
2021-02-23 09:27:07 +01:00
|
|
|
|
2021-02-23 11:35:57 +01:00
|
|
|
## Installation (using conda)
|
2021-02-23 09:27:07 +01:00
|
|
|
|
|
|
|
Please refer to the original Pytorch3D project, here is a quick summary:
|
|
|
|
|
|
|
|
```
|
|
|
|
conda create -n pytorhc3d python=3.8
|
|
|
|
conda activate pytorch3d
|
|
|
|
conda install -c pytorch pytorch=1.7.1 torchvision cudatoolkit=10.2
|
2021-02-23 09:44:20 +01:00
|
|
|
conda install -c conda-forge -c fvcore -c iopath fvcore iopath
|
|
|
|
conda install -c bottler nvidiacub
|
2021-02-23 09:27:07 +01:00
|
|
|
conda intall numpy matplotlib plotly
|
|
|
|
```
|
|
|
|
|
|
|
|
You can then clone this repo and run the code
|
|
|
|
```
|
|
|
|
git clone https://gitea.auro.re/otthorn/nerf_tutorial.git
|
|
|
|
cd nerf_tutorial
|
|
|
|
python3 main.py
|
|
|
|
```
|
|
|
|
|
|
|
|
To deactivate the conda env
|
|
|
|
```
|
|
|
|
conda deactivate
|
|
|
|
```
|
2021-02-23 11:35:57 +01:00
|
|
|
|
|
|
|
## Installation (using pip and virtualenv)
|
|
|
|
|
|
|
|
This requires `Python>=3.8`
|
|
|
|
|
|
|
|
First, clone the repo
|
|
|
|
```
|
|
|
|
git clone https://gitea.auro.re/otthorn/nerf_tutorial.git
|
|
|
|
cd nerf_tutorial
|
|
|
|
```
|
|
|
|
|
|
|
|
Then install pytorch3d inside a virtualenv
|
|
|
|
```
|
|
|
|
virtualenv -p /usr/bin/python3.8 pytorch3d
|
|
|
|
source pytorch3d/bin/activate
|
|
|
|
pip3 install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu102_pyt171/download.html
|
|
|
|
pip3 install torch torchvision
|
|
|
|
```
|
|
|
|
|
|
|
|
You can then run the code
|
|
|
|
```
|
|
|
|
python3 main.py
|
|
|
|
```
|
|
|
|
|
|
|
|
To deactivate the virtualenv
|
|
|
|
```
|
|
|
|
deactivate
|
|
|
|
```
|