uoip / monoVO-python

A simple monocular visual odometry project in Python
346 stars 99 forks source link

List index out of range #4

Open yzhan407 opened 6 years ago

yzhan407 commented 6 years ago

I just downloaded the code to my laptop(windows 10),using the KITTY datasets. I did not change anything except the path to my dataset, and here is the error I got after running the code

Traceback (most recent call last): File "test.py", line 17, in vo.update(img, img_id) File "D:\monoVO-python-master\visual_odometry.py", line 94, in update self.processFrame(frame_id) File "D:\monoVO-python-master\visual_odometry.py", line 81, in processFrame absolute_scale = self.getAbsoluteScale(frame_id) File "D:\monoVO-python-master\visual_odometry.py", line 55, in getAbsoluteScale x_prev = float(ss[3]) IndexError: list index out of range

biggzlar commented 5 years ago

I just downloaded the code to my laptop(windows 10),using the KITTY datasets. I did not change anything except the path to my dataset, and here is the error I got after running the code

Traceback (most recent call last): File "test.py", line 17, in vo.update(img, img_id) File "D:\monoVO-python-master\visual_odometry.py", line 94, in update self.processFrame(frame_id) File "D:\monoVO-python-master\visual_odometry.py", line 81, in processFrame absolute_scale = self.getAbsoluteScale(frame_id) File "D:\monoVO-python-master\visual_odometry.py", line 55, in getAbsoluteScale x_prev = float(ss[3]) IndexError: list index out of range

What did you use as your annotations? times.txt?

jmgphd commented 5 years ago

I am trying to get this code working and have run into the same issue. I am confused as to which text file should be supplied as an argument to the VisualOdometry class. It seems as though it should be the calibration file, because that is the only file that has 12 strings on a line. However, line 54 of the visual_odometry.py file expects there to be a line for every frame. I have downloaded the KITTI dataset and the there seems to be only four components (left image set, right image set, times.txt, and calib.txt) for each scene. Am I missing something in order to get this running? Any clarification would be greatly appreciated. Thanks!

biggzlar commented 5 years ago

Hi @jmgrant2 - I did find out which file it is. You can get it here: http://www.cvlibs.net/download.php?file=data_odometry_poses.zip

It's the actual ground truths for the poses. They are only used to compute relative movement, but still, it's a bit disappointing that they are required. I'm using this implementation for a game with fixed speed, so luckily I don't have to rely on these. If you want to use it for something else, there's gonna be some extra work needed. :)

yzhan407 commented 5 years ago

Sorry for the late reply. I think the authors did not maintain this any longer. As far as I could remember, as @biggzlar mentioned, these code rely on ground truth to run, that is something you need to download separately (not only for drawing ground truth in result, but also for getting the real scale for the predictions you made ) and the reason for index out of range is that the way they deal with ground truth is a little bit out of date, the format of ground truth file have changed. I remember I used another library called pykitti to deal with data loading and rewrote that part. If there is no ground truth, I think there will be some extra work needed to represent their results like telling the program what is the "real world length" between two frames. I did my project on this 9 months ago, so there may be something not exactly correct and you are welcome to point it out.

jmgphd commented 5 years ago

Thanks so much @biggzlar and @dontbeafraidimnotagoodman. I did get it running with the files that @biggzlar recommended. I'm just a bit confused because I thought the relative movement was computed from the essential matrix. I'm trying to get this to run on a different set of data and can't exactly understand what is happening anymore. But I'll keep digging. Thanks so much for your help.

biggzlar commented 5 years ago

@jmgrant2 Sure thing. They seem to rely on the possibility, that in real-world applications, you could probably use a speedometer or something like that to get a scaling factor for your estimates. I was hoping for a better solution as well, so in case you find anything, please let me know. :)

Vslamer commented 4 years ago

I have the same problem. How do you solve it finally? Traceback (most recent call last): File "test.py", line 15, in <module> vo.update(img, img_id) File "/home/cy/myslam/monoVO-python/visual_odometry.py", line 94, in update self.processFrame(frame_id) File "/home/cy/myslam/monoVO-python/visual_odometry.py", line 81, in processFrame absolute_scale = self.getAbsoluteScale(frame_id) File "/home/cy/myslam/monoVO-python/visual_odometry.py", line 58, in getAbsoluteScale ss = self.annotations[frame_id].strip().split() IndexError: list index out of range