nerfstudio-project / nerfacc

A General NeRF Acceleration Toolbox in PyTorch.
https://www.nerfacc.com/
Other
1.38k stars 112 forks source link

Failed to read the internal and external parameters of the unbounded scene camera #104

Open worldlyesterday opened 1 year ago

worldlyesterday commented 1 year ago

Warning: image_path not found for reconstruction Traceback (most recent call last): File "examples/train_ngp_nerf.py", line 102, in train_dataset = SubjectLoader( File "D:\ks2\nerfacc\examples\datasets\nerf_360_v2.py", line 186, in init self.images, self.camtoworlds, self.K = _load_colmap( File "D:\ks2\nerfacc\examples\datasets\nerf_360_v2.py", line 32, in _load_colmap manager.load_cameras() File "D:\ks2\nerfacc\examples\datasets..\pycolmap\pycolmap\scene_manager.py", line 90, in load_cameras self._load_cameras_bin(input_file) File "D:\ks2\nerfacc\examples\datasets..\pycolmap\pycolmap\scene_manager.py", line 102, in _load_cameras_bin num_cameras = struct.unpack('L', f.read(8))[0] struct.error: unpack requires a buffer of 4 bytes QQ截图20221107203924

liruilong940607 commented 1 year ago

Hi this is the issue of loading nerf 360 dataset with the 3rd-party library pycolmap. Maybe the data is corrupted? I'm not sure what I can help you with in this case.

worldlyesterday commented 1 year ago

Hi this is the issue of loading nerf 360 dataset with the 3rd-party library pycolmap. Maybe the data is corrupted? I'm not sure what I can help you with in this case.

Sorry, I checked the code, and the result is that the dataset is missing the project.ini file

worldlyesterday commented 1 year ago

I came from https://jonbarron.info/mipnerf360/ Downloaded 360_ V2 dataset, but the file does not contain project.ini,Please check the integrity of the dataset.

liruilong940607 commented 1 year ago

I'm not sure if the project.ini file is really needed. I don't have this file neither but I can run the code without problems.

Ballzy0706 commented 1 year ago

change the char 'L' and 'IiLL' to 'Q' and 'IiQQ', It can be solved. The modified code in scene_manager.py:

def _load_cameras_bin(self, input_file): self.cameras = OrderedDict()

  with open(input_file, 'rb') as f:
      num_cameras = struct.unpack('Q', f.read(8))[0]

      for _ in range(num_cameras):
          camera_id, camera_type, w, h = struct.unpack('IiQQ', f.read(24))
          num_params = Camera.GetNumParams(camera_type)
          params = struct.unpack('d' * num_params, f.read(8 * num_params))
          self.cameras[camera_id] = Camera(camera_type, w, h, params)
          self.last_camera_id = max(self.last_camera_id, camera_id)