GradientSpaces / LoopSplat

LoopSplat: Loop Closure by Registering 3D Gaussian Splats
https://loopsplat.github.io/
MIT License
183 stars 9 forks source link

Question About self.loop_closer.loop_closure #5

Closed Tokyo-dream closed 1 week ago

Tokyo-dream commented 1 week ago

Traceback (most recent call last): File "/home/private/wangpengyu/LoopSplat/run_slam.py", line 109, in gslam.run() File "/home/private/wangpengyu/LoopSplat/src/entities/gaussian_slam.py", line 238, in run lc_output = self.loop_closer.loop_closure(self.estimated_c2ws) File "/home/private/wangpengyu/LoopSplat/src/entities/lc.py", line 282, in loop_closure pose_graph, odometry_edges, loop_edges = self.construct_pose_graph(final) File "/home/private/wangpengyu/LoopSplat/src/entities/lc.py", line 237, in construct_pose_graph reg_dict = self.pairwise_registration(submap_list[source_id], submap_list[target_id], "gs_reg") File "/home/private/wangpengyu/LoopSplat/src/entities/lc.py", line 529, in pairwise_registration res = gs_reg(submap_source, submap_target, self.config['lc']['registration']) File "/home/private/wangpengyu/LoopSplat/src/gsr/solver.py", line 113, in gaussian_registration init_overlap = compute_overlap_gaussians(src_dict['gaussians'], tgt_dict['gaussians'], 0.1) File "/home/private/wangpengyu/LoopSplat/src/gsr/overlap.py", line 53, in compute_overlap_gaussians gpu_index.add(tgt_tensor) File "/root/miniconda3/envs/loop_splat/lib/python3.10/site-packages/faiss/contrib/torch_utils.py", line 122, in torch_replacement_add assert hasattr(self, 'getDevice'), 'GPU tensor on CPU index not allowed' AssertionError: GPU tensor on CPU index not allowed

Tokyo-dream commented 1 week ago

Thanks for this excellent work. When I run all the scenes, errors are reported. May I ask why this is?

Zhu-Liyuan commented 1 week ago

Thank you for reporting the bug. It seems to be something wrong with faiss. I could not reproduce the bug on my local machine. Can you try gpu_index.add(tgt_tensor.cuda()) to replace this line? You can move all the tensors to GPU before adding them to gpu index.

yaorz97 commented 6 days ago

I have also experienced this issue on a single RTX 3090. It is finally addressed by replacing gpu_index = faiss.index_cpu_to_all_gpus(cpu_index) with gpu_index = faiss.index_cpu_to_gpu(faiss.StandardGpuResources(), 0, cpu_index). You can try it on your machine.

Zhu-Liyuan commented 6 days ago

@yaorz97 thank you for keeping updated! Did you manage to reproduce the results mentioned in issue3? If so, I can update the codebase with your solution. Thanks!