tum-vision / lsd_slam

LSD-SLAM
GNU General Public License v3.0
2.6k stars 1.23k forks source link

is the huber norm calculation right? #120

Closed RemcoTukker closed 9 years ago

RemcoTukker commented 9 years ago

While comparing the code and your paper, I was wondering whether the huber loss function is actually implemented correctly in your code: (from SE3tracker.cpp line 779)

float weighted_rp = fabs(rp*sqrtf(w_p));
float wh = fabs(weighted_rp < (settings.huber_d/2) ? 1 : (settings.huber_d/2) / weighted_rp);
sumRes += wh * w_p * rp*rp;

The - delta / 2 from the huber loss (in the case of weighted_rp > delta) seems to be forgotten here, or am I missing something? Note that this piece of code seems to be used as template for the optimized versions as well, so if this is an error then the optimized versions are wrong as well.

RemcoTukker commented 9 years ago

Yes, I was missing something ;-) Implementation is not exactly the huber loss function but close enough, only a discontinuity in the derivative.