Repository navigation
DNN: Optimization: Fuse Deconvolution -> BatchNorm - #13875
Conversation
d40c7b4 to
579b094
Compare
| { | ||
| double wi = w.at<float>(i); | ||
| weightsMultipliers[i] *= wi; | ||
| cv::multiply(originWeights.row(i), weightsMultipliers[i], weightsMat.row(i)); |
There was a problem hiding this comment.
That looks confusing. weightsMat is initialized with as weightsMat = (blobs[0].reshape(1, inpCn)).clone(); (with number of rows equals number of input channels) but in this loop we iterate over rows by number output channels.
|
|
||
| if (!b.empty()) | ||
| { | ||
| for (int i = 0; i < outCn; ++i) { biasesMat.at<float>(i) += b.at<float>(i); } |
There was a problem hiding this comment.
Can we use cv::add or operator += instead?
f0442b3 to
aa3143e
Compare
|
|
||
| void fuseWeights(const Mat& w_, const Mat& b_) CV_OVERRIDE | ||
| { | ||
| const int outCn = weightsMat.size[0] / (blobs[0].size[2] * blobs[0].size[3]); |
| pad.width = pad_l; | ||
| pad.height = pad_t; | ||
|
|
||
| weightsMultipliers.assign(blobs[0].size[0], 1.0); |
There was a problem hiding this comment.
Number of multipliers should be equal number of output channels (numOutput). However blobs[0] is a weights matrix with shape IOHW where I is a number of input channels and O is a number of output channels divided by group number. So it's better to use numOutput instead of raw shapes of weigths blob.
7a5d2a0 to
b8cc741
Compare
033077e to
2e0acac
Compare
| @@ -308,6 +308,12 @@ TEST_P(DNNTestNetwork, FastNeuralStyle_eccv16) | |||
| (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16) || | |||
| (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)) | |||
There was a problem hiding this comment.
please also check if backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16 and backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD configurations pass this test.
ee3e041 to
74574df
Compare
Uh oh!
There was an error while loading. Please reload this page.