rpg_feature_tracking_analysis icon indicating copy to clipboard operation
rpg_feature_tracking_analysis copied to clipboard

IndexError: index 0 is out of bounds for axis 0 with size 0

Open LarryDong opened this issue 4 years ago • 4 comments

Hi, thanks for this cool tool! But I met the problem:

Traceback (most recent call last): File "evaluate_tracks.py", line 81, in error_data = compareTracks(est_tracks_data, gt_tracks_data) File "/home/larrydong/rpg_feature_tracking_analysis/big_pun/tracker_utils.py", line 100, in compareTracks gt_t, e_x, e_y = getError(est_track, gt_track) File "/home/larrydong/rpg_feature_tracking_analysis/big_pun/tracker_utils.py", line 81, in getError if np.abs(gt_t[0] - est_t[0]) < 1e-5: IndexError: index 0 is out of bounds for axis 0 with size 0

It took me some time to locate this problem: the ground truth are generated by calcOpticalFlowPyrLK from the second frame. However, one of my features tracked by event is dead before the second frame, and all ground truth are deleted after feature died by:

gt_data = gt_data[gt_data[:, 0] <= est_data[-1, 0]]

that leads gt_t to be empty and the index error.

The problem can be solved by manually deleted short features (although the filter_too_short can filer short features but it depends on size not on time). Or this code can be improved by adding the ground truth to tracks_obj from the beginning.

I hope this issue can help who have met the same problem, and help to improve this amazing tool.

(Example attached here is tracked from outdoors_walking.bag, this error happens for feature id 4) tracks_example.txt

LarryDong avatar Jun 22 '20 04:06 LarryDong

Hello, how did you solve this problem? Is it the result of manually adding event tracking on the second frame of the image in the .txt file?

nvdn7 avatar Jul 31 '24 01:07 nvdn7

I've had this problem too, and I'm just starting to get involved in this field, so I don't know if you say the change is what I think?

nvdn7 avatar Jul 31 '24 01:07 nvdn7

‘this code can be improved by adding the ground truth to tracks_obj from the beginning.’ How does this work? Can you see how you changed it?

nvdn7 avatar Jul 31 '24 01:07 nvdn7

‘this code can be improved by adding the ground truth to tracks_obj from the beginning.’ How does this work? Can you see how you changed it?

I forget what I was thinking, which is 4 years ago. However, the easiest way is check your tracking result and delete "extramely short" (only appeared once) feature, make this feature never appear.

For example, in my uploaded file, featue 5 only appears once (on first frame) so this feature lead to the program died. Just delete this line.

That's all I can remember.

LarryDong avatar Jul 31 '24 02:07 LarryDong