mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge pull request #14792 from dkurt:dnn_ie_min_version_r5
* Remove Inference Engine 2018R3 and 2018R4 * Fix 2018R5
This commit is contained in:
committed by
Alexander Alekhin
parent
54a14c877c
commit
eba696a41e
@@ -194,10 +194,9 @@ public:
|
||||
}
|
||||
#endif // HAVE_HALIDE
|
||||
|
||||
#ifdef HAVE_INF_ENGINE
|
||||
virtual Ptr<BackendNode> initInfEngine(const std::vector<Ptr<BackendWrapper> >&) CV_OVERRIDE
|
||||
{
|
||||
#ifdef HAVE_INF_ENGINE
|
||||
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2018R5)
|
||||
InferenceEngine::Builder::Layer l = InferenceEngine::Builder::ScaleShiftLayer(name);
|
||||
|
||||
CV_Assert(!blobs.empty());
|
||||
@@ -219,37 +218,8 @@ public:
|
||||
if (hasBias)
|
||||
addConstantData("biases", wrapToInfEngineBlob(blobs.back(), {numChannels}, InferenceEngine::Layout::C), l);
|
||||
return Ptr<BackendNode>(new InfEngineBackendNode(l));
|
||||
#else
|
||||
InferenceEngine::LayerParams lp;
|
||||
lp.name = name;
|
||||
lp.type = "ScaleShift";
|
||||
lp.precision = InferenceEngine::Precision::FP32;
|
||||
std::shared_ptr<InferenceEngine::ScaleShiftLayer> ieLayer(new InferenceEngine::ScaleShiftLayer(lp));
|
||||
|
||||
CV_Assert(!blobs.empty());
|
||||
const size_t numChannels = blobs[0].total();
|
||||
if (hasWeights)
|
||||
{
|
||||
ieLayer->_weights = wrapToInfEngineBlob(blobs[0], {numChannels}, InferenceEngine::Layout::C);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto weights = InferenceEngine::make_shared_blob<float>(InferenceEngine::Precision::FP32,
|
||||
{numChannels});
|
||||
weights->allocate();
|
||||
|
||||
std::vector<float> ones(numChannels, 1);
|
||||
weights->set(ones);
|
||||
ieLayer->_weights = weights;
|
||||
}
|
||||
if (hasBias)
|
||||
ieLayer->_biases = wrapToInfEngineBlob(blobs.back(), {numChannels}, InferenceEngine::Layout::C);
|
||||
|
||||
return Ptr<BackendNode>(new InfEngineBackendNode(ieLayer));
|
||||
#endif
|
||||
#endif // HAVE_INF_ENGINE
|
||||
return Ptr<BackendNode>();
|
||||
}
|
||||
#endif // HAVE_INF_ENGINE
|
||||
|
||||
void getScaleShift(Mat& scale, Mat& shift) const CV_OVERRIDE
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user