|
|
|
@ -131,6 +131,9 @@ public: |
|
|
|
|
CV_Assert(layerInternals.empty()); |
|
|
|
|
internals.push_back(layerOutputs[0]); |
|
|
|
|
|
|
|
|
|
// Detections layer.
|
|
|
|
|
internals.push_back(shape(1, 1, keepTopAfterNMS, 7)); |
|
|
|
|
|
|
|
|
|
outputs.resize(2); |
|
|
|
|
outputs[0] = shape(keepTopAfterNMS, 5); |
|
|
|
|
outputs[1] = shape(keepTopAfterNMS, 1); |
|
|
|
@ -176,13 +179,14 @@ public: |
|
|
|
|
internals_.getUMatVector(internals); |
|
|
|
|
|
|
|
|
|
CV_Assert(inputs.size() == 3); |
|
|
|
|
CV_Assert(internals.size() == 3); |
|
|
|
|
CV_Assert(internals.size() == 4); |
|
|
|
|
const UMat& scores = inputs[0]; |
|
|
|
|
const UMat& bboxDeltas = inputs[1]; |
|
|
|
|
const UMat& imInfo = inputs[2]; |
|
|
|
|
UMat& priorBoxes = internals[0]; |
|
|
|
|
UMat& permuttedScores = internals[1]; |
|
|
|
|
UMat& permuttedDeltas = internals[2]; |
|
|
|
|
UMat& detections = internals[3]; |
|
|
|
|
|
|
|
|
|
CV_Assert(imInfo.total() >= 2); |
|
|
|
|
// We've chosen the smallest data type because we need just a shape from it.
|
|
|
|
@ -217,7 +221,7 @@ public: |
|
|
|
|
layerInputs[2] = priorBoxes; |
|
|
|
|
layerInputs[3] = umat_fakeImageBlob; |
|
|
|
|
|
|
|
|
|
layerOutputs[0] = UMat(); |
|
|
|
|
layerOutputs[0] = detections; |
|
|
|
|
detectionOutputLayer->forward(layerInputs, layerOutputs, internals); |
|
|
|
|
|
|
|
|
|
// DetectionOutputLayer produces 1x1xNx7 output where N might be less or
|
|
|
|
@ -237,10 +241,6 @@ public: |
|
|
|
|
dst = outputs[1].rowRange(0, numDets); |
|
|
|
|
layerOutputs[0].col(2).copyTo(dst); |
|
|
|
|
|
|
|
|
|
if (numDets < keepTopAfterNMS) |
|
|
|
|
for (int i = 0; i < 2; ++i) |
|
|
|
|
outputs[i].rowRange(numDets, keepTopAfterNMS).setTo(0); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
@ -266,13 +266,14 @@ public: |
|
|
|
|
internals_arr.getMatVector(internals); |
|
|
|
|
|
|
|
|
|
CV_Assert(inputs.size() == 3); |
|
|
|
|
CV_Assert(internals.size() == 3); |
|
|
|
|
CV_Assert(internals.size() == 4); |
|
|
|
|
const Mat& scores = inputs[0]; |
|
|
|
|
const Mat& bboxDeltas = inputs[1]; |
|
|
|
|
const Mat& imInfo = inputs[2]; |
|
|
|
|
Mat& priorBoxes = internals[0]; |
|
|
|
|
Mat& permuttedScores = internals[1]; |
|
|
|
|
Mat& permuttedDeltas = internals[2]; |
|
|
|
|
Mat& detections = internals[3]; |
|
|
|
|
|
|
|
|
|
CV_Assert(imInfo.total() >= 2); |
|
|
|
|
// We've chosen the smallest data type because we need just a shape from it.
|
|
|
|
@ -302,7 +303,7 @@ public: |
|
|
|
|
layerInputs[2] = priorBoxes; |
|
|
|
|
layerInputs[3] = fakeImageBlob; |
|
|
|
|
|
|
|
|
|
layerOutputs[0] = Mat(); |
|
|
|
|
layerOutputs[0] = detections; |
|
|
|
|
detectionOutputLayer->forward(layerInputs, layerOutputs, internals); |
|
|
|
|
|
|
|
|
|
// DetectionOutputLayer produces 1x1xNx7 output where N might be less or
|
|
|
|
@ -319,10 +320,6 @@ public: |
|
|
|
|
// The scores.
|
|
|
|
|
dst = outputs[1].rowRange(0, numDets); |
|
|
|
|
layerOutputs[0].col(2).copyTo(dst); |
|
|
|
|
|
|
|
|
|
if (numDets < keepTopAfterNMS) |
|
|
|
|
for (int i = 0; i < 2; ++i) |
|
|
|
|
outputs[i].rowRange(numDets, keepTopAfterNMS).setTo(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual Ptr<BackendNode> initInfEngine(const std::vector<Ptr<BackendWrapper> >&) CV_OVERRIDE |
|
|
|
|