htkseason / VOLDOR

VOLDOR-SLAM is a real-time dense-indirect SLAM system takes dense optical flows as input that supports monocular, stereo and RGB-D video sequence.
472 stars 56 forks source link

GPU gives NaN in meanshift #32

Closed nkegke closed 2 months ago

nkegke commented 2 months ago

Hello, thank you for publishing this remarkable work!

For me tracking seems to fail here,

if (checkRange(pose_opm)) { //check if gpu gives nan...
    // copy back pose
    Rodrigues(pose_opm.at<Vec3f>(0), cams[active_idx].R);
    cams[active_idx].t.at<Vec3f>(0) = pose_opm.at<Vec3f>(1);
    return 1;
}
else
    return 0;

where pose_opm has become NaN after calling meanshift_gpu in this line,

meanshift_gpu((float*)poses_pool.data, cfg.meanshift_kernel_var,
    (float*)pose_opm.data, &cams[active_idx].pose_density, &cams[active_idx].last_used_ms_iters, successive_pose,
    poses_pool_used, 6, cfg.meanshift_epsilon, cfg.meanshift_max_iters, cfg.meanshift_max_init_trials, cfg.meanshift_good_init_confidence);

I suppose you have encountered this problem, by looking at the comment you have written in the code. Any ideas would be appreciated. Thanks in advance.

nkegke commented 2 months ago

It seems that meanshift_kernel_var was parsed as 0 by mistake, resulting in division by zero.