1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

dnn(IE): use HAVE_DNN_IE_NN_BUILDER_2019 for NN Builder API code

- CMake option: OPENCV_DNN_IE_NN_BUILDER_2019
This commit is contained in:
Alexander Alekhin
2020-02-27 16:02:32 +03:00
committed by Alexander Alekhin
parent db5f1c3554
commit 29d214474f
32 changed files with 340 additions and 143 deletions
+8 -5
View File
@@ -622,7 +622,7 @@ public:
return Ptr<BackendNode>();
}
#ifdef HAVE_INF_ENGINE
#ifdef HAVE_DNN_IE_NN_BUILDER_2019
virtual Ptr<BackendNode> initInfEngine(const std::vector<Ptr<BackendWrapper> > &inputs) CV_OVERRIDE
{
InferenceEngine::DataPtr input = infEngineDataNode(inputs[0]);
@@ -683,7 +683,7 @@ public:
return Ptr<BackendNode>(new InfEngineBackendNode(l));
}
#endif // HAVE_INF_ENGINE
#endif // HAVE_DNN_IE_NN_BUILDER_2019
#ifdef HAVE_DNN_NGRAPH
virtual Ptr<BackendNode> initNgraph(const std::vector<Ptr<BackendWrapper> > &inputs,
@@ -1558,6 +1558,7 @@ public:
return group == 1;
}
#ifdef HAVE_DNN_IE_NN_BUILDER_2019
if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
{
if (kernel_size.size() == 3 && preferableTarget != DNN_TARGET_CPU) {
@@ -1601,10 +1602,12 @@ public:
return std::accumulate(dilations.begin(), dilations.end(), 1, std::multiplies<size_t>()) == 1;
return true;
}
else
#endif // HAVE_DNN_IE_NN_BUILDER_2019
#endif // HAVE_INF_ENGINE
{
return backendId == DNN_BACKEND_CUDA ||
(kernel_size.size() == 2 && (backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE));
}
}
bool getMemoryShapes(const std::vector<MatShape> &inputs,
@@ -2244,7 +2247,7 @@ public:
return Ptr<BackendNode>();
}
#ifdef HAVE_INF_ENGINE
#ifdef HAVE_DNN_IE_NN_BUILDER_2019
virtual Ptr<BackendNode> initInfEngine(const std::vector<Ptr<BackendWrapper> > &) CV_OVERRIDE
{
InferenceEngine::Layout layout = blobs[0].dims == 5? InferenceEngine::Layout::NCDHW :
@@ -2299,7 +2302,7 @@ public:
addConstantData("biases", wrapToInfEngineBlob(biasesMat, {(size_t)numOutput}, InferenceEngine::Layout::C), l);
return Ptr<BackendNode>(new InfEngineBackendNode(l));
}
#endif // HAVE_INF_ENGINE
#endif // HAVE_DNN_IE_NN_BUILDER_2019
#ifdef HAVE_DNN_NGRAPH