update cli docs for process-data (#617)

* update cli docs for process-data

* Update recs

* fix toml
This commit is contained in:
Matthew Tancik authored and GitHub committed 2022-10-02 18:09:57 -07:00
1 parent 60bf31844f
commit 37907698f2
9 files changed
+61 -19

No files matched your search

+1
View File
@@ -33,6 +33,7 @@ release = "0.0.0"
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = [ extensions = [
"sphinxarg.ext",
"sphinx.ext.duration", "sphinx.ext.duration",
"sphinx.ext.doctest", "sphinx.ext.doctest",
"sphinx.ext.autodoc", "sphinx.ext.autodoc",
+2 -1
View File
@@ -57,8 +57,9 @@ Contents
:hidden: :hidden:
:caption: Reference :caption: Reference
Contributing<reference/contributing.md> reference/cli/index
reference/api/index reference/api/index
Contributing<reference/contributing.md>
+8
View File
@@ -0,0 +1,8 @@
.. _cli:
CLI
============
.. toctree::
ns_process_data
+14
View File
@@ -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:
```
+2 -2
View File
@@ -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: To process your data run:
```bash ```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 :::{admonition} Tip
:class: info :class: info
-2
View File
@@ -1,8 +1,6 @@
Data Setup Data Setup
---------- ----------
# TODO: high level summary
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
+14 -1
View File
@@ -42,6 +42,17 @@ from nerfstudio.pipelines.base_pipeline import VanillaPipelineConfig
from nerfstudio.pipelines.dynamic_batch import DynamicBatchPipelineConfig from nerfstudio.pipelines.dynamic_batch import DynamicBatchPipelineConfig
model_configs: Dict[str, Config] = {} 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( model_configs["nerfacto"] = Config(
method_name="nerfacto", 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 """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 dcargs.cli(). Allows the user to pick between one of several base configurations, and
then override values in it.""" then override values in it."""
+2 -1
View File
@@ -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",
"dcargs>=0.3.11", "dcargs>=0.3.14",
"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",
@@ -68,6 +68,7 @@ docs = [
"nbformat==5.4.0", "nbformat==5.4.0",
"sphinx==4.5.0", "sphinx==4.5.0",
"sphinxemoji==0.2.0", "sphinxemoji==0.2.0",
"sphinx-argparse==0.3.1",
"sphinx-copybutton==0.5.0", "sphinx-copybutton==0.5.0",
"sphinx-design==0.2.0" "sphinx-design==0.2.0"
] ]
+18 -12
View File
@@ -97,7 +97,7 @@ def get_vocab_tree() -> Path:
return vocab_tree_filename 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. """Runs a command and returns the output.
Args: Args:
@@ -165,7 +165,7 @@ def convert_video_to_images(
return num_frames, len(list(image_dir.glob("*.png"))) 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. """Copy images from a directory to a new directory.
Args: Args:
@@ -176,11 +176,15 @@ def copy_images(data, image_dir, verbose) -> int:
The number of images copied. The number of images copied.
""" """
image_paths = sorted(data.glob("*")) image_paths = sorted(data.glob("*"))
for i, image_path in enumerate(image_paths): idx = 0
i = i + 1 # 1-indexed # 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: if verbose:
CONSOLE.log(f"Copying image {i + 1} of {len(image_paths)}...") CONSOLE.log(f"Copying image {idx} of {len(image_paths)}...")
shutil.copy(image_path, image_dir / f"frame_{i:05d}{image_path.suffix}") shutil.copy(image_path, image_dir / f"frame_{idx:05d}{image_path.suffix}")
return len(image_paths) return len(image_paths)
@@ -383,10 +387,11 @@ def main(
"""Process images or videos into a nerfstudio dataset. """Process images or videos into a nerfstudio dataset.
This script does the following: This script does the following:
1) Converts the video into images (if video is provided).
2) Scales images to a specified size. 1. Converts the video into images (if video is provided).
3) Calculates and stores the sharpness of each image. 2. Scales images to a specified size.
4) Calculates the camera poses for each image using `COLMAP <https://colmap.github.io/>`_. 3. Calculates and stores the sharpness of each image.
4. Calculates the camera poses for each image using `COLMAP <https://colmap.github.io/>`_.
Args: Args:
@@ -403,8 +408,6 @@ def main(
verbose: If True, print extra logging. verbose: If True, print extra logging.
""" """
print(data)
check_ffmpeg_installed() check_ffmpeg_installed()
check_colmap_installed() check_colmap_installed()
@@ -491,3 +494,6 @@ def entrypoint():
if __name__ == "__main__": if __name__ == "__main__":
entrypoint() entrypoint()
# For sphinx docs
get_parser_fn = lambda: dcargs.extras.get_parser(main) # noqa