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

Enable TensorFlow networks tests for different backends and targets

This commit is contained in:
Dmitry Kurtaev
2018-07-13 19:47:50 +03:00
parent 23fc96e98f
commit 6eb8faea85
3 changed files with 53 additions and 27 deletions
@@ -295,7 +295,9 @@ public:
for (int i = 0; i < num; i++)
confPreds.push_back(Mat(2, shape, CV_32F));
UMat umat = inp1.reshape(1, num * numPredsPerClass);
shape[0] = num * numPredsPerClass;
shape[1] = inp1.total() / shape[0];
UMat umat = inp1.reshape(1, 2, &shape[0]);
for (int i = 0; i < num; ++i)
{
Range ranges[] = { Range(i * numPredsPerClass, (i + 1) * numPredsPerClass), Range::all() };
@@ -342,7 +344,7 @@ public:
// Decode all loc predictions to bboxes
bool ret = ocl_DecodeBBoxesAll(inputs[0], inputs[2], num, numPriors,
_shareLocation, _numLocClasses, _backgroundLabelId,
_codeType, _varianceEncodedInTarget, false,
_codeType, _varianceEncodedInTarget, _clip,
allDecodedBBoxes);
if (!ret)
return false;
+6 -7
View File
@@ -110,27 +110,26 @@ public:
outputs_.getUMatVector(outputs);
internals_.getUMatVector(internals);
UMat& src = inputs[0];
UMat& dstMat = outputs[0];
int axis = clamp(axisRaw, src.dims);
if (softmaxOp.empty())
{
OCL4DNNSoftmaxConfig config;
config.in_shape = shape(inputs[0]);
config.axis = axisRaw;
config.channels = inputs[0].size[axisRaw];
config.axis = axis;
config.channels = inputs[0].size[axis];
config.logsoftmax = logSoftMax;
config.use_half = use_half;
softmaxOp = Ptr<OCL4DNNSoftmax<float> >(new OCL4DNNSoftmax<float>(config));
}
UMat& src = inputs[0];
UMat& dstMat = outputs[0];
if (softmaxOp->Forward(src, dstMat))
return true;
UMat& bufMat = internals[0];
int axis = clamp(axisRaw, src.dims);
MatShape s = shape(src);
size_t outerSize = total(s, 0, axis);
size_t channels = src.size[axis];