mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-04 23:08:44 +08:00
cli improvements to download script (#668)
This commit is contained in:
1 parent
ee4e760027
commit
ce8985aeb6
4 files changed
+27
-12
No files matched your search
@@ -7,5 +7,6 @@ CLI
|
|||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
ns_process_data
|
ns_process_data
|
||||||
|
ns_download_data
|
||||||
ns_render
|
ns_render
|
||||||
ns_eval
|
ns_eval
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ns-download-data
|
||||||
|
|
||||||
|
```{eval-rst}
|
||||||
|
.. argparse::
|
||||||
|
:module: scripts.downloads.download_data
|
||||||
|
:func: get_parser_fn
|
||||||
|
:prog: ns-process-data
|
||||||
|
:nodefault:
|
||||||
|
```
|
||||||
+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",
|
||||||
"dcargs>=0.3.17",
|
"dcargs>=0.3.20",
|
||||||
"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",
|
||||||
|
|||||||
Executable → Regular
+16
-11
@@ -60,7 +60,7 @@ nerfstudio_file_ids = {
|
|||||||
"bunny": grab_file_id("https://drive.google.com/file/d/1oVytSgd1gQclF0CybJ6JdXDmaqKOx7Wg/view?usp=sharing"),
|
"bunny": grab_file_id("https://drive.google.com/file/d/1oVytSgd1gQclF0CybJ6JdXDmaqKOx7Wg/view?usp=sharing"),
|
||||||
"bww_entrance": grab_file_id("https://drive.google.com/file/d/1ylkRHtfB3n3IRLf2wplpfxzPTq7nES9I/view?usp=sharing"),
|
"bww_entrance": grab_file_id("https://drive.google.com/file/d/1ylkRHtfB3n3IRLf2wplpfxzPTq7nES9I/view?usp=sharing"),
|
||||||
"bww_tree": grab_file_id("https://drive.google.com/file/d/1N_OQejT0MblK1UP05KORxy25SXjKqZN1/view?usp=sharing"),
|
"bww_tree": grab_file_id("https://drive.google.com/file/d/1N_OQejT0MblK1UP05KORxy25SXjKqZN1/view?usp=sharing"),
|
||||||
"campanelle": grab_file_id("https://drive.google.com/file/d/13aOfGJRRH05pOOk9ikYGTwqFc2L1xskU/view?usp=sharing"),
|
"campanile": grab_file_id("https://drive.google.com/file/d/13aOfGJRRH05pOOk9ikYGTwqFc2L1xskU/view?usp=sharing"),
|
||||||
"desolation": grab_file_id("https://drive.google.com/file/d/14IzOOQm9KBJ3kPbunQbUTHPnXnmZus-f/view?usp=sharing"),
|
"desolation": grab_file_id("https://drive.google.com/file/d/14IzOOQm9KBJ3kPbunQbUTHPnXnmZus-f/view?usp=sharing"),
|
||||||
"dozer": grab_file_id("https://drive.google.com/file/d/1-OR5F_V5S4s-yzxohbwTylaXjzYLu8ZR/view?usp=sharing"),
|
"dozer": grab_file_id("https://drive.google.com/file/d/1-OR5F_V5S4s-yzxohbwTylaXjzYLu8ZR/view?usp=sharing"),
|
||||||
"japanese_maple": grab_file_id(
|
"japanese_maple": grab_file_id(
|
||||||
@@ -75,6 +75,8 @@ nerfstudio_file_ids = {
|
|||||||
"vegetation": grab_file_id("https://drive.google.com/file/d/1wBhLQ2odycrtU39y2akVurXEAt9SsVI3/view?usp=sharing"),
|
"vegetation": grab_file_id("https://drive.google.com/file/d/1wBhLQ2odycrtU39y2akVurXEAt9SsVI3/view?usp=sharing"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DatasetName = dcargs.extras.literal_type_from_choices(nerfstudio_file_ids.keys())
|
||||||
|
|
||||||
|
|
||||||
def download_nerfstudio(save_dir: Path, capture_name: str):
|
def download_nerfstudio(save_dir: Path, capture_name: str):
|
||||||
"""Download specific captures from the nerfstudio dataset."""
|
"""Download specific captures from the nerfstudio dataset."""
|
||||||
@@ -100,33 +102,33 @@ def download_nerfstudio(save_dir: Path, capture_name: str):
|
|||||||
|
|
||||||
def main(
|
def main(
|
||||||
dataset: Literal["blender", "friends", "nerfstudio"],
|
dataset: Literal["blender", "friends", "nerfstudio"],
|
||||||
capture_name: Optional[str] = None,
|
capture_name: Optional[DatasetName] = None, # type: ignore
|
||||||
save_dir: Path = Path("data/"),
|
save_dir: Path = Path("data/"),
|
||||||
):
|
):
|
||||||
"""Main download script to download all data.
|
"""Main download script to download all data.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
dataset: The dataset to download (from).
|
dataset: The dataset to download (from).
|
||||||
capture_name: The capture name to download (from the dataset).
|
capture_name: The capture name to download (if downloading from nerfstudio dataset).
|
||||||
save_dir: The directory to save the data to.
|
save_dir: The directory to save the data to.
|
||||||
"""
|
"""
|
||||||
save_dir.mkdir(parents=True, exist_ok=True)
|
save_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
if dataset == "blender":
|
if dataset == "blender":
|
||||||
|
if capture_name is not None:
|
||||||
|
console.print("Capture name is ignored when downloading from the blender dataset.")
|
||||||
download_blender(save_dir)
|
download_blender(save_dir)
|
||||||
if dataset == "friends":
|
if dataset == "friends":
|
||||||
|
if capture_name is not None:
|
||||||
|
console.print("Capture name is ignored when downloading from the blender dataset.")
|
||||||
download_friends(save_dir)
|
download_friends(save_dir)
|
||||||
if dataset == "nerfstudio":
|
if dataset == "nerfstudio":
|
||||||
if capture_name is None:
|
if capture_name is None:
|
||||||
capture_names = sorted(nerfstudio_file_ids.keys())
|
capture_names = sorted(nerfstudio_file_ids.keys())
|
||||||
console.print(
|
console.rule("[bold red]Error", style="bold red")
|
||||||
"[bold yellow]You must pass in --capture-name when downloading from the nerfstudio dataset."
|
console.print("[bold yellow]You must pass in --capture-name when downloading from the nerfstudio dataset.")
|
||||||
f" Use one of the following: \n\t {capture_names}"
|
console.print("Use one of the following:")
|
||||||
)
|
console.print(f"\t {capture_names}")
|
||||||
sys.exit()
|
|
||||||
if capture_name not in nerfstudio_file_ids:
|
|
||||||
capture_names = sorted(nerfstudio_file_ids.keys())
|
|
||||||
console.print(f"[bold yellow]Invalid --capture-name choice. Use one of the following: \n {capture_names}")
|
|
||||||
sys.exit()
|
sys.exit()
|
||||||
download_nerfstudio(save_dir, capture_name)
|
download_nerfstudio(save_dir, capture_name)
|
||||||
|
|
||||||
@@ -139,3 +141,6 @@ def entrypoint():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
entrypoint()
|
entrypoint()
|
||||||
|
|
||||||
|
# For sphinx docs
|
||||||
|
get_parser_fn = lambda: dcargs.extras.get_parser(main) # noqa
|
||||||
Reference in new issue
Block a user