Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #1

Merged
merged 6 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ data/*
outputs/*
seathru_nerf.egg-info/*
.vscode/*
*/__pycache__/*
*/__pycache__/*
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ To train your first subsea NeRF, please download the dataset available [here](ht
ns-train seathru-nerf-lite --vis viewer+wandb colmap --data <path_to_dataset> --images-path images_wb
```

(If you get an error with the colmap path, create a directory `colmap` in the dataset folder and move the `sparse` folder into it.)

You can then track the training process on [wandb](https://wandb.ai/site) or watch it live via the [nerfstudio viewer](https://docs.nerf.studio/en/latest/quickstart/viewer_quickstart.html).

When training is completed (takes around 1hr for the SeaThru-NeRF dataset scenes with a RTX3060 Laptop GPU), the trained model will be saved to an `./outputs/` folder.
Expand Down
29 changes: 14 additions & 15 deletions seathru/seathru_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from nerfstudio.pipelines.base_pipeline import VanillaPipelineConfig
from nerfstudio.data.datamanagers.base_datamanager import VanillaDataManagerConfig
from nerfstudio.data.dataparsers.nerfstudio_dataparser import NerfstudioDataParserConfig
from nerfstudio.cameras.camera_optimizers import CameraOptimizerConfig
from nerfstudio.engine.schedulers import ExponentialDecaySchedulerConfig
from nerfstudio.engine.optimizers import AdamOptimizerConfig
from nerfstudio.configs.base_config import ViewerConfig
Expand All @@ -24,13 +23,6 @@
dataparser=NerfstudioDataParserConfig(),
train_num_rays_per_batch=16384,
eval_num_rays_per_batch=4096,
camera_optimizer=CameraOptimizerConfig(
mode="off",
optimizer=AdamOptimizerConfig(lr=6e-4, eps=1e-8, weight_decay=1e-2),
scheduler=ExponentialDecaySchedulerConfig(
lr_final=6e-6, max_steps=500000
),
),
),
model=SeathruModelConfig(eval_num_rays_per_chunk=1 << 15),
),
Expand All @@ -47,6 +39,13 @@
lr_final=1e-5, max_steps=500000, warmup_steps=1024
),
},
"camera_opt": {
"mode": "off",
"optimizer": AdamOptimizerConfig(lr=6e-4, eps=1e-8, weight_decay=1e-2),
"scheduler": ExponentialDecaySchedulerConfig(
lr_final=6e-6, max_steps=500000
),
},
},
viewer=ViewerConfig(num_rays_per_chunk=1 << 15),
vis="viewer",
Expand All @@ -67,13 +66,6 @@
dataparser=NerfstudioDataParserConfig(),
train_num_rays_per_batch=8192,
eval_num_rays_per_batch=4096,
camera_optimizer=CameraOptimizerConfig(
mode="off",
optimizer=AdamOptimizerConfig(lr=6e-4, eps=1e-8, weight_decay=1e-2),
scheduler=ExponentialDecaySchedulerConfig(
lr_final=6e-6, max_steps=500000
),
),
),
model=SeathruModelConfig(
eval_num_rays_per_chunk=1 << 15,
Expand Down Expand Up @@ -116,6 +108,13 @@
lr_final=1e-5, max_steps=500000, warmup_steps=1024
),
},
"camera_opt": {
"mode": "off",
"optimizer": AdamOptimizerConfig(lr=6e-4, eps=1e-8, weight_decay=1e-2),
"scheduler": ExponentialDecaySchedulerConfig(
lr_final=6e-6, max_steps=500000
),
},
},
viewer=ViewerConfig(num_rays_per_chunk=1 << 15),
vis="viewer",
Expand Down
4 changes: 2 additions & 2 deletions seathru/seathru_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ def get_density(self, ray_samples: RaySamples) -> Tuple[Tensor, Tensor]:
density = density * selector[..., None]
return density, bottleneck_vector

def get_outputs(
self, ray_samples: RaySamples, density_embedding: Tensor
def get_outputs( # type: ignore
self, ray_samples: RaySamples, density_embedding: Optional[Tensor] = None
) -> Dict[SeathruHeadNames, Tensor]:
"""Compute outputs of object and medium networks (except object density).

Expand Down
4 changes: 2 additions & 2 deletions seathru/seathru_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class SeathruModel(Model):
config: SeaThru-NeRF configuration to instantiate the model with.
"""

config: SeathruModelConfig
config: SeathruModelConfig # type: ignore

def populate_modules(self):
"""Setup the fields and modules."""
Expand Down Expand Up @@ -349,7 +349,7 @@ def bias(x, b):

return callbacks

def get_outputs(self, ray_bundle: RayBundle) -> Dict[str, torch.Tensor]:
def get_outputs(self, ray_bundle: RayBundle) -> Dict[str, torch.Tensor]: # type: ignore
"""Get outputs from the model.

Args:
Expand Down
Loading