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

Merge pull request #15063 from dkurt:dnn_ie_ocv_layers

* Wrap unsupported by IE layers as custom layers

* Replace pointers to layers blobs to their shapes

* Enable Faster R-CNN with IE backend on CPU
This commit is contained in:
Dmitry Kurtaev
2019-09-03 16:58:57 +01:00
committed by Alexander Alekhin
parent 7e46766c8d
commit ba703157cf
10 changed files with 365 additions and 27 deletions
+15
View File
@@ -6,6 +6,7 @@
// Third party copyrights are property of their respective owners.
#include "../precomp.hpp"
#include "../op_inf_engine.hpp"
#include "layers_common.hpp"
#ifdef HAVE_OPENCL
@@ -23,6 +24,11 @@ public:
CV_Assert(blobs.size() == 1);
}
virtual bool supportBackend(int backendId) CV_OVERRIDE
{
return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_INFERENCE_ENGINE;
}
virtual bool getMemoryShapes(const std::vector<MatShape> &inputs,
const int requiredOutputs,
std::vector<MatShape> &outputs,
@@ -58,6 +64,15 @@ public:
outputs_arr.getMatVector(outputs);
blobs[0].copyTo(outputs[0]);
}
#ifdef HAVE_INF_ENGINE
virtual Ptr<BackendNode> initInfEngine(const std::vector<Ptr<BackendWrapper> >&) CV_OVERRIDE
{
InferenceEngine::Builder::ConstLayer ieLayer(name);
ieLayer.setData(wrapToInfEngineBlob(blobs[0]));
return Ptr<BackendNode>(new InfEngineBackendNode(ieLayer));
}
#endif // HAVE_INF_ENGINE
};
Ptr<Layer> ConstLayer::create(const LayerParams& params)