Intel Inference Engine deep learning backend (#10608)

* Intel Inference Engine deep learning backend.

* OpenFace network using Inference Engine backend
This commit is contained in:
Dmitry Kurtaev
2018-02-06 11:57:35 +03:00
committed by Vadim Pisarevsky
parent 292dfc2d72
commit 10e1de74d2
26 changed files with 1379 additions and 49 deletions
+22 -1
View File
@@ -43,6 +43,7 @@
#include "../precomp.hpp"
#include "layers_common.hpp"
#include "op_halide.hpp"
#include "op_inf_engine.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/dnn/shape_utils.hpp"
#include "opencv2/core/hal/hal.hpp"
@@ -90,7 +91,8 @@ public:
virtual bool supportBackend(int backendId)
{
return backendId == DNN_BACKEND_DEFAULT ||
backendId == DNN_BACKEND_HALIDE && haveHalide();
backendId == DNN_BACKEND_HALIDE && haveHalide() ||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine();
}
#ifdef HAVE_OPENCL
@@ -369,6 +371,25 @@ public:
#endif // HAVE_HALIDE
}
virtual Ptr<BackendNode> initInfEngine(const std::vector<Ptr<BackendWrapper> >&)
{
#ifdef HAVE_INF_ENGINE
InferenceEngine::LayerParams lp;
lp.name = name;
lp.type = "Norm";
lp.precision = InferenceEngine::Precision::FP32;
std::shared_ptr<InferenceEngine::NormLayer> ieLayer(new InferenceEngine::NormLayer(lp));
ieLayer->_size = size;
ieLayer->_k = (int)bias;
ieLayer->_beta = beta;
ieLayer->_alpha = alpha;
ieLayer->_isAcrossMaps = (type == CHANNEL_NRM);
return Ptr<BackendNode>(new InfEngineBackendNode(ieLayer));
#endif // HAVE_INF_ENGINE
return Ptr<BackendNode>();
}
virtual int64 getFLOPS(const std::vector<MatShape> &inputs,
const std::vector<MatShape> &outputs) const
{