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

dnn(ocl4dnn): don't use getUMat()

especially in CPU only processing
This commit is contained in:
Alexander Alekhin
2018-10-05 15:10:58 +03:00
parent 0101fa789c
commit 9d02d42afe
7 changed files with 48 additions and 20 deletions
+6 -1
View File
@@ -60,6 +60,9 @@ public:
int coords, classes, anchors, classfix;
float thresh, nmsThreshold;
bool useSoftmax, useLogistic;
#ifdef HAVE_OPENCL
UMat blob_umat;
#endif
RegionLayerImpl(const LayerParams& params)
{
@@ -123,6 +126,9 @@ public:
#ifdef HAVE_OPENCL
bool forward_ocl(InputArrayOfArrays inps, OutputArrayOfArrays outs, OutputArrayOfArrays internals)
{
if (blob_umat.empty())
blobs[0].copyTo(blob_umat);
std::vector<UMat> inputs;
std::vector<UMat> outputs;
@@ -135,7 +141,6 @@ public:
CV_Assert(inputs.size() >= 1);
int const cell_size = classes + coords + 1;
UMat blob_umat = blobs[0].getUMat(ACCESS_READ);
for (size_t ii = 0; ii < outputs.size(); ii++)
{