1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #10746 from dkurt:dnn_batch_norm_from_nvidia_caffe

This commit is contained in:
Vadim Pisarevsky
2018-02-01 13:22:09 +00:00
4 changed files with 420 additions and 342 deletions
+2
View File
@@ -672,6 +672,8 @@ message BatchNormParameter {
// Small value to add to the variance estimate so that we don't divide by
// zero.
optional float eps = 3 [default = 1e-5];
// It true, scale and add biases. Source: https://github.com/NVIDIA/caffe/
optional bool scale_bias = 7 [default = false];
}
message BiasParameter {
+4 -2
View File
@@ -32,6 +32,8 @@ public:
hasWeights = params.get<bool>("has_weight", false);
hasBias = params.get<bool>("has_bias", false);
if(params.get<bool>("scale_bias", false))
hasWeights = hasBias = true;
epsilon = params.get<float>("eps", 1E-5);
size_t n = blobs[0].total();
@@ -47,8 +49,8 @@ public:
varMeanScale = 1/varMeanScale;
}
const int weightsBlobIndex = 2;
const int biasBlobIndex = weightsBlobIndex + hasWeights;
const int biasBlobIndex = blobs.size() - 1;
const int weightsBlobIndex = biasBlobIndex - hasBias;
if( hasWeights )
{