shizenglin / Deep-NCL

The codes for CVPR-2018 paper "Crowd Counting with Deep Negative Correlation Learning"
Other
54 stars 21 forks source link

something about MAE #3

Open KevenLee opened 5 years ago

KevenLee commented 5 years ago

Hi, your code calc. MAE loss in file "mae_layer.cpp"

Dtype asum1 = caffe_cpu_asum(count, bottom[0]->cpu_data()); Dtype asum2 = caffe_cpu_asum(count, bottom[1]->cpu_data()); Dtype loss = abs(asum1-asum2);

does it approximate calculation of mae?

I do not think "sum(abs(a[i]-b[i]))" should be equal to "abs(sum(abs(a)) - sum(abs(b)))"

shizenglin commented 5 years ago

Actually, MAE should be abs(sum(a)-sum(b)), in our paper, we use caffe_cpu_asum to compute a abs(sum(abs(a))-sum(abs(b))), and a little different in terms of the equation. However, we use a relu(a) before calculating MAE. Thus, abs(a) is equal to a. Then abs(sum(a)-sum(b)) is equal to abs(sum(abs(a))-sum(abs(b))). I hope it's a good answer to your question. Let me know if you still have questions.

KevenLee commented 5 years ago

Thanks, I got it