mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Intel Inference Engine deep learning backend (#10608)
* Intel Inference Engine deep learning backend. * OpenFace network using Inference Engine backend
This commit is contained in:
committed by
Vadim Pisarevsky
parent
292dfc2d72
commit
10e1de74d2
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "../precomp.hpp"
|
||||
#include "layers_common.hpp"
|
||||
#include "op_inf_engine.hpp"
|
||||
#include <float.h>
|
||||
#include <algorithm>
|
||||
#include "opencl_kernels_dnn.hpp"
|
||||
@@ -112,6 +113,12 @@ public:
|
||||
checkNeedForPermutation();
|
||||
}
|
||||
|
||||
virtual bool supportBackend(int backendId)
|
||||
{
|
||||
return backendId == DNN_BACKEND_DEFAULT ||
|
||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine();
|
||||
}
|
||||
|
||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||
const int requiredOutputs,
|
||||
std::vector<MatShape> &outputs,
|
||||
@@ -370,6 +377,25 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual Ptr<BackendNode> initInfEngine(const std::vector<Ptr<BackendWrapper> >&)
|
||||
{
|
||||
#ifdef HAVE_INF_ENGINE
|
||||
InferenceEngine::LayerParams lp;
|
||||
lp.name = name;
|
||||
lp.type = "Permute";
|
||||
lp.precision = InferenceEngine::Precision::FP32;
|
||||
std::shared_ptr<InferenceEngine::CNNLayer> ieLayer(new InferenceEngine::CNNLayer(lp));
|
||||
|
||||
CV_Assert(!_order.empty());
|
||||
ieLayer->params["order"] = format("%d", _order[0]);
|
||||
for (int i = 1; i < _order.size(); ++i)
|
||||
ieLayer->params["order"] += format(",%d", _order[i]);
|
||||
|
||||
return Ptr<BackendNode>(new InfEngineBackendNode(ieLayer));
|
||||
#endif // HAVE_INF_ENGINE
|
||||
return Ptr<BackendNode>();
|
||||
}
|
||||
|
||||
size_t _count;
|
||||
std::vector<size_t> _order;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user