mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-11 02:24:38 +08:00
* inerted a new model configuration instant-ngp-bounded * added more remarks and small fixes * went back to old near plane * added the oprtion to get a file as well as directory in nerfstudio data parser * pretify prev commit * review fixes * more clear explanation in README.md * reverted readme changes * fixed merge bug * review changes. update config.data docs support for json files inputs Co-authored-by: dror <you@example.com>
65 lines
2.1 KiB
Python
65 lines
2.1 KiB
Python
# pylint: disable=protected-access
|
|
"""
|
|
Default test to make sure train runs
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from nerfstudio.configs.experiment_config import ExperimentConfig
|
|
from nerfstudio.configs.method_configs import method_configs
|
|
from nerfstudio.data.dataparsers.blender_dataparser import BlenderDataParserConfig
|
|
from scripts.train import train_loop
|
|
|
|
BLACKLIST = ["base", "semantic-nerfw", "instant-ngp", "instant-ngp-bounded", "nerfacto", "phototourism"]
|
|
|
|
|
|
def set_reduced_config(config: ExperimentConfig):
|
|
"""Reducing the config settings to speedup test"""
|
|
config.machine.num_gpus = 0
|
|
config.trainer.max_num_iterations = 2
|
|
# reduce dataset factors; set dataset to test
|
|
config.pipeline.datamanager.dataparser = BlenderDataParserConfig(data=Path("tests/data/lego_test"))
|
|
config.pipeline.datamanager.train_num_images_to_sample_from = 1
|
|
config.pipeline.datamanager.train_num_rays_per_batch = 4
|
|
|
|
# use tensorboard logging instead of wandb
|
|
config.vis = "tensorboard"
|
|
config.logging.relative_log_dir = Path("/tmp/")
|
|
|
|
# reduce model factors
|
|
if hasattr(config.pipeline.model, "num_coarse_samples"):
|
|
config.pipeline.model.num_coarse_samples = 4
|
|
if hasattr(config.pipeline.model, "num_importance_samples"):
|
|
config.pipeline.model.num_importance_samples = 4
|
|
# remove viewer
|
|
config.viewer.enable = False
|
|
|
|
# model specific config settings
|
|
if config.method_name == "instant-ngp":
|
|
config.pipeline.model.field_implementation = "torch"
|
|
|
|
return config
|
|
|
|
|
|
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
|
|
def test_train():
|
|
"""test run train script works properly"""
|
|
all_config_names = method_configs.keys()
|
|
for config_name in all_config_names:
|
|
if config_name in BLACKLIST:
|
|
print("skipping", config_name)
|
|
continue
|
|
print(f"testing run for: {config_name}")
|
|
config = method_configs[config_name]
|
|
config = set_reduced_config(config)
|
|
|
|
train_loop(local_rank=0, world_size=0, config=config)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_train()
|