Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
a4060e15
Commit
a4060e15
authored
6 years ago
by
Maksim Shabunin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnn, IE backend: updated to match new interface
parent
ab9b6e80
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
11 deletions
+62
-11
op_inf_engine.cpp
modules/dnn/src/op_inf_engine.cpp
+38
-5
op_inf_engine.hpp
modules/dnn/src/op_inf_engine.hpp
+24
-6
No files found.
modules/dnn/src/op_inf_engine.cpp
View file @
a4060e15
...
...
@@ -180,10 +180,15 @@ InferenceEngine::Precision InfEngineBackendNet::getPrecision() noexcept
return
precision
;
}
InferenceEngine
::
Precision
InfEngineBackendNet
::
getPrecision
()
const
noexcept
{
return
precision
;
}
// Assume that outputs of network is unconnected blobs.
void
InfEngineBackendNet
::
getOutputsInfo
(
InferenceEngine
::
OutputsDataMap
&
outputs_
)
noexcept
{
outputs_
=
outputs
;
const_cast
<
const
InfEngineBackendNet
*>
(
this
)
->
getOutputsInfo
(
outputs_
)
;
}
void
InfEngineBackendNet
::
getOutputsInfo
(
InferenceEngine
::
OutputsDataMap
&
outputs_
)
const
noexcept
{
...
...
@@ -193,7 +198,7 @@ void InfEngineBackendNet::getOutputsInfo(InferenceEngine::OutputsDataMap &output
// Returns input references that aren't connected to internal outputs.
void
InfEngineBackendNet
::
getInputsInfo
(
InferenceEngine
::
InputsDataMap
&
inputs_
)
noexcept
{
inputs_
=
inputs
;
const_cast
<
const
InfEngineBackendNet
*>
(
this
)
->
getInputsInfo
(
inputs_
)
;
}
// Returns input references that aren't connected to internal outputs.
...
...
@@ -204,7 +209,11 @@ void InfEngineBackendNet::getInputsInfo(InferenceEngine::InputsDataMap &inputs_)
InferenceEngine
::
InputInfo
::
Ptr
InfEngineBackendNet
::
getInput
(
const
std
::
string
&
inputName
)
noexcept
{
getInputsInfo
(
inputs
);
return
const_cast
<
const
InfEngineBackendNet
*>
(
this
)
->
getInput
(
inputName
);
}
InferenceEngine
::
InputInfo
::
Ptr
InfEngineBackendNet
::
getInput
(
const
std
::
string
&
inputName
)
const
noexcept
{
const
auto
&
it
=
inputs
.
find
(
inputName
);
CV_Assert
(
it
!=
inputs
.
end
());
return
it
->
second
;
...
...
@@ -218,7 +227,17 @@ void InfEngineBackendNet::getName(char*, size_t) const noexcept
{
}
const
std
::
string
&
InfEngineBackendNet
::
getName
()
const
noexcept
{
return
name
;
}
size_t
InfEngineBackendNet
::
layerCount
()
noexcept
{
return
const_cast
<
const
InfEngineBackendNet
*>
(
this
)
->
layerCount
();
}
size_t
InfEngineBackendNet
::
layerCount
()
const
noexcept
{
return
layers
.
size
();
}
...
...
@@ -258,6 +277,13 @@ InfEngineBackendNet::addOutput(const std::string &layerName, size_t outputIndex,
InferenceEngine
::
StatusCode
InfEngineBackendNet
::
getLayerByName
(
const
char
*
layerName
,
InferenceEngine
::
CNNLayerPtr
&
out
,
InferenceEngine
::
ResponseDesc
*
resp
)
noexcept
{
return
const_cast
<
const
InfEngineBackendNet
*>
(
this
)
->
getLayerByName
(
layerName
,
out
,
resp
);
}
InferenceEngine
::
StatusCode
InfEngineBackendNet
::
getLayerByName
(
const
char
*
layerName
,
InferenceEngine
::
CNNLayerPtr
&
out
,
InferenceEngine
::
ResponseDesc
*
resp
)
const
noexcept
{
for
(
auto
&
l
:
layers
)
{
...
...
@@ -285,7 +311,12 @@ InferenceEngine::TargetDevice InfEngineBackendNet::getTargetDevice() noexcept
return
targetDevice
;
}
InferenceEngine
::
StatusCode
InfEngineBackendNet
::
setBatchSize
(
const
size_t
size
)
noexcept
InferenceEngine
::
TargetDevice
InfEngineBackendNet
::
getTargetDevice
()
const
noexcept
{
return
targetDevice
;
}
InferenceEngine
::
StatusCode
InfEngineBackendNet
::
setBatchSize
(
const
size_t
)
noexcept
{
CV_Error
(
Error
::
StsNotImplemented
,
""
);
return
InferenceEngine
::
StatusCode
::
OK
;
...
...
@@ -374,7 +405,9 @@ void InfEngineBackendNet::init(int targetId)
switch
(
targetId
)
{
case
DNN_TARGET_CPU
:
setTargetDevice
(
InferenceEngine
::
TargetDevice
::
eCPU
);
break
;
case
DNN_TARGET_OPENCL_FP16
:
setPrecision
(
InferenceEngine
::
Precision
::
FP16
);
// Fallback to the next.
case
DNN_TARGET_OPENCL_FP16
:
setPrecision
(
InferenceEngine
::
Precision
::
FP16
);
/* Falls through. */
case
DNN_TARGET_OPENCL
:
setTargetDevice
(
InferenceEngine
::
TargetDevice
::
eGPU
);
break
;
case
DNN_TARGET_MYRIAD
:
{
...
...
This diff is collapsed.
Click to expand it.
modules/dnn/src/op_inf_engine.hpp
View file @
a4060e15
...
...
@@ -8,6 +8,8 @@
#ifndef __OPENCV_DNN_OP_INF_ENGINE_HPP__
#define __OPENCV_DNN_OP_INF_ENGINE_HPP__
#include "opencv2/core/cvdef.h"
#ifdef HAVE_INF_ENGINE
#if defined(__GNUC__) && __GNUC__ >= 5
//#pragma GCC diagnostic push
...
...
@@ -34,7 +36,9 @@ public:
void
setPrecision
(
InferenceEngine
::
Precision
p
)
noexcept
;
virtual
InferenceEngine
::
Precision
getPrecision
()
noexcept
CV_OVERRIDE
;
virtual
InferenceEngine
::
Precision
getPrecision
()
noexcept
;
virtual
InferenceEngine
::
Precision
getPrecision
()
const
noexcept
;
virtual
void
getOutputsInfo
(
InferenceEngine
::
OutputsDataMap
&
out
)
noexcept
/*CV_OVERRIDE*/
;
...
...
@@ -44,13 +48,19 @@ public:
virtual
void
getInputsInfo
(
InferenceEngine
::
InputsDataMap
&
inputs
)
const
noexcept
/*CV_OVERRIDE*/
;
virtual
InferenceEngine
::
InputInfo
::
Ptr
getInput
(
const
std
::
string
&
inputName
)
noexcept
CV_OVERRIDE
;
virtual
InferenceEngine
::
InputInfo
::
Ptr
getInput
(
const
std
::
string
&
inputName
)
noexcept
;
virtual
InferenceEngine
::
InputInfo
::
Ptr
getInput
(
const
std
::
string
&
inputName
)
const
noexcept
;
virtual
void
getName
(
char
*
pName
,
size_t
len
)
noexcept
;
virtual
void
getName
(
char
*
pName
,
size_t
len
)
const
noexcept
;
virtual
size_t
layerCount
()
noexcept
CV_OVERRIDE
;
virtual
const
std
::
string
&
getName
()
const
noexcept
;
virtual
size_t
layerCount
()
noexcept
;
virtual
size_t
layerCount
()
const
noexcept
;
virtual
InferenceEngine
::
DataPtr
&
getData
(
const
char
*
dname
)
noexcept
CV_OVERRIDE
;
...
...
@@ -58,15 +68,21 @@ public:
virtual
InferenceEngine
::
StatusCode
addOutput
(
const
std
::
string
&
layerName
,
size_t
outputIndex
=
0
,
InferenceEngine
::
ResponseDesc
*
resp
=
nullptr
)
noexcept
CV_OVERRIDE
;
InferenceEngine
::
ResponseDesc
*
resp
=
nullptr
)
noexcept
;
virtual
InferenceEngine
::
StatusCode
getLayerByName
(
const
char
*
layerName
,
InferenceEngine
::
CNNLayerPtr
&
out
,
InferenceEngine
::
ResponseDesc
*
resp
)
noexcept
CV_OVERRIDE
;
InferenceEngine
::
ResponseDesc
*
resp
)
noexcept
;
virtual
InferenceEngine
::
StatusCode
getLayerByName
(
const
char
*
layerName
,
InferenceEngine
::
CNNLayerPtr
&
out
,
InferenceEngine
::
ResponseDesc
*
resp
)
const
noexcept
;
virtual
void
setTargetDevice
(
InferenceEngine
::
TargetDevice
device
)
noexcept
CV_OVERRIDE
;
virtual
InferenceEngine
::
TargetDevice
getTargetDevice
()
noexcept
CV_OVERRIDE
;
virtual
InferenceEngine
::
TargetDevice
getTargetDevice
()
noexcept
;
virtual
InferenceEngine
::
TargetDevice
getTargetDevice
()
const
noexcept
;
virtual
InferenceEngine
::
StatusCode
setBatchSize
(
const
size_t
size
)
noexcept
CV_OVERRIDE
;
...
...
@@ -94,6 +110,8 @@ private:
InferenceEngine
::
ExecutableNetwork
netExec
;
InferenceEngine
::
InferRequest
infRequest
;
std
::
string
name
;
void
initPlugin
(
InferenceEngine
::
ICNNNetwork
&
net
);
};
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment