pjreddie / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
25.87k stars 21.34k forks source link

blas.c normalize_cpu x[index] = (x[index] - mean[f])/(sqrt(variance[f]) + .000001f); #170

Open adeagle opened 7 years ago

adeagle commented 7 years ago

why not? x[index] = (x[index] - mean[f])/(sqrt(variance[f]+ .000001f));

terrance-liang commented 6 years ago

Hey Adeagle, we met the seem issue with this WePCf's transformed weights file when we implement the mobilenet with optimizing option -O0, it doesn't work. (got output NaN). (-Ofast works as it ignore Nan computation) Then we found that it's due to mobilenet weights file exists negative variance(-0.000010), I think it may be a translation mistake form caffe weights to darknet weights. BUT we also found the equation might be a mistake as you said in Darknet framework.

AlexeyAB commented 6 years ago

@liangtailin

Also to solve issue with Nan in Yolo v3 when is used -O0 you should do this fix:

Instead of this condition if(objectness <= thresh) continue;: https://github.com/pjreddie/darknet/blob/61c9d02ec461e30d55762ec7669d6a1d3c356fb2/src/yolo_layer.c#L328-L339

Should be this condition if (objectness > thresh) {: https://github.com/AlexeyAB/darknet/blob/2c5e383c04655fe45f3f533eb3a69a80acbf3561/src/yolo_layer.c#L378-L389


Because there is used condition if(l.output[obj_index] > thresh) https://github.com/pjreddie/darknet/blob/61c9d02ec461e30d55762ec7669d6a1d3c356fb2/src/yolo_layer.c#L275-L288

If objectness = l.output[obj_index] = nan then we should use the same condition in both cases, otherwise will be allocated memory in the yolo_num_detections() less than will be used (iterated) in the get_yolo_detections()