mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-13 03:14:00 +08:00
update cli docs for process-data (#617)
* update cli docs for process-data * Update recs * fix toml
This commit is contained in:
1 parent
60bf31844f
commit
37907698f2
9 files changed
+61
-19
No files matched your search
@@ -33,6 +33,7 @@ release = "0.0.0"
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
"sphinxarg.ext",
|
||||
"sphinx.ext.duration",
|
||||
"sphinx.ext.doctest",
|
||||
"sphinx.ext.autodoc",
|
||||
|
||||
+2
-1
@@ -57,8 +57,9 @@ Contents
|
||||
:hidden:
|
||||
:caption: Reference
|
||||
|
||||
Contributing<reference/contributing.md>
|
||||
reference/cli/index
|
||||
reference/api/index
|
||||
Contributing<reference/contributing.md>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
.. _cli:
|
||||
|
||||
CLI
|
||||
============
|
||||
|
||||
.. toctree::
|
||||
|
||||
ns_process_data
|
||||
@@ -0,0 +1,14 @@
|
||||
# ns-process-data
|
||||
|
||||
:::{admonition} Note
|
||||
:class: warning
|
||||
Make sure to have [COLMAP](https://colmap.github.io) and [FFmpeg](https://ffmpeg.org/download.html) installed.
|
||||
:::
|
||||
|
||||
```{eval-rst}
|
||||
.. argparse::
|
||||
:module: scripts.process_data
|
||||
:func: get_parser_fn
|
||||
:prog: ns-process-data
|
||||
:nodefault:
|
||||
```
|
||||
@@ -9,10 +9,10 @@ To assist running on custom data we have a script that will process a video or f
|
||||
To process your data run:
|
||||
|
||||
```bash
|
||||
python scripts/process_data.py --data FOLDER_OR_VIDEO --output-dir PROCESSED_DATA_DIR
|
||||
ns-process-data --data FOLDER_OR_VIDEO --output-dir PROCESSED_DATA_DIR
|
||||
```
|
||||
|
||||
If your data was captured with a fisheye camera add `--camera-type fisheye`.
|
||||
A full set of arguments can be found {doc}`here</reference/cli/ns_process_data>`.
|
||||
|
||||
:::{admonition} Tip
|
||||
:class: info
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
Data Setup
|
||||
----------
|
||||
|
||||
# TODO: high level summary
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
|
||||
@@ -42,6 +42,17 @@ from nerfstudio.pipelines.base_pipeline import VanillaPipelineConfig
|
||||
from nerfstudio.pipelines.dynamic_batch import DynamicBatchPipelineConfig
|
||||
|
||||
model_configs: Dict[str, Config] = {}
|
||||
descriptions = {
|
||||
"nerfacto": "[bold green]Recommended[/bold green] Real-time model tuned for real captures. "
|
||||
+ "This model will be continually updated.",
|
||||
"instant-ngp": "Implementation of Instant-NGP. Recommended real-time model for bounded synthetic data.",
|
||||
"mipnerf-360": "High quality model for unbounded 360 degree scenes. [red]*slow*",
|
||||
"mipnerf": "High quality model for bounded scenes. [red]*slow*",
|
||||
"nerfw": "Model designed to handle inconsistent appearance between images. [red]*slow*",
|
||||
"semantic-nerf": "Model that predicts dense semantic segmentations. [red]*slow*",
|
||||
"vanilla-nerf": "Original NeRF model. [red]*slow*",
|
||||
"tensorf": "Fast model designed for bounded scenes.",
|
||||
}
|
||||
|
||||
model_configs["nerfacto"] = Config(
|
||||
method_name="nerfacto",
|
||||
@@ -205,7 +216,9 @@ model_configs["tensorf"] = Config(
|
||||
)
|
||||
|
||||
|
||||
AnnotatedBaseConfigUnion = dcargs.extras.subcommand_type_from_defaults(model_configs)
|
||||
AnnotatedBaseConfigUnion = dcargs.extras.subcommand_type_from_defaults(
|
||||
defaults=model_configs, descriptions=descriptions
|
||||
)
|
||||
"""Union[] type over config types, annotated with default instances for use with
|
||||
dcargs.cli(). Allows the user to pick between one of several base configurations, and
|
||||
then override values in it."""
|
||||
+2
-1
@@ -18,7 +18,7 @@ dependencies = [
|
||||
"aiortc==1.3.2",
|
||||
"appdirs>=1.4",
|
||||
"av==9.2.0",
|
||||
"dcargs>=0.3.11",
|
||||
"dcargs>=0.3.14",
|
||||
"gdown==4.5.1",
|
||||
"ninja==1.10.2.3",
|
||||
"functorch==0.2.1",
|
||||
@@ -68,6 +68,7 @@ docs = [
|
||||
"nbformat==5.4.0",
|
||||
"sphinx==4.5.0",
|
||||
"sphinxemoji==0.2.0",
|
||||
"sphinx-argparse==0.3.1",
|
||||
"sphinx-copybutton==0.5.0",
|
||||
"sphinx-design==0.2.0"
|
||||
]
|
||||
|
||||
+18
-12
@@ -97,7 +97,7 @@ def get_vocab_tree() -> Path:
|
||||
return vocab_tree_filename
|
||||
|
||||
|
||||
def run_command(cmd, verbose=False) -> Optional[str]:
|
||||
def run_command(cmd: str, verbose=False) -> Optional[str]:
|
||||
"""Runs a command and returns the output.
|
||||
|
||||
Args:
|
||||
@@ -165,7 +165,7 @@ def convert_video_to_images(
|
||||
return num_frames, len(list(image_dir.glob("*.png")))
|
||||
|
||||
|
||||
def copy_images(data, image_dir, verbose) -> int:
|
||||
def copy_images(data: Path, image_dir: Path, verbose) -> int:
|
||||
"""Copy images from a directory to a new directory.
|
||||
|
||||
Args:
|
||||
@@ -176,11 +176,15 @@ def copy_images(data, image_dir, verbose) -> int:
|
||||
The number of images copied.
|
||||
"""
|
||||
image_paths = sorted(data.glob("*"))
|
||||
for i, image_path in enumerate(image_paths):
|
||||
i = i + 1 # 1-indexed
|
||||
idx = 0
|
||||
# Images should be 1-indexed for the rest of the pipeline.
|
||||
for image_path in image_paths:
|
||||
if image_path.name.startswith("."):
|
||||
continue
|
||||
idx += 1
|
||||
if verbose:
|
||||
CONSOLE.log(f"Copying image {i + 1} of {len(image_paths)}...")
|
||||
shutil.copy(image_path, image_dir / f"frame_{i:05d}{image_path.suffix}")
|
||||
CONSOLE.log(f"Copying image {idx} of {len(image_paths)}...")
|
||||
shutil.copy(image_path, image_dir / f"frame_{idx:05d}{image_path.suffix}")
|
||||
|
||||
return len(image_paths)
|
||||
|
||||
@@ -383,10 +387,11 @@ def main(
|
||||
"""Process images or videos into a nerfstudio dataset.
|
||||
|
||||
This script does the following:
|
||||
1) Converts the video into images (if video is provided).
|
||||
2) Scales images to a specified size.
|
||||
3) Calculates and stores the sharpness of each image.
|
||||
4) Calculates the camera poses for each image using `COLMAP <https://colmap.github.io/>`_.
|
||||
|
||||
1. Converts the video into images (if video is provided).
|
||||
2. Scales images to a specified size.
|
||||
3. Calculates and stores the sharpness of each image.
|
||||
4. Calculates the camera poses for each image using `COLMAP <https://colmap.github.io/>`_.
|
||||
|
||||
|
||||
Args:
|
||||
@@ -403,8 +408,6 @@ def main(
|
||||
verbose: If True, print extra logging.
|
||||
"""
|
||||
|
||||
print(data)
|
||||
|
||||
check_ffmpeg_installed()
|
||||
check_colmap_installed()
|
||||
|
||||
@@ -491,3 +494,6 @@ def entrypoint():
|
||||
|
||||
if __name__ == "__main__":
|
||||
entrypoint()
|
||||
|
||||
# For sphinx docs
|
||||
get_parser_fn = lambda: dcargs.extras.get_parser(main) # noqa
|
||||
Reference in new issue
Block a user