cvg / nice-slam

[CVPR'22] NICE-SLAM: Neural Implicit Scalable Encoding for SLAM

Home Page:https://pengsongyou.github.io/nice-slam

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CUDA Error when running

0010SS opened this issue · comments

Thanks for your wonderful work! However, when I run the command python -W ignore run.py configs/ScanNet/scene0000.yaml in Google Colab, the CUDA alerts me that:

Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/NICE_SLAM.py", line 276, in mapping
    self.mapper.run()
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/Mapper.py", line 605, in run
    _ = self.optimize_map(num_joint_iters, lr_factor, idx, gt_color, gt_depth,
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/Mapper.py", line 457, in optimize_map
    batch_rays_o, batch_rays_d, batch_gt_depth, batch_gt_color = get_samples(
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/common.py", line 131, in get_samples
    i, j, sample_depth, sample_color = get_sample_uv(
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/common.py", line 121, in get_sample_uv
    i, j, depth, color = select_uv(i, j, n, depth, color, device=device)
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/common.py", line 105, in select_uv
    depth = depth[indices]  # (n)
RuntimeError: CUDA error: device-side assert triggered
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/NICE_SLAM.py", line 286, in coarse_mapping
    self.coarse_mapper.run()
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/Mapper.py", line 605, in run
    _ = self.optimize_map(num_joint_iters, lr_factor, idx, gt_color, gt_depth,
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/Mapper.py", line 457, in optimize_map
    batch_rays_o, batch_rays_d, batch_gt_depth, batch_gt_color = get_samples(
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/common.py", line 131, in get_samples
    i, j, sample_depth, sample_color = get_sample_uv(
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/common.py", line 121, in get_sample_uv
    i, j, depth, color = select_uv(i, j, n, depth, color, device=device)
  File "/content/drive/MyDrive/TOMCAT/nice-slam/src/common.py", line 105, in select_uv
    depth = depth[indices]  # (n)

It seems that the the indices used to query the depth map exceed its boundaries:

def select_uv(i, j, n, depth, color, device='cuda:0'):
    """
    Select n uv from dense uv.

    """
    i = i.reshape(-1)
    j = j.reshape(-1)
    indices = torch.randint(i.shape[0], (n,), device=device)
    indices = indices.clamp(0, i.shape[0])
    i = i[indices]  # (n)
    j = j[indices]  # (n)
    depth = depth.reshape(-1)
    color = color.reshape(-1, 3)
    depth = depth[indices]  # (n)
    color = color[indices]  # (n,3)
    return i, j, depth, color

I download the data directly from ScanNet, and put the data into the structure as recommended. I use Scene_0000 as you've already provided the config file for it. How can I solve this problem? Thanks!

It is a bit strange and should work directly. Maybe you can double-check the depth image resolution and the value range of the i, j.