mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 07:48:50 +08:00
Reduced tyro overhead + helptext formatting (#719)
* `ns-train` helptext formatting for tyro 0.3.23 * Remove unused import
This commit is contained in:
1 parent
eaa16e535a
commit
05d264a335
4 files changed
+46
-18
No files matched your search
@@ -61,9 +61,9 @@ ns-train nerfacto --vis viewer --data data/nerfstudio/poster --viewer.websocket-
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
## Intro to nerfstudio CLI and Configs
|
## Intro to nerfstudio CLI and Configs
|
||||||
Nerfstudio allows for customizing your training runs, eval runs, configs from the CLI in a powerful way, but there are some things to understand.
|
Nerfstudio allows customization of training and eval configs from the CLI in a powerful way, but there are some things to understand.
|
||||||
|
|
||||||
The most demonstrative and helpful example of this in action is the difference in output between the following commands:
|
The most demonstrative and helpful example of the CLI structure is the difference in output between the following commands:
|
||||||
```bash
|
```bash
|
||||||
ns-train -h
|
ns-train -h
|
||||||
```
|
```
|
||||||
@@ -76,13 +76,13 @@ ns-train nerfacto nerfstudio-data -h
|
|||||||
|
|
||||||
In each of these examples, the -h applies to the previous subcommand (`ns-train`, `nerfacto`, and `nerfstudio-data`).
|
In each of these examples, the -h applies to the previous subcommand (`ns-train`, `nerfacto`, and `nerfstudio-data`).
|
||||||
|
|
||||||
In the first example, this shows us the help menu for the `ns-train` script.
|
In the first example, we get the help menu for the `ns-train` script.
|
||||||
|
|
||||||
In the second examples, we will get the help menu for the `nerfacto` model.
|
In the second example, we get the help menu for the `nerfacto` model.
|
||||||
|
|
||||||
In the third examples, we will get the help menu for the `nerfstudio-data` dataparser.
|
In the third example, we get the help menu for the `nerfstudio-data` dataparser.
|
||||||
|
|
||||||
With our scripts, your arguments will apply to the previous subcommand in your command, and thus where you put your arguments matters! Any optional arguments you discover while doing
|
With our scripts, your arguments will apply to the preceding subcommand in your command, and thus where you put your arguments matters! Any optional arguments you discover from running
|
||||||
```bash
|
```bash
|
||||||
ns-train nerfacto -h nerfstudio-data
|
ns-train nerfacto -h nerfstudio-data
|
||||||
```
|
```
|
||||||
@@ -133,4 +133,4 @@ Calculate the psnr of your trained model and save to a json file.
|
|||||||
ns-eval --load-config={PATH_TO_CONFIG} --output-path=output.json
|
ns-eval --load-config={PATH_TO_CONFIG} --output-path=output.json
|
||||||
```
|
```
|
||||||
|
|
||||||
We also provide a train and evaluation script that allows you to do benchmarking on the classical Blender dataset (see our [benchmarking workflow](../developer_guides/debugging_tools/benchmarking.md)).
|
We also provide a train and evaluation script that allows you to do benchmarking on the classical Blender dataset (see our [benchmarking workflow](../developer_guides/debugging_tools/benchmarking.md)).
|
||||||
@@ -23,7 +23,6 @@ from typing import Dict
|
|||||||
import tyro
|
import tyro
|
||||||
|
|
||||||
from nerfstudio.configs.base_config import Config, TrainerConfig, ViewerConfig
|
from nerfstudio.configs.base_config import Config, TrainerConfig, ViewerConfig
|
||||||
from nerfstudio.configs.config_utils import convert_markup_to_ansi
|
|
||||||
from nerfstudio.data.datamanagers import VanillaDataManagerConfig
|
from nerfstudio.data.datamanagers import VanillaDataManagerConfig
|
||||||
from nerfstudio.data.dataparsers.blender_dataparser import BlenderDataParserConfig
|
from nerfstudio.data.dataparsers.blender_dataparser import BlenderDataParserConfig
|
||||||
from nerfstudio.data.dataparsers.friends_dataparser import FriendsDataParserConfig
|
from nerfstudio.data.dataparsers.friends_dataparser import FriendsDataParserConfig
|
||||||
@@ -40,15 +39,12 @@ from nerfstudio.pipelines.dynamic_batch import DynamicBatchPipelineConfig
|
|||||||
|
|
||||||
method_configs: Dict[str, Config] = {}
|
method_configs: Dict[str, Config] = {}
|
||||||
descriptions = {
|
descriptions = {
|
||||||
"nerfacto": "[bold green]Recommended[/bold green] Real-time model tuned for real captures. "
|
"nerfacto": "Recommended real-time model tuned for real captures. This model will be continually updated.",
|
||||||
+ "This model will be continually updated.",
|
|
||||||
"instant-ngp": "Implementation of Instant-NGP. Recommended real-time model for bounded synthetic data.",
|
"instant-ngp": "Implementation of Instant-NGP. Recommended real-time model for bounded synthetic data.",
|
||||||
"mipnerf": "High quality model for bounded scenes. [red]*slow*",
|
"mipnerf": "High quality model for bounded scenes. (slow)",
|
||||||
"semantic-nerfw": "Predicts semantic segmentations and filters out transient objects.",
|
"semantic-nerfw": "Predicts semantic segmentations and filters out transient objects.",
|
||||||
"vanilla-nerf": "Original NeRF model. [red]*slow*",
|
"vanilla-nerf": "Original NeRF model. (slow)",
|
||||||
}
|
}
|
||||||
descriptions = {k: convert_markup_to_ansi(v) for k, v in descriptions.items()}
|
|
||||||
|
|
||||||
|
|
||||||
method_configs["nerfacto"] = Config(
|
method_configs["nerfacto"] = Config(
|
||||||
method_name="nerfacto",
|
method_name="nerfacto",
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ dependencies = [
|
|||||||
"aiortc==1.3.2",
|
"aiortc==1.3.2",
|
||||||
"appdirs>=1.4",
|
"appdirs>=1.4",
|
||||||
"av==9.2.0",
|
"av==9.2.0",
|
||||||
"tyro>=0.3.22",
|
"tyro>=0.3.23",
|
||||||
"gdown==4.5.1",
|
"gdown==4.5.1",
|
||||||
"ninja==1.10.2.3",
|
"ninja==1.10.2.3",
|
||||||
"functorch==0.2.1",
|
"functorch==0.2.1",
|
||||||
|
|||||||
+35
-3
@@ -1,6 +1,32 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""Train a radiance field with nerfstudio.
|
||||||
train.py
|
For real captures, we recommend using the [bright_yellow]nerfacto[/bright_yellow] model.
|
||||||
|
|
||||||
|
Nerfstudio allows for customizing your training and eval configs from the CLI in a powerful way, but there are some
|
||||||
|
things to understand.
|
||||||
|
|
||||||
|
The most demonstrative and helpful example of the CLI structure is the difference in output between the following
|
||||||
|
commands:
|
||||||
|
|
||||||
|
ns-train -h
|
||||||
|
ns-train nerfacto -h nerfstudio-data
|
||||||
|
ns-train nerfacto nerfstudio-data -h
|
||||||
|
|
||||||
|
In each of these examples, the -h applies to the previous subcommand (ns-train, nerfacto, and nerfstudio-data).
|
||||||
|
|
||||||
|
In the first example, we get the help menu for the ns-train script.
|
||||||
|
In the second example, we get the help menu for the nerfacto model.
|
||||||
|
In the third example, we get the help menu for the nerfstudio-data dataparser.
|
||||||
|
|
||||||
|
With our scripts, your arguments will apply to the preceding subcommand in your command, and thus where you put your
|
||||||
|
arguments matters! Any optional arguments you discover from running
|
||||||
|
|
||||||
|
ns-train nerfacto -h nerfstudio-data
|
||||||
|
|
||||||
|
need to come directly after the nerfacto subcommand, since these optional arguments only belong to the nerfacto
|
||||||
|
subcommand:
|
||||||
|
|
||||||
|
ns-train nerfacto {nerfacto optional args} nerfstudio-data
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
@@ -20,6 +46,7 @@ import tyro
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from nerfstudio.configs import base_config as cfg
|
from nerfstudio.configs import base_config as cfg
|
||||||
|
from nerfstudio.configs.config_utils import convert_markup_to_ansi
|
||||||
from nerfstudio.configs.method_configs import AnnotatedBaseConfigUnion
|
from nerfstudio.configs.method_configs import AnnotatedBaseConfigUnion
|
||||||
from nerfstudio.engine.trainer import train_loop
|
from nerfstudio.engine.trainer import train_loop
|
||||||
from nerfstudio.utils import comms, profiler
|
from nerfstudio.utils import comms, profiler
|
||||||
@@ -213,7 +240,12 @@ def entrypoint():
|
|||||||
"""Entrypoint for use with pyproject scripts."""
|
"""Entrypoint for use with pyproject scripts."""
|
||||||
# Choose a base configuration and override values.
|
# Choose a base configuration and override values.
|
||||||
tyro.extras.set_accent_color("bright_yellow")
|
tyro.extras.set_accent_color("bright_yellow")
|
||||||
main(tyro.cli(AnnotatedBaseConfigUnion))
|
main(
|
||||||
|
tyro.cli(
|
||||||
|
AnnotatedBaseConfigUnion,
|
||||||
|
description=convert_markup_to_ansi(__doc__),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in new issue
Block a user