From 72a14b0b22121d344a05acc83733528101c55202 Mon Sep 17 00:00:00 2001 From: Matthew Tancik Date: Tue, 9 May 2023 16:44:21 -0700 Subject: [PATCH] Move scripts folder into nerfstudio (#1897) move scripts folder into nerfstudio --- .dockerignore | 2 +- .github/workflows/core_code_checks.yml | 10 +-- .gitignore | 2 +- .vscode/launch.json | 24 +++---- .../debugging_tools/benchmarking.md | 28 ++++---- docs/extensions/blender_addon.md | 66 ++++++++++--------- docs/quickstart/export_geometry.md | 3 +- docs/reference/cli/index.md | 20 +++--- docs/reference/cli/ns_download_data.md | 2 +- docs/reference/cli/ns_eval.md | 2 +- docs/reference/cli/ns_export.md | 2 +- docs/reference/cli/ns_install_cli.md | 2 +- docs/reference/cli/ns_process_data.md | 2 +- docs/reference/cli/ns_render.md | 2 +- docs/reference/cli/ns_viewer.md | 2 +- docs/reference/contributing.md | 19 +++--- .../data/dataparsers/nuscenes_dataparser.py | 2 +- nerfstudio/scripts/__init__.py | 13 ++++ .../benchmarking/launch_eval_blender.sh | 0 .../benchmarking/launch_train_blender.sh | 0 nerfstudio/scripts/blender/__init__.py | 13 ++++ .../scripts}/blender/nerfstudio_blender.py | 14 ++++ .../scripts}/completions/.gitignore | 0 nerfstudio/scripts/completions/__init__.py | 13 ++++ .../scripts}/completions/install.py | 14 ++++ .../scripts}/completions/setup.bash | 0 .../scripts}/completions/setup.zsh | 0 .../datasets/process_nuscenes_masks.py | 14 ++++ nerfstudio/scripts/docs/__init__.py | 13 ++++ .../scripts}/docs/add_nb_tags.py | 17 ++++- .../scripts}/docs/build_docs.py | 16 ++++- nerfstudio/scripts/downloads/__init__.py | 13 ++++ .../scripts}/downloads/download_data.py | 14 ++++ {scripts => nerfstudio/scripts}/eval.py | 14 ++++ {scripts => nerfstudio/scripts}/exporter.py | 14 ++++ nerfstudio/scripts/generative/__init__.py | 13 ++++ .../generative/trace_stable_diffusion.py | 14 ++++ nerfstudio/scripts/github/__init__.py | 13 ++++ .../scripts}/github/run_actions.py | 18 ++++- .../scripts}/licensing/copyright.txt | 0 .../scripts}/licensing/license_headers.sh | 4 +- .../scripts}/process_data.py | 14 ++++ {scripts => nerfstudio/scripts}/render.py | 14 ++++ {scripts => nerfstudio/scripts}/texture.py | 14 ++++ {scripts => nerfstudio/scripts}/train.py | 14 ++++ nerfstudio/scripts/viewer/__init__.py | 13 ++++ .../scripts}/viewer/run_viewer.py | 14 ++++ .../viewer/sync_viser_message_defs.py | 14 ++++ pyproject.toml | 25 ++++--- scripts/__init__.py | 0 scripts/blender/__init__.py | 0 scripts/completions/__init__.py | 0 scripts/docs/__init__.py | 0 scripts/downloads/__init__.py | 0 scripts/generative/__init__.py | 0 scripts/github/__init__.py | 0 scripts/viewer/__init__.py | 0 tests/test_train.py | 2 +- 58 files changed, 446 insertions(+), 112 deletions(-) create mode 100644 nerfstudio/scripts/__init__.py rename {scripts => nerfstudio/scripts}/benchmarking/launch_eval_blender.sh (100%) rename {scripts => nerfstudio/scripts}/benchmarking/launch_train_blender.sh (100%) create mode 100644 nerfstudio/scripts/blender/__init__.py rename {scripts => nerfstudio/scripts}/blender/nerfstudio_blender.py (96%) rename {scripts => nerfstudio/scripts}/completions/.gitignore (100%) create mode 100644 nerfstudio/scripts/completions/__init__.py rename {scripts => nerfstudio/scripts}/completions/install.py (96%) rename {scripts => nerfstudio/scripts}/completions/setup.bash (100%) rename {scripts => nerfstudio/scripts}/completions/setup.zsh (100%) rename {scripts => nerfstudio/scripts}/datasets/process_nuscenes_masks.py (90%) create mode 100644 nerfstudio/scripts/docs/__init__.py rename {scripts => nerfstudio/scripts}/docs/add_nb_tags.py (78%) rename {scripts => nerfstudio/scripts}/docs/build_docs.py (66%) create mode 100644 nerfstudio/scripts/downloads/__init__.py rename {scripts => nerfstudio/scripts}/downloads/download_data.py (96%) rename {scripts => nerfstudio/scripts}/eval.py (72%) rename {scripts => nerfstudio/scripts}/exporter.py (96%) create mode 100644 nerfstudio/scripts/generative/__init__.py rename {scripts => nerfstudio/scripts}/generative/trace_stable_diffusion.py (84%) create mode 100644 nerfstudio/scripts/github/__init__.py rename {scripts => nerfstudio/scripts}/github/run_actions.py (81%) rename {scripts => nerfstudio/scripts}/licensing/copyright.txt (100%) rename {scripts => nerfstudio/scripts}/licensing/license_headers.sh (80%) rename {scripts => nerfstudio/scripts}/process_data.py (96%) rename {scripts => nerfstudio/scripts}/render.py (96%) rename {scripts => nerfstudio/scripts}/texture.py (79%) rename {scripts => nerfstudio/scripts}/train.py (93%) create mode 100644 nerfstudio/scripts/viewer/__init__.py rename {scripts => nerfstudio/scripts}/viewer/run_viewer.py (84%) rename {scripts => nerfstudio/scripts}/viewer/sync_viser_message_defs.py (73%) delete mode 100644 scripts/__init__.py delete mode 100644 scripts/blender/__init__.py delete mode 100644 scripts/completions/__init__.py delete mode 100644 scripts/docs/__init__.py delete mode 100644 scripts/downloads/__init__.py delete mode 100644 scripts/generative/__init__.py delete mode 100644 scripts/github/__init__.py delete mode 100644 scripts/viewer/__init__.py diff --git a/.dockerignore b/.dockerignore index e1590ed27..92619bde0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -12,7 +12,7 @@ build/ develop-eggs/ dist/ downloads/ -!scripts/downloads/ +!nerfstudio/scripts/downloads/ eggs/ .eggs/ lib/ diff --git a/.github/workflows/core_code_checks.yml b/.github/workflows/core_code_checks.yml index 62128edff..3e30fba7d 100644 --- a/.github/workflows/core_code_checks.yml +++ b/.github/workflows/core_code_checks.yml @@ -28,17 +28,17 @@ jobs: pip install --upgrade --upgrade-strategy eager -e .[dev] - name: Run license checks run: | - ./scripts/licensing/license_headers.sh --check + ./nerfstudio/scripts/licensing/license_headers.sh --check - name: Check notebook cell metadata run: | - python ./scripts/docs/add_nb_tags.py --check + python ./nerfstudio/scripts/docs/add_nb_tags.py --check - name: Run isort - run: isort docs/ nerfstudio/ scripts/ tests/ --profile black --check + run: isort docs/ nerfstudio/ tests/ --profile black --check - name: Run Black - run: black docs/ nerfstudio/ scripts/ tests/ --check + run: black docs/ nerfstudio/ tests/ --check - name: Python Pylint run: | - pylint nerfstudio tests scripts + pylint nerfstudio tests - name: Test with pytest run: | pytest diff --git a/.gitignore b/.gitignore index cfa4358d2..7f1688d59 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ build/ develop-eggs/ dist/ downloads/ -!scripts/downloads/ +!nerfstudio/scripts/downloads/ eggs/ .eggs/ lib/ diff --git a/.vscode/launch.json b/.vscode/launch.json index da293a07b..6e4dc7c4a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -30,7 +30,7 @@ "name": "Python: train", "type": "python", "request": "launch", - "program": "scripts/train.py", + "program": "nerfstudio/scripts/train.py", "console": "integratedTerminal", "args": [ "instant_ngp", @@ -42,7 +42,7 @@ "name": "Python: train ngp", "type": "python", "request": "launch", - "program": "scripts/train.py", + "program": "nerfstudio/scripts/train.py", "console": "integratedTerminal", "args": ["instant_ngp"] }, @@ -50,7 +50,7 @@ "name": "Python: train ngp nerfstudio", "type": "python", "request": "launch", - "program": "scripts/train.py", + "program": "nerfstudio/scripts/train.py", "console": "integratedTerminal", "args": [ "instant_ngp", @@ -70,7 +70,7 @@ "name": "Python: train ngp-friends", "type": "python", "request": "launch", - "program": "scripts/train.py", + "program": "nerfstudio/scripts/train.py", "console": "integratedTerminal", "args": [ "instant_ngp", @@ -89,7 +89,7 @@ "name": "Python: train semantic_nerfw", "type": "python", "request": "launch", - "program": "scripts/train.py", + "program": "nerfstudio/scripts/train.py", "console": "integratedTerminal", "args": ["semantic_nerf"] }, @@ -97,10 +97,10 @@ "name": "Python: NeuS on Replica", "type": "python", "request": "launch", - "program": "scripts/train.py", + "program": "nerfstudio/scripts/train.py", "console": "integratedTerminal", "justMyCode": false, - "env": {"CUDA_VISIBLE_DEVICES":"0"}, + "env": { "CUDA_VISIBLE_DEVICES": "0" }, "args": [ "neus", "--pipeline.model.sdf-field.inside-outside=True", @@ -116,10 +116,10 @@ "name": "Python: NeuS-facto on Replica", "type": "python", "request": "launch", - "program": "scripts/train.py", + "program": "nerfstudio/scripts/train.py", "console": "integratedTerminal", "justMyCode": false, - "env": {"CUDA_VISIBLE_DEVICES":"0"}, + "env": { "CUDA_VISIBLE_DEVICES": "0" }, "args": [ "neus-facto", "--pipeline.model.sdf-field.inside-outside=True", @@ -135,10 +135,10 @@ "name": "Python: NeuS-facto on DTU (no mono-prior)", "type": "python", "request": "launch", - "program": "scripts/train.py", + "program": "nerfstudio/scripts/train.py", "console": "integratedTerminal", "justMyCode": false, - "env": {"CUDA_VISIBLE_DEVICES":"0"}, + "env": { "CUDA_VISIBLE_DEVICES": "0" }, "args": [ "neus-facto", "--pipeline.model.sdf-field.inside-outside=False", @@ -148,6 +148,6 @@ "--include_mono_prior=False", "--auto-orient=True" ] - }, + } ] } diff --git a/docs/developer_guides/debugging_tools/benchmarking.md b/docs/developer_guides/debugging_tools/benchmarking.md index 5e213fb1b..b38c09277 100644 --- a/docs/developer_guides/debugging_tools/benchmarking.md +++ b/docs/developer_guides/debugging_tools/benchmarking.md @@ -9,7 +9,7 @@ To launch training jobs automatically on each of these items, you can call: ```bash -./scripts/benchmarking/launch_train_blender.sh -m {METHOD_NAME} [-s] [-v {VIS}] [{GPU_LIST}] +./nerfstudio/scripts/benchmarking/launch_train_blender.sh -m {METHOD_NAME} [-s] [-v {VIS}] [{GPU_LIST}] ``` Simply replace the arguments in brackets with the correct arguments. @@ -18,31 +18,31 @@ Simply replace the arguments in brackets with the correct arguments. - `-s`: Launch a single job per GPU. - `-v {VIS}`: Use another visualization than wandb, which is the default. Only other option is tensorboard. - `{GPU_LIST}`: (optional) Specify the list of gpus you want to use on your machine space separated. for instance, if you want to use GPU's 0-3, you will need to pass in `0 1 2 3`. If left empty, the script will automatically find available GPU's and distribute training jobs on the available GPUs. - + :::{admonition} Tip :class: info -To view all the arguments and annotations, you can run `./scripts/benchmarking/launch_train_blender.sh --help` - ::: - +To view all the arguments and annotations, you can run `./nerfstudio/scripts/benchmarking/launch_train_blender.sh --help` +::: A full example would be: - Specifying gpus - ```bash - ./scripts/benchmarking/launch_train_blender.sh -m nerfacto 0 1 2 3 - ``` + + ```bash + ./nerfstudio/scripts/benchmarking/launch_train_blender.sh -m nerfacto 0 1 2 3 + ``` - Automatically find available gpus - ```bash - ./scripts/benchmarking/launch_train_blender.sh -m nerfacto - ``` + ```bash + ./nerfstudio/scripts/benchmarking/launch_train_blender.sh -m nerfacto + ``` The script will automatically launch training on all of the items and save the checkpoints in an output directory with the experiment name and current timestamp. ## Evaluating trained Blender models -Once you have launched training, and training converges, you can test your method with `scripts/benchmarking/launch_eval_blender.sh`. +Once you have launched training, and training converges, you can test your method with `nerfstudio/scripts/benchmarking/launch_eval_blender.sh`. Say we ran a benchmark on 08-10-2022 for `instant-ngp`. By default, the train script will save the benchmarks in the following format: @@ -65,7 +65,7 @@ If we wanted to run the benchmark on all the blender data for the above example, ```bash -./scripts/benchmarking/launch_eval_blender.sh -m instant-ngp -o outputs/ -t 2022-08-10_172517 [{GPU_LIST}] +./nerfstudio/scripts/benchmarking/launch_eval_blender.sh -m instant-ngp -o outputs/ -t 2022-08-10_172517 [{GPU_LIST}] ``` The flags used in the benchmarking script are defined as follows: @@ -90,4 +90,4 @@ outputs :class: warning Since we are running multiple backgrounded processes concurrently with this script, please note the terminal logs may be messy. - ::: +::: diff --git a/docs/extensions/blender_addon.md b/docs/extensions/blender_addon.md index 842d9bb38..8e2fa4bd2 100644 --- a/docs/extensions/blender_addon.md +++ b/docs/extensions/blender_addon.md @@ -16,7 +16,7 @@ This Blender add-on allows for compositing with a Nerfstudio render as a backgro 1. The add-on requires Blender 3.0 or newer, install Blender [here](https://www.blender.org/). -2. Download Blender Add-on Script +2. Download Blender Add-on Script 3. Install and enable the add-on in Blender in `Edit → Preferences → Add-Ons`. The add-on will be visible in the Render Properties tab on the right panel.
@@ -136,34 +136,34 @@ You can composite NeRF objects into a scene with a NeRF background by rendering 1. Import the background NeRF scene as a point cloud (or mesh, but point cloud is preferred for large scenes). 2. Export a cropped NeRF mesh of the NeRF object(s) - - Open the NeRF object from the Nerfstudio viewer and select "Crop Viewport" and accordingly adjust the Scale and Center values of the bounding box to crop the NeRF scene to around the bounds of the object of interest. -
- image -
- - - Copy over the scale and center values into the Export panel and export the NeRF object as a mesh (point cloud will also work but shadows can be rendered if the object is a mesh) + - Open the NeRF object from the Nerfstudio viewer and select "Crop Viewport" and accordingly adjust the Scale and Center values of the bounding box to crop the NeRF scene to around the bounds of the object of interest. - - Keep note of the scale and center values for the crop. This can be done by creating a new JSON camera path in the editor which will add a crop section towards the end of the file. +
+ image +
-
- image -
- + - Copy over the scale and center values into the Export panel and export the NeRF object as a mesh (point cloud will also work but shadows can be rendered if the object is a mesh) + + - Keep note of the scale and center values for the crop. This can be done by creating a new JSON camera path in the editor which will add a crop section towards the end of the file. + +
+ image +
3. Import the NeRF object representation. Rescale and position the scene and NeRF object and background environment. You can also animate either of them. 4. (Optional) To add shadows of the NeRF object(s) - - Add a plane representing the ground of the environment. In object properties, select "Shadow Catcher" under Visibility. You may have to switch to the cycles renderer to see the shadow catcher option. - - In the object properties of the NeRF object, go to the Ray Visibility section and deselect the "Camera" option. This will hide the mesh in the Blender render, but keep its shadow. - + - Add a plane representing the ground of the environment. In object properties, select "Shadow Catcher" under Visibility. You may have to switch to the cycles renderer to see the shadow catcher option. -
- image -
- - - Render the Blender animation with only the shadow of the object on the shadow catcher visible. Render with a transparent background by selecting "Transparent" under the Film Settings in the Render Properties. + - In the object properties of the NeRF object, go to the Ray Visibility section and deselect the "Camera" option. This will hide the mesh in the Blender render, but keep its shadow. + +
+ image +
+ + - Render the Blender animation with only the shadow of the object on the shadow catcher visible. Render with a transparent background by selecting "Transparent" under the Film Settings in the Render Properties. 5. Go to the Nerfstudio Add-on in Render Properties and expand the "Nerfstudio Path Generator" tab in the panel. Use the object selector to select the NeRF environment representation. Then, select the file path for the output JSON camera path file. Click "Generate JSON file". The output JSON file is named `camera_path_blender.json`. It is recommended to rename this JSON file to keep track of the multiple camera paths that will be used to construct the full render. @@ -172,29 +172,32 @@ You can composite NeRF objects into a scene with a NeRF background by rendering 7. Render the NeRF of the background environment using the generated camera path for the environment using the Nerfstudio in the command line or terminal. 8. Render the NeRF object - - Open the recently generated blender Nerfstudio JSON camera path and add the crop parameters to the camera path. This section will be placed towards the end of the Blender Nerfstudio camera path after the `is_cycle` field. This can be done by copying over the crop section from the JSON camera path with the scene crop which was exported earlier. Alternatively, you can enter the crop values manually in this format. -
- image -
- - Render the NeRF object using Nerfstudio and the edited camera path in the command line or terminal. This will be the RGB render. + - Open the recently generated blender Nerfstudio JSON camera path and add the crop parameters to the camera path. This section will be placed towards the end of the Blender Nerfstudio camera path after the `is_cycle` field. This can be done by copying over the crop section from the JSON camera path with the scene crop which was exported earlier. Alternatively, you can enter the crop values manually in this format. +
+ image +
- - Next, render the accumulation render as an alpha mask of the NeRF object by adding the command line argument `--rendered-output-names accumulation` to the render command. + - Render the NeRF object using Nerfstudio and the edited camera path in the command line or terminal. This will be the RGB render. -
- image -
+ - Next, render the accumulation render as an alpha mask of the NeRF object by adding the command line argument `--rendered-output-names accumulation` to the render command. + +
+ image +
9. Convert each of the Nerfstudio render videos into an image sequence of frames as PNG or JPG files. This will ensure that the frames will be aligned when compositing. You can convert the video mp4 to an image sequence by creating a Blender Video Editing file and rendering the mp4 as JPGs or PNGs. -10. Composite the NeRF renders in a video editing software such as Adobe Premiere Pro. +10. Composite the NeRF renders in a video editing software such as Adobe Premiere Pro. + - Place the render of the Nerfstudio background environment at the lowest layer, then place the shadow render of the NeRF object if created. - - Place the RGB NeRF render of the NeRF object over the environment (and shadow if present) layers and then place the accumulation NeRF object render over the RGB NeRF object render. + - Place the RGB NeRF render of the NeRF object over the environment (and shadow if present) layers and then place the accumulation NeRF object render over the RGB NeRF object render. - Apply a filter to use the accumulation render as an alpha mask. In Premiere Pro, apply the effect "Track Matte Key" to the RGB render and select the "Matte" as the video track of the accumulation render and under "Composite Using" select "Matte Luma". ### Additional Details + - The RGB and accumulation renders will need to be rendered for each NeRF cropped object in the scene, but not for the NeRF environment if it is not cropped. - If you will composite a shadow layer, the quality of the exported mesh of the NeRF object should have enough fidelity to cast a shadow, but the texture doesn't need to be clear. - If motion tracking or compositing over real camera footage, you can add planes or cubes to represent walls or doorways as shadow catcher or holdout objects. This will composite the shadow layer over the NeRF environment and help create alpha masks. @@ -202,6 +205,7 @@ You can composite NeRF objects into a scene with a NeRF background by rendering - A walkthrough of this section is included in the tutorial video. ### Examples +

image image diff --git a/docs/quickstart/export_geometry.md b/docs/quickstart/export_geometry.md index 28d29fc54..2ffd51895 100644 --- a/docs/quickstart/export_geometry.md +++ b/docs/quickstart/export_geometry.md @@ -19,7 +19,6 @@ Poisson surface reconstruction gives the highest quality meshes. See the steps b > **Note:** > This will only work with a Model that computes or predicts normals, e.g., nerfacto. - 1. Train nerfacto with network settings that predict normals. ```bash @@ -51,7 +50,7 @@ ns-export --help Say you want to simplify and/or smooth a mesh offline, and then you want to texture it with NeRF. You can do that with the following command. It will work for any mesh filetypes that [PyMeshLab](https://pymeshlab.readthedocs.io/en/latest/) can support, for example a `.ply`. ```python -python scripts/texture.py --load-config CONFIG.yml --input-mesh-filename FILENAME --output-dir OUTPUT_DIR +python nerfstudio/scripts/texture.py --load-config CONFIG.yml --input-mesh-filename FILENAME --output-dir OUTPUT_DIR ``` ## Dependencies diff --git a/docs/reference/cli/index.md b/docs/reference/cli/index.md index 7bc95834f..4daee6555 100644 --- a/docs/reference/cli/index.md +++ b/docs/reference/cli/index.md @@ -6,16 +6,16 @@ We provide a command line interface for training your own NeRFs (no coding neces Here are the popular commands that we offer. If you've cloned the repo, you can also look at the [pyproject.toml file](https://github.com/nerfstudio-project/nerfstudio/blob/main/pyproject.toml) at the `[project.scripts]` section for details. -| Command | Description | Filename | -| ------------------------------------ | -------------------------------------- | ---------------------------------- | -| [ns-install-cli](ns_install_cli) | Install tab completion for all scripts | scripts/completions/install.py | -| [ns-process-data](ns_process_data) | Generate a dataset from your own data | scripts/process_data.py | -| [ns-download-data](ns_download_data) | Download existing captures | scripts/downloads/download_data.py | -| [ns-train](ns_train) | Generate a NeRF | scripts/train.py | -| [ns-viewer](ns_viewer) | View a trained NeRF | scripts/viewer/run_viewer.py | -| [ns-eval](ns_eval) | Run evaluation metrics for your Model | scripts/eval.py | -| [ns-render](ns_render) | Render out a video of your NeRF | scripts/render.py | -| [ns-export](ns_export) | Export a NeRF into other formats | scripts/exporter.py | +| Command | Description | Filename | +| ------------------------------------ | -------------------------------------- | --------------------------------------------- | +| [ns-install-cli](ns_install_cli) | Install tab completion for all scripts | nerfstudio/scripts/completions/install.py | +| [ns-process-data](ns_process_data) | Generate a dataset from your own data | nerfstudio/scripts/process_data.py | +| [ns-download-data](ns_download_data) | Download existing captures | nerfstudio/scripts/downloads/download_data.py | +| [ns-train](ns_train) | Generate a NeRF | nerfstudio/scripts/train.py | +| [ns-viewer](ns_viewer) | View a trained NeRF | nerfstudio/scripts/viewer/run_viewer.py | +| [ns-eval](ns_eval) | Run evaluation metrics for your Model | nerfstudio/scripts/eval.py | +| [ns-render](ns_render) | Render out a video of your NeRF | nerfstudio/scripts/render.py | +| [ns-export](ns_export) | Export a NeRF into other formats | nerfstudio/scripts/exporter.py | ```{toctree} :maxdepth: 1 diff --git a/docs/reference/cli/ns_download_data.md b/docs/reference/cli/ns_download_data.md index d096b4e07..1105ef12b 100644 --- a/docs/reference/cli/ns_download_data.md +++ b/docs/reference/cli/ns_download_data.md @@ -2,7 +2,7 @@ ```{eval-rst} .. argparse:: - :module: scripts.downloads.download_data + :module: nerfstudio.scripts.downloads.download_data :func: get_parser_fn :prog: ns-download-data :nodefault: diff --git a/docs/reference/cli/ns_eval.md b/docs/reference/cli/ns_eval.md index a794ac9e8..86e4aa0ba 100644 --- a/docs/reference/cli/ns_eval.md +++ b/docs/reference/cli/ns_eval.md @@ -2,7 +2,7 @@ ```{eval-rst} .. argparse:: - :module: scripts.eval + :module: nerfstudio.scripts.eval :func: get_parser_fn :prog: ns-eval :nodefault: diff --git a/docs/reference/cli/ns_export.md b/docs/reference/cli/ns_export.md index cdfc54f2f..839211915 100644 --- a/docs/reference/cli/ns_export.md +++ b/docs/reference/cli/ns_export.md @@ -2,7 +2,7 @@ ```{eval-rst} .. argparse:: - :module: scripts.exporter + :module: nerfstudio.scripts.exporter :func: get_parser_fn :prog: ns-export :nodefault: diff --git a/docs/reference/cli/ns_install_cli.md b/docs/reference/cli/ns_install_cli.md index e9c1a9541..30fa9598f 100644 --- a/docs/reference/cli/ns_install_cli.md +++ b/docs/reference/cli/ns_install_cli.md @@ -2,7 +2,7 @@ ```{eval-rst} .. argparse:: - :module: scripts.completions.install + :module: nerfstudio.scripts.completions.install :func: get_parser_fn :prog: ns-install-cli :nodefault: diff --git a/docs/reference/cli/ns_process_data.md b/docs/reference/cli/ns_process_data.md index bb5bd24ac..9f9540d44 100644 --- a/docs/reference/cli/ns_process_data.md +++ b/docs/reference/cli/ns_process_data.md @@ -8,7 +8,7 @@ You may also want to install [hloc](https://github.com/cvg/Hierarchical-Localiza ```{eval-rst} .. argparse:: - :module: scripts.process_data + :module: nerfstudio.scripts.process_data :func: get_parser_fn :prog: ns-process-data :nodefault: diff --git a/docs/reference/cli/ns_render.md b/docs/reference/cli/ns_render.md index 7a01f9bae..e006e62ee 100644 --- a/docs/reference/cli/ns_render.md +++ b/docs/reference/cli/ns_render.md @@ -7,7 +7,7 @@ Make sure to have [FFmpeg](https://ffmpeg.org/download.html) installed. ```{eval-rst} .. argparse:: - :module: scripts.render + :module: nerfstudio.scripts.render :func: get_parser_fn :prog: ns-render :nodefault: diff --git a/docs/reference/cli/ns_viewer.md b/docs/reference/cli/ns_viewer.md index 841472a5f..bb6333550 100644 --- a/docs/reference/cli/ns_viewer.md +++ b/docs/reference/cli/ns_viewer.md @@ -2,7 +2,7 @@ ```{eval-rst} .. argparse:: - :module: scripts.viewer.run_viewer + :module: nerfstudio.scripts.viewer.run_viewer :func: get_parser_fn :prog: ns-viewer :nodefault: diff --git a/docs/reference/contributing.md b/docs/reference/contributing.md index a9651cbed..101cb873e 100644 --- a/docs/reference/contributing.md +++ b/docs/reference/contributing.md @@ -7,13 +7,14 @@ Below, we document the contribution pipeline and good-to-knows for when you're r The project is set up for development in VSCode, we recommend using it if you plan to contribute. ## Overview + Below are the various tooling features our team uses to maintain this codebase. -| Tooling | Support | -| --------------- | ------------- | -| Linter | [Black](https://black.readthedocs.io/en/stable/) | -| Testing | [PyTest](https://docs.pytest.org/en/7.1.x/) | -| Docs | [Sphinx](https://www.sphinx-doc.org/en/master/) | +| Tooling | Support | +| --------------- | ---------------------------------------------------------- | +| Linter | [Black](https://black.readthedocs.io/en/stable/) | +| Testing | [PyTest](https://docs.pytest.org/en/7.1.x/) | +| Docs | [Sphinx](https://www.sphinx-doc.org/en/master/) | | Docstring style | [Google](https://google.github.io/styleguide/pyguide.html) | ## Requirements @@ -53,8 +54,8 @@ conda install -c conda-forge pandoc :::{admonition} Attention :class: attention - In order to merge changes to the code base, all of these checks must be passing. If you pass these tests locally, you will likely pass on github servers as well (results in a green checkmark next to your commit). - ::: + In order to merge changes to the code base, all of these checks must be passing. If you pass these tests locally, you will likely pass on github servers as well (results in a green checkmark next to your commit). + ::: 3. Open pull request! 💌 @@ -65,7 +66,7 @@ conda install -c conda-forge pandoc Run the following to build the documentation: ```bash -python scripts/docs/build_docs.py +python nerfstudio/scripts/docs/build_docs.py ``` :::{admonition} Tip @@ -84,7 +85,7 @@ If you want the code to build on save you can use [sphinx autobuild](https://git :class: info If changes to the structure are made, the build files may be incorrect. - ::: +::: ```bash pip install sphinx-autobuild diff --git a/nerfstudio/data/dataparsers/nuscenes_dataparser.py b/nerfstudio/data/dataparsers/nuscenes_dataparser.py index ddf15dc8b..99b75a214 100644 --- a/nerfstudio/data/dataparsers/nuscenes_dataparser.py +++ b/nerfstudio/data/dataparsers/nuscenes_dataparser.py @@ -55,7 +55,7 @@ class NuScenesDataParserConfig(DataParserConfig): Each clip was recorded with a suite of sensors including 6 surround cameras. It also includes 3D cuboid annotations around objects. We optionally use these cuboids to mask dynamic objects by specifying the mask_dir flag. - To create these masks use scripts/datasets/process_nuscenes_masks.py. + To create these masks use nerfstudio/scripts/datasets/process_nuscenes_masks.py. """ _target: Type = field(default_factory=lambda: NuScenes) diff --git a/nerfstudio/scripts/__init__.py b/nerfstudio/scripts/__init__.py new file mode 100644 index 000000000..d926cf95c --- /dev/null +++ b/nerfstudio/scripts/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/scripts/benchmarking/launch_eval_blender.sh b/nerfstudio/scripts/benchmarking/launch_eval_blender.sh similarity index 100% rename from scripts/benchmarking/launch_eval_blender.sh rename to nerfstudio/scripts/benchmarking/launch_eval_blender.sh diff --git a/scripts/benchmarking/launch_train_blender.sh b/nerfstudio/scripts/benchmarking/launch_train_blender.sh similarity index 100% rename from scripts/benchmarking/launch_train_blender.sh rename to nerfstudio/scripts/benchmarking/launch_train_blender.sh diff --git a/nerfstudio/scripts/blender/__init__.py b/nerfstudio/scripts/blender/__init__.py new file mode 100644 index 000000000..d926cf95c --- /dev/null +++ b/nerfstudio/scripts/blender/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/scripts/blender/nerfstudio_blender.py b/nerfstudio/scripts/blender/nerfstudio_blender.py similarity index 96% rename from scripts/blender/nerfstudio_blender.py rename to nerfstudio/scripts/blender/nerfstudio_blender.py index 6ee80f066..6a416e369 100644 --- a/scripts/blender/nerfstudio_blender.py +++ b/nerfstudio/scripts/blender/nerfstudio_blender.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """ nerfstudio_blender.py """ diff --git a/scripts/completions/.gitignore b/nerfstudio/scripts/completions/.gitignore similarity index 100% rename from scripts/completions/.gitignore rename to nerfstudio/scripts/completions/.gitignore diff --git a/nerfstudio/scripts/completions/__init__.py b/nerfstudio/scripts/completions/__init__.py new file mode 100644 index 000000000..d926cf95c --- /dev/null +++ b/nerfstudio/scripts/completions/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/scripts/completions/install.py b/nerfstudio/scripts/completions/install.py similarity index 96% rename from scripts/completions/install.py rename to nerfstudio/scripts/completions/install.py index 67957cf4b..cba1d672b 100644 --- a/scripts/completions/install.py +++ b/nerfstudio/scripts/completions/install.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + #!/usr/bin/env python """Configuration script for setting up tab completion for nerfstudio in bash and zsh.""" diff --git a/scripts/completions/setup.bash b/nerfstudio/scripts/completions/setup.bash similarity index 100% rename from scripts/completions/setup.bash rename to nerfstudio/scripts/completions/setup.bash diff --git a/scripts/completions/setup.zsh b/nerfstudio/scripts/completions/setup.zsh similarity index 100% rename from scripts/completions/setup.zsh rename to nerfstudio/scripts/completions/setup.zsh diff --git a/scripts/datasets/process_nuscenes_masks.py b/nerfstudio/scripts/datasets/process_nuscenes_masks.py similarity index 90% rename from scripts/datasets/process_nuscenes_masks.py rename to nerfstudio/scripts/datasets/process_nuscenes_masks.py index 07b5f5e99..748a27fd2 100644 --- a/scripts/datasets/process_nuscenes_masks.py +++ b/nerfstudio/scripts/datasets/process_nuscenes_masks.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import os from dataclasses import dataclass from pathlib import Path diff --git a/nerfstudio/scripts/docs/__init__.py b/nerfstudio/scripts/docs/__init__.py new file mode 100644 index 000000000..d926cf95c --- /dev/null +++ b/nerfstudio/scripts/docs/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/scripts/docs/add_nb_tags.py b/nerfstudio/scripts/docs/add_nb_tags.py similarity index 78% rename from scripts/docs/add_nb_tags.py rename to nerfstudio/scripts/docs/add_nb_tags.py index 4a7d97fe0..a110e0d76 100644 --- a/scripts/docs/add_nb_tags.py +++ b/nerfstudio/scripts/docs/add_nb_tags.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """Helper that add tags to notebooks based on cell comments.""" import sys @@ -60,7 +74,8 @@ def main(check: bool = False): if incorrect_metadata: if check: CONSOLE.print( - f"[bold yellow]{ipath} has incorrect metadata. Call `python scripts.docs.add_nb_tags.py` to add it." + f"[bold yellow]{ipath} has incorrect metadata. " + "Call `python nerfstudio.scripts.docs.add_nb_tags.py` to add it." ) any_missing = True else: diff --git a/scripts/docs/build_docs.py b/nerfstudio/scripts/docs/build_docs.py similarity index 66% rename from scripts/docs/build_docs.py rename to nerfstudio/scripts/docs/build_docs.py index cb31e54b3..1959220a1 100644 --- a/scripts/docs/build_docs.py +++ b/nerfstudio/scripts/docs/build_docs.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + #!/usr/bin/env python """Simple yaml debugger""" import subprocess @@ -32,7 +46,7 @@ def main(clean_cache: bool = False): """ CONSOLE.print("[green]Adding notebook documentation metadata") - run_command("python scripts/docs/add_nb_tags.py") + run_command("python nerfstudio/scripts/docs/add_nb_tags.py") # Add checks for building documentation CONSOLE.print("[green]Building Documentation") diff --git a/nerfstudio/scripts/downloads/__init__.py b/nerfstudio/scripts/downloads/__init__.py new file mode 100644 index 000000000..d926cf95c --- /dev/null +++ b/nerfstudio/scripts/downloads/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/scripts/downloads/download_data.py b/nerfstudio/scripts/downloads/download_data.py similarity index 96% rename from scripts/downloads/download_data.py rename to nerfstudio/scripts/downloads/download_data.py index a92798bbb..d97dd659b 100644 --- a/scripts/downloads/download_data.py +++ b/nerfstudio/scripts/downloads/download_data.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """Download datasets and specific captures from the datasets.""" from __future__ import annotations diff --git a/scripts/eval.py b/nerfstudio/scripts/eval.py similarity index 72% rename from scripts/eval.py rename to nerfstudio/scripts/eval.py index 6f90bb35a..517da3179 100644 --- a/scripts/eval.py +++ b/nerfstudio/scripts/eval.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + #!/usr/bin/env python """ eval.py diff --git a/scripts/exporter.py b/nerfstudio/scripts/exporter.py similarity index 96% rename from scripts/exporter.py rename to nerfstudio/scripts/exporter.py index 0f4f4ec60..dfca20637 100644 --- a/scripts/exporter.py +++ b/nerfstudio/scripts/exporter.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """ Script for exporting NeRF into other formats. """ diff --git a/nerfstudio/scripts/generative/__init__.py b/nerfstudio/scripts/generative/__init__.py new file mode 100644 index 000000000..d926cf95c --- /dev/null +++ b/nerfstudio/scripts/generative/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/scripts/generative/trace_stable_diffusion.py b/nerfstudio/scripts/generative/trace_stable_diffusion.py similarity index 84% rename from scripts/generative/trace_stable_diffusion.py rename to nerfstudio/scripts/generative/trace_stable_diffusion.py index eee069eb3..3a426cb2c 100644 --- a/scripts/generative/trace_stable_diffusion.py +++ b/nerfstudio/scripts/generative/trace_stable_diffusion.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """Trace Stable Diffusion UNet for speed improvement""" import functools diff --git a/nerfstudio/scripts/github/__init__.py b/nerfstudio/scripts/github/__init__.py new file mode 100644 index 000000000..d926cf95c --- /dev/null +++ b/nerfstudio/scripts/github/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/scripts/github/run_actions.py b/nerfstudio/scripts/github/run_actions.py similarity index 81% rename from scripts/github/run_actions.py rename to nerfstudio/scripts/github/run_actions.py index 19179725c..8f5bb7ce1 100644 --- a/scripts/github/run_actions.py +++ b/nerfstudio/scripts/github/run_actions.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + #!/usr/bin/env python """Simple yaml debugger""" import subprocess @@ -57,7 +71,9 @@ def run_github_actions_file(filename: str, continue_on_fail: bool = False): # Add checks for building documentation CONSOLE.line() CONSOLE.rule("[bold green]Adding notebook documentation metadata") - success = success and run_command("python scripts/docs/add_nb_tags.py", continue_on_fail=continue_on_fail) + success = success and run_command( + "python nerfstudio/scripts/docs/add_nb_tags.py", continue_on_fail=continue_on_fail + ) CONSOLE.line() CONSOLE.rule("[bold green]Building Documentation") success = success and run_command("cd docs/; make html SPHINXOPTS='-W;'", continue_on_fail=continue_on_fail) diff --git a/scripts/licensing/copyright.txt b/nerfstudio/scripts/licensing/copyright.txt similarity index 100% rename from scripts/licensing/copyright.txt rename to nerfstudio/scripts/licensing/copyright.txt diff --git a/scripts/licensing/license_headers.sh b/nerfstudio/scripts/licensing/license_headers.sh similarity index 80% rename from scripts/licensing/license_headers.sh rename to nerfstudio/scripts/licensing/license_headers.sh index 36482085c..286d7ffb1 100755 --- a/scripts/licensing/license_headers.sh +++ b/nerfstudio/scripts/licensing/license_headers.sh @@ -27,7 +27,7 @@ do echo "$i missing copyright header" check_failed=true else - cat scripts/licensing/copyright.txt $i >$i.new && mv $i.new $i + cat nerfstudio/scripts/licensing/copyright.txt $i >$i.new && mv $i.new $i echo "Adding license header to $i." fi added_headers=true @@ -36,7 +36,7 @@ done if [ "$check_failed" = true ]; then - echo "Run '.scripts/licensing/license_headers.sh to add missing headers.'" + echo "Run '.nerfstudio/scripts/licensing/license_headers.sh to add missing headers.'" exit 1 fi diff --git a/scripts/process_data.py b/nerfstudio/scripts/process_data.py similarity index 96% rename from scripts/process_data.py rename to nerfstudio/scripts/process_data.py index 02c164d4e..4c2f3829b 100644 --- a/scripts/process_data.py +++ b/nerfstudio/scripts/process_data.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + #!/usr/bin/env python """Processes a video or image sequence to a nerfstudio compatible dataset.""" diff --git a/scripts/render.py b/nerfstudio/scripts/render.py similarity index 96% rename from scripts/render.py rename to nerfstudio/scripts/render.py index bdff762d9..f3f6b6789 100644 --- a/scripts/render.py +++ b/nerfstudio/scripts/render.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + #!/usr/bin/env python """ render.py diff --git a/scripts/texture.py b/nerfstudio/scripts/texture.py similarity index 79% rename from scripts/texture.py rename to nerfstudio/scripts/texture.py index 2dfbd679b..98f26b846 100644 --- a/scripts/texture.py +++ b/nerfstudio/scripts/texture.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """ Script to texture an existing mesh file. """ diff --git a/scripts/train.py b/nerfstudio/scripts/train.py similarity index 93% rename from scripts/train.py rename to nerfstudio/scripts/train.py index 8f2e0b719..408e80d2b 100644 --- a/scripts/train.py +++ b/nerfstudio/scripts/train.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + #!/usr/bin/env python """Train a radiance field with nerfstudio. For real captures, we recommend using the [bright_yellow]nerfacto[/bright_yellow] model. diff --git a/nerfstudio/scripts/viewer/__init__.py b/nerfstudio/scripts/viewer/__init__.py new file mode 100644 index 000000000..d926cf95c --- /dev/null +++ b/nerfstudio/scripts/viewer/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/scripts/viewer/run_viewer.py b/nerfstudio/scripts/viewer/run_viewer.py similarity index 84% rename from scripts/viewer/run_viewer.py rename to nerfstudio/scripts/viewer/run_viewer.py index ff49300c7..62abe8941 100644 --- a/scripts/viewer/run_viewer.py +++ b/nerfstudio/scripts/viewer/run_viewer.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + #!/usr/bin/env python """ Starts viewer in eval mode. diff --git a/scripts/viewer/sync_viser_message_defs.py b/nerfstudio/scripts/viewer/sync_viser_message_defs.py similarity index 73% rename from scripts/viewer/sync_viser_message_defs.py rename to nerfstudio/scripts/viewer/sync_viser_message_defs.py index 369836acb..c693db288 100644 --- a/scripts/viewer/sync_viser_message_defs.py +++ b/nerfstudio/scripts/viewer/sync_viser_message_defs.py @@ -1,3 +1,17 @@ +# Copyright 2022 The Nerfstudio Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """Generate viser message definitions for TypeScript, by parsing Python dataclasses.""" import json import pathlib diff --git a/pyproject.toml b/pyproject.toml index 9b09c6ef9..abe400912 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,17 +99,17 @@ docs = [ ] [project.scripts] -# Note, add entrypoint name to scripts/completions/install.py to include CLI completion -ns-install-cli = "scripts.completions.install:entrypoint" -ns-process-data = "scripts.process_data:entrypoint" -ns-download-data = "scripts.downloads.download_data:entrypoint" -ns-train = "scripts.train:entrypoint" -ns-viewer = "scripts.viewer.run_viewer:entrypoint" -ns-eval = "scripts.eval:entrypoint" -ns-render = "scripts.render:entrypoint" -ns-export = "scripts.exporter:entrypoint" -ns-dev-test = "scripts.github.run_actions:entrypoint" -ns-dev-sync-viser-message-defs = "scripts.viewer.sync_viser_message_defs:entrypoint" +# Note, add entrypoint name to nerfstudio/scripts/completions/install.py to include CLI completion +ns-install-cli = "nerfstudio.scripts.completions.install:entrypoint" +ns-process-data = "nerfstudio.scripts.process_data:entrypoint" +ns-download-data = "nerfstudio.scripts.downloads.download_data:entrypoint" +ns-train = "nerfstudio.scripts.train:entrypoint" +ns-viewer = "nerfstudio.scripts.viewer.run_viewer:entrypoint" +ns-eval = "nerfstudio.scripts.eval:entrypoint" +ns-render = "nerfstudio.scripts.render:entrypoint" +ns-export = "nerfstudio.scripts.exporter:entrypoint" +ns-dev-test = "nerfstudio.scripts.github.run_actions:entrypoint" +ns-dev-sync-viser-message-defs = "nerfstudio.scripts.viewer.sync_viser_message_defs:entrypoint" [options] # equivalent to using --extra-index-url with pip, which is needed for specifying the CUDA version torch and torchvision @@ -118,7 +118,7 @@ dependency_links = [ ] [tool.setuptools.packages.find] -include = ["nerfstudio*","scripts*"] +include = ["nerfstudio*"] [tool.setuptools.package-data] "*" = ["*.cu", "*.json", "py.typed", "setup.bash", "setup.zsh"] @@ -132,7 +132,6 @@ line-length = 120 max-line-length = 120 generated-members = ["numpy.*", "torch.*", "cv2.*", "cv.*"] good-names-rgxs = "^[_a-zA-Z][_a-z0-9]?$" -ignore-paths = ["scripts/colmap2nerf.py"] jobs = 0 ignored-classes = ["TensorDataclass"] diff --git a/scripts/__init__.py b/scripts/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/blender/__init__.py b/scripts/blender/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/completions/__init__.py b/scripts/completions/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/docs/__init__.py b/scripts/docs/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/downloads/__init__.py b/scripts/downloads/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/generative/__init__.py b/scripts/generative/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/github/__init__.py b/scripts/github/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/viewer/__init__.py b/scripts/viewer/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/test_train.py b/tests/test_train.py index d4992a6f8..37b0ac41e 100644 --- a/tests/test_train.py +++ b/tests/test_train.py @@ -13,7 +13,7 @@ from nerfstudio.configs.method_configs import method_configs from nerfstudio.data.dataparsers.blender_dataparser import BlenderDataParserConfig from nerfstudio.data.dataparsers.minimal_dataparser import MinimalDataParserConfig from nerfstudio.engine.trainer import TrainerConfig -from scripts.train import train_loop +from nerfstudio.scripts.train import train_loop BLACKLIST = [ "base",