Skip to content

Commit

Permalink
Adios mattport
Browse files Browse the repository at this point in the history
  • Loading branch information
tancik committed May 30, 2022
1 parent 9d2b34a commit b26408e
Show file tree
Hide file tree
Showing 86 changed files with 177 additions and 177 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
pip install -r environment/requirements.txt
pip install -e .
- name: Run Black
run: black mattport/ notebooks/ --check
run: black radiance/ notebooks/ --check
- name: Python Pylint
run: |
pylint mattport tests
pylint radiance tests
- name: Test with pytest
run: |
pytest
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# MattPort
# Radiance

# Quickstart

## Installation: Setup the environment

```
# Clone the repo
git clone --recurse-submodules [email protected]:ethanweber/mattport.git
git clone --recurse-submodules [email protected]:ethanweber/radiance.git
# Create the python environment
conda create --name mattport python=3.8.13
conda activate mattport
conda create --name radiance python=3.8.13
conda activate radiance
pip install -r environment/requirements.txt
# Install mattport as a library
# Install radiance as a library
pip install -e .
# Install library with CUDA support. Change setup.py to `USE_CUDA = True` and then
Expand Down Expand Up @@ -69,7 +69,7 @@ bash environments/run_jupyter.sh

# Tooling

1. One can use [autoenv](https://github.com/hyperupcall/autoenv) to make setting up the environment and environment variables easier. This will run the `.envrc` file upon entering the `/path/to/mattport` folder. It will also remove the environment parameters upon leaving.
1. One can use [autoenv](https://github.com/hyperupcall/autoenv) to make setting up the environment and environment variables easier. This will run the `.envrc` file upon entering the `/path/to/radiance` folder. It will also remove the environment parameters upon leaving.

```
# Install direnv.
Expand All @@ -79,7 +79,7 @@ sudo apt install direnv
eval "$(direnv hook bash)"
# Populate your .envrc with commands you want to run. Then, run the following to allow updates.
cd /path/to/mattport
cd /path/to/radiance
direnv allow .
```

Expand Down Expand Up @@ -125,12 +125,12 @@ python scripts/benchmarking/run_benchmark.py
```
# nerf-pytorch
cd external
python run_nerf.py --config configs/chair.txt --datadir /path/to/mattport/data/blender/chair
python run_nerf.py --config configs/chair.txt --datadir /path/to/radiance/data/blender/chair
# jaxnerf
cd external
conda activate jaxnerf
python -m jaxnerf.train --data_dir=/path/to/mattport/data/blender/chair --train_dir=/path/to/mattport/outputs/blender_chair_jaxnerf --config=/path/to/mattport/external/jaxnerf/configs/demo --render_every 100
python -m jaxnerf.train --data_dir=/path/to/radiance/data/blender/chair --train_dir=/path/to/radiance/outputs/blender_chair_jaxnerf --config=/path/to/radiance/external/jaxnerf/configs/demo --render_every 100
```

# Speeding up the code
Expand Down
2 changes: 1 addition & 1 deletion configs/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaults:
- override hydra/hydra_logging: colorlog
- _self_

seed: 0
seed: 42

hydra:
run:
Expand Down
6 changes: 3 additions & 3 deletions configs/graph/default_graph.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# saving model specifications
model_dir: /tmp/mattport_models/
model_dir: /tmp/radiance_models/
steps_per_save: null
steps_per_test: 100
max_num_iterations: 1000000
Expand All @@ -10,7 +10,7 @@ resume_train:
load_step: # pretrained model's step number

network:
_target_: mattport.nerf.graph.vanilla_nerf.NeRFGraph
_target_: radiance.nerf.graph.vanilla_nerf.NeRFGraph
near_plane: 2.0
far_plane: 6.0
num_coarse_samples: 64
Expand All @@ -27,6 +27,6 @@ param_groups:
_target_: torch.optim.RAdam
lr: 0.0005
scheduler:
_target_: mattport.nerf.optimizers.ExponentialDecaySchedule
_target_: radiance.nerf.optimizers.ExponentialDecaySchedule
lr_final: 0.000005
max_steps: 1000000
2 changes: 1 addition & 1 deletion configs/graph/instant_ngp_graph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defaults:
- _self_

network:
_target_: mattport.nerf.graph.instant_ngp.NGPGraph
_target_: radiance.nerf.graph.instant_ngp.NGPGraph
field_implementation: torch # torch, tcnn, ...
loss_coefficients: # loss coefficients
rgb_loss: 1.0
Expand Down
2 changes: 1 addition & 1 deletion configs/graph/nerfw_graph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defaults:
- _self_

network:
_target_: mattport.nerf.graph.nerfw.NerfWGraph
_target_: radiance.nerf.graph.nerfw.NerfWGraph
loss_coefficients: # loss coefficients
rgb_loss_coarse: 1.0
rgb_loss_fine: 1.0
Expand Down
2 changes: 1 addition & 1 deletion configs/graph/semantic_nerf_graph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defaults:
- _self_

network:
_target_: mattport.nerf.graph.semantic_nerf.SemanticNerfGraph
_target_: radiance.nerf.graph.semantic_nerf.SemanticNerfGraph
loss_coefficients: # loss coefficients
rgb_loss_coarse: 1.0
rgb_loss_fine: 1.0
Expand Down
4 changes: 2 additions & 2 deletions notebooks/visualize_cameras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputs": [],
"source": [
"import torch\n",
"from mattport.structures import cameras\n",
"from radiance.structures import cameras\n",
"import plotly.graph_objects as go\n",
"import mediapy as media"
]
Expand Down Expand Up @@ -19597,7 +19597,7 @@
"hash": "024fe9dea615e4e34961116ff517c7e9f5910440e3d2c8eb4560299f11aaf2e7"
},
"kernelspec": {
"display_name": "Python 3.9.12 ('mattport')",
"display_name": "Python 3.9.12 ('radiance')",
"language": "python",
"name": "python3"
},
Expand Down
22 changes: 11 additions & 11 deletions notebooks/visualize_dataset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"import torch\n",
"from torch.utils.data import DataLoader\n",
"\n",
"from mattport.nerf.dataset.image_dataset import ImageDataset, collate_batch\n",
"from mattport.nerf.dataset.collate import CollateIterDataset, collate_batch_size_one\n",
"from mattport.nerf.dataset.utils import get_dataset_inputs\n",
"from mattport.nerf.field_modules.ray_generator import RayGenerator\n",
"from mattport.nerf.field_modules.scene_bounds_collider import SceneBoundsCollider\n",
"from mattport.structures.rays import RayBundle\n",
"from mattport.utils.io import get_absolute_path\n",
"from mattport.viewer.plotly import get_line_segments_from_lines\n",
"from mattport.structures.cameras import get_camera_model\n",
"from radiance.nerf.dataset.image_dataset import ImageDataset, collate_batch\n",
"from radiance.nerf.dataset.collate import CollateIterDataset, collate_batch_size_one\n",
"from radiance.nerf.dataset.utils import get_dataset_inputs\n",
"from radiance.nerf.field_modules.ray_generator import RayGenerator\n",
"from radiance.nerf.field_modules.scene_bounds_collider import SceneBoundsCollider\n",
"from radiance.structures.rays import RayBundle\n",
"from radiance.utils.io import get_absolute_path\n",
"from radiance.viewer.plotly import get_line_segments_from_lines\n",
"from radiance.structures.cameras import get_camera_model\n",
"\n",
"\n",
"from hydra import compose, initialize\n",
Expand Down Expand Up @@ -361,9 +361,9 @@
"hash": "4a749acc7d255f078aee52e0584cc77b3cb5aaed1b3a7407ec4262c1bf6cb526"
},
"kernelspec": {
"display_name": "mattport",
"display_name": "radiance",
"language": "python",
"name": "mattport"
"name": "radiance"
},
"language_info": {
"codemirror_mode": {
Expand Down
6 changes: 3 additions & 3 deletions notebooks/visualize_encoders.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 6;\n var nbb_unformatted_code = \"import torch\\nimport mediapy as media\\nfrom mattport.nerf.field_modules import encoding\";\n var nbb_formatted_code = \"import torch\\nimport mediapy as media\\nfrom mattport.nerf.field_modules import encoding\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 6;\n var nbb_unformatted_code = \"import torch\\nimport mediapy as media\\nfrom radiance.nerf.field_modules import encoding\";\n var nbb_formatted_code = \"import torch\\nimport mediapy as media\\nfrom radiance.nerf.field_modules import encoding\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
Expand All @@ -26,7 +26,7 @@
"source": [
"import torch\n",
"import mediapy as media\n",
"from mattport.nerf.field_modules import encoding"
"from radiance.nerf.field_modules import encoding"
]
},
{
Expand Down Expand Up @@ -434,7 +434,7 @@
"hash": "024fe9dea615e4e34961116ff517c7e9f5910440e3d2c8eb4560299f11aaf2e7"
},
"kernelspec": {
"display_name": "Python 3.9.11 ('mattport')",
"display_name": "Python 3.9.11 ('radiance')",
"language": "python",
"name": "python3"
},
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ line-length = 120
max-line-length = 120
generated-members = ["numpy.*", "torch.*", "cv2.*", "cv.*"]
good-names-rgxs = "^[_a-zA-Z][_a-z0-9]?$"
ignore = ["mattport/cuda", "tests/cuda", "nerfw.py", "semantic_nerf.py"]
ignore = ["radiance/cuda", "tests/cuda", "nerfw.py", "semantic_nerf.py"]

disable = [
"too-many-arguments",
Expand All @@ -23,7 +23,7 @@ disable = [

#pytest
[tool.pytest.ini_options]
addopts = "--typeguard-packages=mattport --torchtyping-patch-typeguard --disable-warnings --ignore=tests/cuda"
addopts = "--typeguard-packages=radiance --torchtyping-patch-typeguard --disable-warnings --ignore=tests/cuda"
testpaths = [
"tests",
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions mattport/cuda/sampler.py → radiance/cuda/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import torch
from torch import nn

import mattport_cuda
import radiance_cuda


class LLTMFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, input, weights, bias, old_h, old_cell):
outputs = mattport_cuda.forward(input, weights, bias, old_h, old_cell)
outputs = radiance_cuda.forward(input, weights, bias, old_h, old_cell)
new_h, new_cell = outputs[:2]
variables = outputs[1:] + [weights]
ctx.save_for_backward(*variables)
Expand All @@ -22,7 +22,7 @@ def forward(ctx, input, weights, bias, old_h, old_cell):

@staticmethod
def backward(ctx, grad_h, grad_cell):
outputs = mattport_cuda.backward(grad_h.contiguous(), grad_cell.contiguous(), *ctx.saved_variables)
outputs = radiance_cuda.backward(grad_h.contiguous(), grad_cell.contiguous(), *ctx.saved_variables)
d_old_h, d_input, d_weights, d_bias, d_old_cell, d_gates = outputs
return d_input, d_weights, d_bias, d_old_h, d_old_cell

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions mattport/nerf/colliders.py → radiance/nerf/colliders.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import torch
from torch import nn
from torchtyping import TensorType
from mattport.nerf.dataset.structs import SceneBounds
from mattport.structures.rays import RayBundle
from radiance.nerf.dataset.structs import SceneBounds
from radiance.structures.rays import RayBundle


class SceneBoundsCollider(nn.Module):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import torch
from torchtyping import TensorType

from mattport.nerf.dataset.structs import DatasetInputs, SceneBounds
from mattport.utils.io import load_from_json
from radiance.nerf.dataset.structs import DatasetInputs, SceneBounds
from radiance.utils.io import load_from_json


def load_blender_data(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import torch

from mattport.nerf.dataset.colmap_utils import read_cameras_binary, read_images_binary, read_pointsTD_binary
from mattport.nerf.dataset.structs import DatasetInputs, PointCloud, SceneBounds, Semantics
from mattport.utils import profiler
from mattport.utils.io import load_from_json
from radiance.nerf.dataset.colmap_utils import read_cameras_binary, read_images_binary, read_pointsTD_binary
from radiance.nerf.dataset.structs import DatasetInputs, PointCloud, SceneBounds, Semantics
from radiance.utils import profiler
from radiance.utils.io import load_from_json


def get_aabb_and_transform(basedir):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import numpy as np
import torch

from mattport.nerf.dataset.structs import DatasetInputs, SceneBounds
from mattport.utils.io import load_from_json
from radiance.nerf.dataset.structs import DatasetInputs, SceneBounds
from radiance.utils.io import load_from_json


def load_instant_ngp_data(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from torch.utils.data import default_collate
from torchtyping import TensorType

from mattport.nerf.dataset.structs import Semantics
from radiance.nerf.dataset.structs import Semantics


def collate_batch(batch_list, num_rays_per_batch, keep_full_image: bool = False):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

from omegaconf import ListConfig

from mattport.nerf.dataset.format.blender import load_blender_data
from mattport.nerf.dataset.format.friends import load_friends_data
from mattport.nerf.dataset.format.instant_ngp import load_instant_ngp_data
from mattport.nerf.dataset.structs import DatasetInputs
from mattport.structures.colors import get_color
from mattport.utils.io import get_absolute_path
from radiance.nerf.dataset.format.blender import load_blender_data
from radiance.nerf.dataset.format.friends import load_friends_data
from radiance.nerf.dataset.format.instant_ngp import load_instant_ngp_data
from radiance.nerf.dataset.structs import DatasetInputs
from radiance.structures.colors import get_color
from radiance.utils.io import get_absolute_path


def get_dataset_inputs(
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import torch
from torchtyping import TensorType
from mattport.nerf.field_modules.base import FieldModule
from radiance.nerf.field_modules.base import FieldModule


class Embedding(FieldModule):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from torch import nn
from torchtyping import TensorType

from mattport.nerf.field_modules.base import FieldModule
from mattport.utils.math import components_from_spherical_harmonics
from radiance.nerf.field_modules.base import FieldModule
from radiance.utils.math import components_from_spherical_harmonics


class Encoding(FieldModule):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from torch import nn
from torchtyping import TensorType

from mattport.nerf.field_modules.base import FieldModule
from radiance.nerf.field_modules.base import FieldModule


class FieldHeadNames(Enum):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from torch import nn
from torchtyping import TensorType

from mattport.nerf.field_modules.base import FieldModule
from radiance.nerf.field_modules.base import FieldModule


class MLP(FieldModule):
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions mattport/nerf/fields/base.py → radiance/nerf/fields/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from torch import nn
import torch
from torchtyping import TensorType
from mattport.nerf.field_modules.field_heads import FieldHeadNames
from radiance.nerf.field_modules.field_heads import FieldHeadNames

from mattport.structures.rays import PointSamples
from mattport.utils.misc import is_not_none
from radiance.structures.rays import PointSamples
from radiance.utils.misc import is_not_none


class Field(nn.Module):
Expand Down
Loading

0 comments on commit b26408e

Please sign in to comment.