Merge pull request #18447 from alalek:fix_17953

pull/18453/head^2
Alexander Alekhin 4 years ago
commit d62d880316
  1. 3
      modules/dnn/src/ocl4dnn/src/ocl4dnn_conv_spatial.cpp
  2. 2
      modules/dnn/src/opencl/conv_layer_spatial.cl
  3. 7
      modules/dnn/test/test_layers.cpp

@ -607,6 +607,7 @@ void OCL4DNNConvSpatial<Dtype>::calculateBenchmark(const UMat &bottom, UMat &ver
{
options_.str(""); options_.clear(); // clear contents and state flags
createBasicKernel(1, 1, 1);
CV_Assert(!kernelQueue.empty()); // basic kernel must be available
kernel_index_ = kernelQueue.size() - 1;
convolve(bottom, verifyTop, weight, bias, numImages, kernelQueue[kernel_index_]);
CV_Assert(phash.find(kernelQueue[kernel_index_]->kernelName) != phash.end());
@ -1713,6 +1714,7 @@ void OCL4DNNConvSpatial<float>::useFirstAvailable(const UMat &bottom,
tunerItems[i]->blockHeight,
tunerItems[i]->blockDepth))
{
CV_Assert(!kernelQueue.empty()); // basic kernel must be available
int kernelIdx = kernelQueue.size() - 1;
kernelConfig* config = kernelQueue[kernelIdx].get();
bool failed = false;
@ -1883,6 +1885,7 @@ void OCL4DNNConvSpatial<float>::setupConvolution(const UMat &bottom,
CV_LOG_INFO(NULL, "fallback to basic kernel");
options_.str(""); options_.clear(); // clear contents and state flags
createBasicKernel(1, 1, 1);
CV_Assert(!kernelQueue.empty()); // basic kernel must be available
kernel_index_ = kernelQueue.size() - 1;
}
this->bestKernelConfig = kernelQueue[kernel_index_];

@ -205,7 +205,7 @@ __kernel void ConvolveBasic(
#if APPLY_BIAS
ACTIVATION_FUNCTION(convolved_image, offset, sum[kern] + bias[biasIndex + kern], biasIndex + kern);
#else
ACTIVATION_FUNCTION(convolved_image, offset, sum[kern], biasIndex + kern);
ACTIVATION_FUNCTION(convolved_image, offset, sum[kern], kernelNum + kern);
#endif
}
}

@ -2223,13 +2223,6 @@ TEST_P(ConvolutionActivationFusion, Accuracy)
if (actType == "Power" && backendId == DNN_BACKEND_OPENCV && (targetId == DNN_TARGET_OPENCL || targetId == DNN_TARGET_OPENCL_FP16))
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL);
// bug: https://github.com/opencv/opencv/issues/17953
if (actType == "ChannelsPReLU" && bias_term == false &&
backendId == DNN_BACKEND_OPENCV && (targetId == DNN_TARGET_OPENCL || targetId == DNN_TARGET_OPENCL_FP16))
{
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL);
}
Net net;
int convId = net.addLayer(convParams.name, convParams.type, convParams);
int activId = net.addLayerToPrev(activationParams.name, activationParams.type, activationParams);

Loading…
Cancel
Save