pynerf icon indicating copy to clipboard operation
pynerf copied to clipboard

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

Open wanger-666 opened this issue 1 year ago • 6 comments

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

wanger-666 avatar Jan 15 '24 03:01 wanger-666

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.

hturki avatar Jan 15 '24 15:01 hturki

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.

wanger-666 avatar Jan 16 '24 02:01 wanger-666

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 avatar Jan 17 '24 19:01 hturki

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?

hturki avatar Jan 17 '24 19:01 hturki

+++ 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!

fabfabsto avatar Jan 24 '24 09:01 fabfabsto

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

JamesAscroft avatar Mar 18 '24 10:03 JamesAscroft