vye16 / slahmr

MIT License
452 stars 50 forks source link

run_slam.py error for the video with fixed camera #7

Closed ericwang0701 closed 1 year ago

ericwang0701 commented 1 year ago

Hi,

As I mentioned in another #2 issue, I ran into the following error when I tried to use my own custom video. File "/home/eric-gtxrar/documents/slahmr/third-party/DROID-SLAM/droid_slam/factor_graph.py", line 374, in add_proximity_factors ii, jj = torch.as_tensor(es, device=self.device).unbind(dim=-1) ValueError: not enough values to unpack (expected 2, got 0)

After looking into the code and testing with different videos, I realized that if the camera is fully fixed (e.g. mounted on a tripod) in the video, it will have the above error. But the camera is not fixed, I can successfully generate the result below. Any suggestion to make it work for videos with a fixed camera would be appreciated. Thanks!

image

ericwang0701 commented 1 year ago

I just found a temporary solution to this issue. In the DROID-SLAM, the motion_filter.py filters incoming frames so that there is enough motion. If the camera is fixed, the computed value will be below the current default value of 2.5 and not be added in the later processing. So what I did is lower the threshold value to 0.1 and it works for video with the fixed camera now.

vye16 commented 1 year ago

Hi, thank you for bringing this up, changing the filter_thresh argument in run_slam.py is a great fix. I also updated the script to handle this case in which there is only one keyframe in the SLAM map in commit a75251f