nerfacc icon indicating copy to clipboard operation
nerfacc copied to clipboard

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

Open worldlyesterday opened this issue 1 year ago • 5 comments

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

worldlyesterday avatar Nov 07 '22 12:11 worldlyesterday

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.

liruilong940607 avatar Nov 07 '22 13:11 liruilong940607

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 avatar Nov 07 '22 13:11 worldlyesterday

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.

worldlyesterday avatar Nov 07 '22 13:11 worldlyesterday

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.

liruilong940607 avatar Nov 07 '22 14:11 liruilong940607

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)

Ballzy0706 avatar Apr 21 '23 08:04 Ballzy0706