Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ns-train pynerf --vis viewer+wandb colmap --data data/xxx #6

Open
wanger-666 opened this issue Jan 15, 2024 · 6 comments
Open

ns-train pynerf --vis viewer+wandb colmap --data data/xxx #6

wanger-666 opened this issue Jan 15, 2024 · 6 comments

Comments

@wanger-666
Copy link

Traceback (most recent call last):
File "F:\miniconda3\envs\nerfstudio-gs\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "F:\miniconda3\envs\nerfstudio-gs\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "F:\miniconda3\envs\nerfstudio-gs\Scripts\ns-train.exe_main
.py", line 7, in
File "D:\nerfstudio-gs\nerfstudio\nerfstudio\scripts\train.py", line 262, in entrypoint
main(
File "D:\nerfstudio-gs\nerfstudio\nerfstudio\scripts\train.py", line 247, in main
launch(
File "D:\nerfstudio-gs\nerfstudio\nerfstudio\scripts\train.py", line 189, in launch
main_func(local_rank=0, world_size=world_size, config=config)
File "D:\nerfstudio-gs\nerfstudio\nerfstudio\scripts\train.py", line 99, in train_loop
trainer.setup()
File "D:\nerfstudio-gs\nerfstudio\nerfstudio\engine\trainer.py", line 147, in setup
self.pipeline = self.config.pipeline.setup(
File "D:\nerfstudio-gs\nerfstudio\nerfstudio\configs\base_config.py", line 54, in setup
return self._target(self, **kwargs)
File "D:\nerfstudio-gs\nerfstudio\nerfstudio\pipelines\base_pipeline.py", line 258, in init
self.datamanager: DataManager = config.datamanager.setup(
File "D:\nerfstudio-gs\nerfstudio\nerfstudio\configs\base_config.py", line 54, in setup
return self._target(self, **kwargs)
File "D:\nerfstudio-gs\nerfstudio\pynerf\pynerf\data\datamanagers\random_subset_datamanager.py", line 96, in init
self.train_ray_generator = RayGenerator(self.train_dataparser_outputs.cameras.to(self.device),
TypeError: init() takes 2 positional arguments but 3 were given

@hturki
Copy link
Owner

hturki commented Jan 15, 2024

What version of nerfstudio are you using? The current code in this repo should work for v3.4.0, but I think there were recent changes on nerfstudio's main branch that changed the data API a bit.

@wanger-666
Copy link
Author

My version is when "Add PyNeRF external method #2734" was merged on January 10, 2024.The version number v3.4.0 hasn't changed in a long time.

@hturki
Copy link
Owner

hturki commented Jan 17, 2024

Understood and agreed that it's not ideal, it's just that the data API has since changed and I'm hesitant to change the main branch of this repo until another tagged release comes out. If you want to use nerfstudio main, you can try modifying the constructors accordingly (ie: remove the camera optimizer arg):

+++ b/pynerf/data/datamanagers/random_subset_datamanager.py
@@ -93,8 +93,7 @@ class RandomSubsetDataManager(DataManager):

         self.train_camera_optimizer = self.config.camera_optimizer.setup(
             num_cameras=self.train_dataparser_outputs.cameras.size, device=self.device)
-        self.train_ray_generator = RayGenerator(self.train_dataparser_outputs.cameras.to(self.device),
-                                                self.train_camera_optimizer)
+        self.train_ray_generator = RayGenerator(self.train_dataparser_outputs.cameras.to(self.device))

         fields_to_load = {RGB}
         for additional_field in {DEPTH, WEIGHT, TRAIN_INDEX}:
@@ -117,8 +116,7 @@ class RandomSubsetDataManager(DataManager):
         self.eval_dataset = InputDataset(self.eval_dataparser_outputs)
         self.eval_camera_optimizer = self.config.camera_optimizer.setup(
             num_cameras=self.eval_dataparser_outputs.cameras.size, device=self.device)
-        self.eval_ray_generator = RayGenerator(self.eval_dataparser_outputs.cameras.to(self.device),
-                                               self.eval_camera_optimizer)
+        self.eval_ray_generator = RayGenerator(self.eval_dataparser_outputs.cameras.to(self.device))

         self.eval_image_metadata = self._get_image_metadata(self.eval_dataparser_outputs)
         self.eval_batch_dataset = RandomSubsetDataset(

@hturki
Copy link
Owner

hturki commented Jan 17, 2024

if that works for you, I could maybe wrap the constructors with a try-catch to test out both constructors (and handle both versions) in the interim?

@fabfabsto
Copy link

fabfabsto commented Jan 24, 2024

+++ b/pynerf/data/datamanagers/random_subset_datamanager.py
@@ -93,8 +93,7 @@ class RandomSubsetDataManager(DataManager):

         self.train_camera_optimizer = self.config.camera_optimizer.setup(
             num_cameras=self.train_dataparser_outputs.cameras.size, device=self.device)
-        self.train_ray_generator = RayGenerator(self.train_dataparser_outputs.cameras.to(self.device),
-                                                self.train_camera_optimizer)
+        self.train_ray_generator = RayGenerator(self.train_dataparser_outputs.cameras.to(self.device))

         fields_to_load = {RGB}
         for additional_field in {DEPTH, WEIGHT, TRAIN_INDEX}:
@@ -117,8 +116,7 @@ class RandomSubsetDataManager(DataManager):
         self.eval_dataset = InputDataset(self.eval_dataparser_outputs)
         self.eval_camera_optimizer = self.config.camera_optimizer.setup(
             num_cameras=self.eval_dataparser_outputs.cameras.size, device=self.device)
-        self.eval_ray_generator = RayGenerator(self.eval_dataparser_outputs.cameras.to(self.device),
-                                               self.eval_camera_optimizer)
+        self.eval_ray_generator = RayGenerator(self.eval_dataparser_outputs.cameras.to(self.device))

         self.eval_image_metadata = self._get_image_metadata(self.eval_dataparser_outputs)
         self.eval_batch_dataset = RandomSubsetDataset(

This works for me! I'm running nerfstudio 1.0.0. Many thanks!

@JamesAscroft
Copy link

How exactly do I go about implimenting this change in code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants