ToniRV / NeRF-SLAM

NeRF-SLAM: Real-Time Dense Monocular SLAM with Neural Radiance Fields. https://arxiv.org/abs/2210.13641 + Sigma-Fusion: Probabilistic Volumetric Fusion for Dense Monocular SLAM https://arxiv.org/abs/2210.01276
BSD 2-Clause "Simplified" License
1.17k stars 141 forks source link

type object 'gtsam.gtsam.Pose3' has no attribute 'identity' #21

Open szgy66 opened 1 year ago

szgy66 commented 1 year ago

First of all, thank you for publicizing your project. When I run the command: python. / examples/slam_demo py -- dataset_dir =. / datasets/up/office0 - dataset_name = nerf - buffer = 100 - slam --parallel_run --img_stride=2 --fusion='nerf' --multi_gpu --gui

The following error will occur:

Running with GPUs: 0,1 Running pipeline in parallel mode. I0105 19:11:41.273782 58239 pipeline_module.py:85] Module: VioSLAM - Spinning. Traceback (most recent call last): File "./examples/slam_demo.py", line 200, in run(args) File "./examples/slam_demo.py", line 143, in run slam_module.spin() # visualizer should be the main spin, but pytorch has a memory bug/leak if threaded... File "/workspace/NeRF-SLAM/./examples/../pipeline/pipeline_module.py", line 88, in spin self.initialize_module() File "/workspace/NeRF-SLAM/./examples/../slam/slam_module.py", line 19, in initialize_module self.slam = VioSLAM(self.name, self.args, self.device) File "/workspace/NeRF-SLAM/./examples/../slam/vio_slam.py", line 81, in init world_T_imut0, , _ = initial_state() File "/workspace/NeRF-SLAM/./examples/../slam/vio_slam.py", line 65, in initial_state naive_pose = gtsam.Pose3.identity() AttributeError: type object 'gtsam.gtsam.Pose3' has no attribute 'identity'

I'm running your project on a server without a visual interface, so I guess it doesn't matter. Can you help me with this problem? Thanks!

bkhanal-11 commented 1 year ago

You can use this fork to recompile NeRF-SLAM. It fixes issues with new version of GTSAM. I did the same and worked for me.

szgy66 commented 1 year ago

You can use this fork to recompile NeRF-SLAM. It fixes issues with new version of GTSAM. I did the same and worked for me.

Hello, when I recompile the relevant file with your fork. appear this error: CMakeFiles/Makefile2:32332: recipe for target 'python/CMakeFiles/gtsam_py.dir/all' failed make[1]: [python/CMakeFiles/gtsam_py.dir/all] Error 2 Makefile:165: recipe for target 'all' failed make: [all] Error 2

The same error occurred when I compiled the previous version. pass order: "ti go it clone https://github.com/ToniRV/gtsam-1.git" solve it.

Now I find that your fork is an improvement on the original version, mainly cuda version and gtsam. But there are still problems. How can I solve it? If it is resolved in the same way, I think there will still be problems raised by this issue.

bkhanal-11 commented 1 year ago

I check my version of gtsam and the commit of branch used is f427b0411. So, could you do git checkout f427b0411 for gtsam? I am also testing the code myself so do not know much. Hope this solves your issue.

bkhanal-11 commented 1 year ago

Try this.

HaotianLi816 commented 1 year ago

I met the same problem with you. Has this problem been solved? Thx.

HaotianLi816 commented 1 year ago

Try this.

I used your gtsam version and recompiled, but still got the same error.

bkhanal-11 commented 1 year ago

@543630836 If you are getting type object 'gtsam.gtsam.Pose3' has no attribute 'identity' error, then the problem is with NeRF-SLAM not GTSAM.

Try cloning this and follow the install instruction here.

HaotianLi816 commented 1 year ago

@543630836 If you are getting type object 'gtsam.gtsam.Pose3' has no attribute 'identity' error, then the problem is with NeRF-SLAM not GTSAM.

Try cloning this and follow the install instruction here.

Thanks for your reply. However, when I run "cmake --build build_ngp --config RelWithDebInfo -j" The following error will occur: collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/testbed.dir/build.make:118: testbed] Error 1 make[1]: [CMakeFiles/Makefile2:204: CMakeFiles/testbed.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [100%] Linking CXX shared library pyngp.cpython-37m-x86_64-linux-gnu.so [100%] Built target pyngp make: [Makefile:91: all] Error 2

szgy66 commented 1 year ago

@543630836 If you are getting type object 'gtsam.gtsam.Pose3' has no attribute 'identity' error, then the problem is with NeRF-SLAM not GTSAM.

Try cloning this and follow the install instruction here.

Thank you for your advice, I have compiled successfully, there are no gtsam related errors. But when I run demo's command: "./examples/slam_demo.py --dataset_dir=./Datasets/Replica/office0 --dataset_name=nerf --buffer=100 --slam --parallel_run --img_stride=2 --fusion='nerf' --multi_gpu --gui", It has the following error:

Traceback (most recent call last): File "/opt/conda/envs/NeRF_SLAM/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/opt/conda/envs/NeRF_SLAM/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/workspace/NeRF_SLAM/./examples/../pipeline/pipeline_module.py", line 88, in spin self.initialize_module() File "/workspace/NeRF_SLAM/./examples/../datasets/data_module.py", line 37, in initialize_module self.dataset = NeRFDataset(self.args, self.device) File "/workspace/NeRF_SLAM/./examples/../datasets/nerf_dataset.py", line 18, in init self.parse_metadata() File "/workspace/NeRF_SLAM/./examples/../datasets/nerf_dataset.py", line 39, in parse_metadata with open(os.path.join(self.dataset_dir, "transforms.json"), 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: './Datasets/Replica/office0/transforms.json'

I downloaded the related data set from README.md, but I did not find the related transforms.json file. Do you have any suggestions. Thanks a lot.

liangyongshi commented 1 year ago

I tried all the methods mentioned above, but the same problem

szgy66 commented 1 year ago

I tried all the methods mentioned above, but the same problem you can try this :https://github.com/ToniRV/NeRF-SLAM/issues/21#issuecomment-1373536626. It does work for me.

bkhanal-11 commented 1 year ago

@543630836 Make sure you have extracted the dataset in correct folder. The dataset might be extracted to ./datasets rather than ./Datasets.

Try:

./examples/slam_demo.py --dataset_dir=./datasets/Replica/office0 --dataset_name=nerf --buffer=100 --slam --parallel_run --img_stride=2 --fusion='nerf' --multi_gpu --gui
szgy66 commented 1 year ago

@543630836 Make sure you have extracted the dataset in correct folder. The dataset might be extracted to ./datasets rather than ./Datasets.

Try:

./examples/slam_demo.py --dataset_dir=./datasets/Replica/office0 --dataset_name=nerf --buffer=100 --slam --parallel_run --img_stride=2 --fusion='nerf' --multi_gpu --gui

Hello! Did you have run the sample without command:" ./examples/slam_demo.py --dataset_dir=./datasets/nerf-cube-diorama-dataset/room --dataset_name=nerf --buffer=100 --img_stride=1 --fusion='nerf" on server which without visual interface?

bkhanal-11 commented 1 year ago

@szgy66 I am using x11 forwarding from server for visualization.

XinyueZ commented 1 year ago

Exactly the same issue.

Any progress on this issue? (dont wanna another fork, sorry guys). It was really frustrating that after a long time install process and finally nothing worked. :-(

XinyueZ commented 1 year ago

@ToniRV can you help us?

szgy66 commented 1 year ago

@ToniRV can you help us?

To be clear, following @bkhanal-11 fork works just fine. I guess your git instruction is :"git clone https://github.com/ToniRV/NeRF-SLAM.git --recurse-submodules". Its wrong. You should use: "git clone https://github.com/jrpowers/NeRF-SLAM.git --recurse-submodules". The rest of the operation can follow this. The git address of the first step must be correct. Hope that can help you.

XinyueZ commented 1 year ago

@ToniRV can you help us?

To be clear, following @bkhanal-11 fork works just fine. I guess your git instruction is :"git clone https://github.com/ToniRV/NeRF-SLAM.git --recurse-submodules". Its wrong. You should use: "git clone https://github.com/jrpowers/NeRF-SLAM.git --recurse-submodules". The rest of the operation can follow this. The git address of the first step must be correct. Hope that can help you.

thanks @szgy66 , just for g++, which version should be changed to? Currently, I am working with <= 11, is that sufficient? Because I got an error while building instant-ngp.

szgy66 commented 1 year ago

@ToniRV can you help us?

To be clear, following @bkhanal-11 fork works just fine. I guess your git instruction is :"git clone https://github.com/ToniRV/NeRF-SLAM.git --recurse-submodules". Its wrong. You should use: "git clone https://github.com/jrpowers/NeRF-SLAM.git --recurse-submodules". The rest of the operation can follow this. The git address of the first step must be correct. Hope that can help you.

thanks @szgy66 , just for g++, which version should be changed to? Currently, I am working with <= 11, is that sufficient? Because I got an error while building instant-ngp.

image

liangyongshi commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   您好,已经收到您的邮件,无法亲自回复,还请见谅。

EOF101110 commented 8 months ago

@ToniRV can you help us?

To be clear, following @bkhanal-11 fork works just fine. I guess your git instruction is :"git clone https://github.com/ToniRV/NeRF-SLAM.git --recurse-submodules". Its wrong. You should use: "git clone https://github.com/jrpowers/NeRF-SLAM.git --recurse-submodules". The rest of the operation can follow this. The git address of the first step must be correct. Hope that can help you.

thanks @szgy66 , just for g++, which version should be changed to? Currently, I am working with <= 11, is that sufficient? Because I got an error while building instant-ngp.

image

I meet a problem:ImportError: /home/mei/anaconda3/envs/nerf-slam2/lib/python3.10/site-packages/torch/lib/../../../../libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/mei/python/NeRF-SLAM/build_ngp/pyngp.cpython-310-x86_64-linux-gnu.so) how can I solve this?

liangyongshi commented 8 months ago

这是来自QQ邮箱的假期自动回复邮件。   您好,已经收到您的邮件,无法亲自回复,还请见谅。

iDonghq commented 5 months ago

@543630836 If you are getting type object 'gtsam.gtsam.Pose3' has no attribute 'identity' error, then the problem is with NeRF-SLAM not GTSAM.

Try cloning this and follow the install instruction here.

Not using NeRF-SLAM, but the error is same

liangyongshi commented 5 months ago

这是来自QQ邮箱的假期自动回复邮件。   您好,已经收到您的邮件,无法亲自回复,还请见谅。

WhoKilledTheNorns commented 2 weeks ago

Solved it. just modifyslam/visual_frontends/visual_frontend.py as below:# def gtsam_pose_to_torch(pose: gtsam.Pose3, device, dtype): def gtsam_pose_to_torch(pose: gtsam.Pose3, device, dtype): t = pose.translation() R_matrix = pose.rotation().matrix() # 3x3 rotating matrix r = R.from_matrix(R_matrix) q = r.as_quat() # transfer to [qx, qy, qz, qw] remember to import like this:from scipy.spatial.transform import Rotation as R