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
3f27f8cf
Commit
3f27f8cf
authored
Jan 13, 2020
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16232 from dkurt:dnn_ie_ngraph_fix_myriad_tests
parents
31289d2f
8f1e36f7
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
174 additions
and
59 deletions
+174
-59
dnn.cpp
modules/dnn/src/dnn.cpp
+17
-0
ie_ngraph.cpp
modules/dnn/src/ie_ngraph.cpp
+15
-10
concat_layer.cpp
modules/dnn/src/layers/concat_layer.cpp
+38
-6
pooling_layer.cpp
modules/dnn/src/layers/pooling_layer.cpp
+1
-1
op_inf_engine.cpp
modules/dnn/src/op_inf_engine.cpp
+16
-0
test_backends.cpp
modules/dnn/test/test_backends.cpp
+4
-4
test_caffe_importer.cpp
modules/dnn/test/test_caffe_importer.cpp
+8
-4
test_darknet_importer.cpp
modules/dnn/test/test_darknet_importer.cpp
+6
-5
test_halide_layers.cpp
modules/dnn/test/test_halide_layers.cpp
+2
-6
test_ie_models.cpp
modules/dnn/test/test_ie_models.cpp
+5
-4
test_layers.cpp
modules/dnn/test/test_layers.cpp
+4
-2
test_onnx_importer.cpp
modules/dnn/test/test_onnx_importer.cpp
+27
-11
test_tf_importer.cpp
modules/dnn/test/test_tf_importer.cpp
+19
-6
test_torch_importer.cpp
modules/dnn/test/test_torch_importer.cpp
+12
-0
No files found.
modules/dnn/src/dnn.cpp
View file @
3f27f8cf
...
...
@@ -103,6 +103,22 @@ public:
#ifdef HAVE_INF_ENGINE
static
inline
bool
checkIETarget
(
Target
target
)
{
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2019R3)
// Lightweight detection
const
std
::
vector
<
std
::
string
>
devices
=
getCore
().
GetAvailableDevices
();
for
(
std
::
vector
<
std
::
string
>::
const_iterator
i
=
devices
.
begin
();
i
!=
devices
.
end
();
++
i
)
{
if
(
std
::
string
::
npos
!=
i
->
find
(
"MYRIAD"
)
&&
target
==
DNN_TARGET_MYRIAD
)
return
true
;
else
if
(
std
::
string
::
npos
!=
i
->
find
(
"FPGA"
)
&&
target
==
DNN_TARGET_FPGA
)
return
true
;
else
if
(
std
::
string
::
npos
!=
i
->
find
(
"CPU"
)
&&
target
==
DNN_TARGET_CPU
)
return
true
;
else
if
(
std
::
string
::
npos
!=
i
->
find
(
"GPU"
)
&&
(
target
==
DNN_TARGET_OPENCL
||
target
==
DNN_TARGET_OPENCL_FP16
))
return
true
;
}
return
false
;
#else
cv
::
dnn
::
Net
net
;
cv
::
dnn
::
LayerParams
lp
;
lp
.
set
(
"kernel_size"
,
1
);
...
...
@@ -126,6 +142,7 @@ public:
return
false
;
}
return
true
;
#endif
}
#endif
...
...
modules/dnn/src/ie_ngraph.cpp
View file @
3f27f8cf
...
...
@@ -168,21 +168,26 @@ void InfEngineNgraphNet::init(Target targetId)
{
if
(
!
hasNetOwner
)
{
if
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
targetId
==
DNN_TARGET_MYRIAD
)
{
if
(
targetId
==
DNN_TARGET_OPENCL_FP16
)
{
auto
nodes
=
ngraph_function
->
get_ordered_ops
();
for
(
auto
&
node
:
nodes
)
{
for
(
auto
&
node
:
nodes
)
{
auto
parameter
=
std
::
dynamic_pointer_cast
<
ngraph
::
op
::
Parameter
>
(
node
);
if
(
parameter
&&
parameter
->
get_element_type
()
==
ngraph
::
element
::
f32
)
{
if
(
parameter
&&
parameter
->
get_element_type
()
==
ngraph
::
element
::
f32
)
{
parameter
->
set_element_type
(
ngraph
::
element
::
f16
);
}
auto
constant
=
std
::
dynamic_pointer_cast
<
ngraph
::
op
::
Constant
>
(
node
);
if
(
constant
&&
constant
->
get_element_type
()
==
ngraph
::
element
::
f32
)
{
auto
data
=
constant
->
get_vector
<
float
>
();
std
::
vector
<
ngraph
::
float16
>
new_data
(
data
.
size
());
for
(
size_t
i
=
0
;
i
<
data
.
size
();
++
i
)
{
new_data
[
i
]
=
ngraph
::
float16
(
data
[
i
]);
}
auto
new_const
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
ngraph
::
element
::
f16
,
constant
->
get_shape
(),
new_data
);
if
(
constant
&&
constant
->
get_element_type
()
==
ngraph
::
element
::
f32
)
{
const
float
*
floatsData
=
constant
->
get_data_ptr
<
float
>
();
size_t
total
=
ngraph
::
shape_size
(
constant
->
get_shape
());
Mat
floats
(
1
,
total
,
CV_32F
,
(
void
*
)
floatsData
);
Mat
halfs
;
cv
::
convertFp16
(
floats
,
halfs
);
auto
new_const
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
ngraph
::
element
::
f16
,
constant
->
get_shape
(),
halfs
.
data
);
new_const
->
set_friendly_name
(
constant
->
get_friendly_name
());
ngraph
::
replace_node
(
constant
,
new_const
);
}
...
...
modules/dnn/src/layers/concat_layer.cpp
View file @
3f27f8cf
...
...
@@ -106,7 +106,8 @@ public:
{
return
backendId
==
DNN_BACKEND_OPENCV
||
(
backendId
==
DNN_BACKEND_HALIDE
&&
haveHalide
()
&&
axis
==
1
&&
!
padding
)
||
// By channels
((
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
haveInfEngine
()
&&
!
padding
);
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
haveInfEngine
()
&&
!
padding
)
||
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
;
}
class
ChannelConcatInvoker
:
public
ParallelLoopBody
...
...
@@ -316,14 +317,45 @@ public:
virtual
Ptr
<
BackendNode
>
initNgraph
(
const
std
::
vector
<
Ptr
<
BackendWrapper
>
>&
inputs
,
const
std
::
vector
<
Ptr
<
BackendNode
>
>&
nodes
)
CV_OVERRIDE
{
InferenceEngine
::
DataPtr
data
=
ngraphDataNode
(
inputs
[
0
]);
const
int
numDims
=
data
->
getDims
().
size
();
const
int
cAxis
=
clamp
(
axis
,
numDims
);
std
::
vector
<
size_t
>
maxDims
(
numDims
,
0
);
CV_Assert
(
inputs
.
size
()
==
nodes
.
size
());
ngraph
::
NodeVector
inp_nodes
;
for
(
auto
&
node
:
nodes
)
{
inp_nodes
.
push_back
(
node
.
dynamicCast
<
InfEngineNgraphNode
>
()
->
node
);
}
for
(
int
i
=
0
;
i
<
nodes
.
size
();
++
i
)
{
inp_nodes
.
push_back
(
nodes
[
i
].
dynamicCast
<
InfEngineNgraphNode
>
()
->
node
);
InferenceEngine
::
DataPtr
data
=
ngraphDataNode
(
inputs
[
0
]);
auto
concat
=
std
::
make_shared
<
ngraph
::
op
::
Concat
>
(
inp_nodes
,
clamp
(
axis
,
data
->
getDims
().
size
()));
std
::
vector
<
size_t
>
inpShape
=
ngraphDataNode
(
inputs
[
i
])
->
getDims
();
for
(
int
i
=
0
;
i
<
numDims
;
++
i
)
maxDims
[
i
]
=
std
::
max
(
maxDims
[
i
],
inpShape
[
i
]);
}
for
(
int
i
=
0
;
i
<
inp_nodes
.
size
();
++
i
)
{
bool
needPadding
=
false
;
std
::
vector
<
size_t
>
inpShape
=
ngraphDataNode
(
inputs
[
i
])
->
getDims
();
std
::
vector
<
int64_t
>
begins
(
inpShape
.
size
(),
0
),
ends
(
inpShape
.
size
(),
0
);
for
(
int
j
=
0
;
j
<
inpShape
.
size
();
++
j
)
{
if
(
j
!=
cAxis
&&
inpShape
[
j
]
!=
maxDims
[
j
])
{
needPadding
=
true
;
begins
[
j
]
=
static_cast
<
int64_t
>
((
maxDims
[
j
]
-
inpShape
[
j
])
/
2
);
ends
[
j
]
=
static_cast
<
int64_t
>
(
maxDims
[
j
]
-
inpShape
[
j
]
-
begins
[
j
]);
}
}
if
(
needPadding
)
{
inp_nodes
[
i
]
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
Pad
>
(
inp_nodes
[
i
],
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
ngraph
::
element
::
i64
,
ngraph
::
Shape
{
begins
.
size
()},
begins
.
data
()),
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
ngraph
::
element
::
i64
,
ngraph
::
Shape
{
ends
.
size
()},
ends
.
data
()),
ngraph
::
op
::
PadMode
::
CONSTANT
);
}
}
auto
concat
=
std
::
make_shared
<
ngraph
::
op
::
Concat
>
(
inp_nodes
,
cAxis
);
return
Ptr
<
BackendNode
>
(
new
InfEngineNgraphNode
(
concat
));
}
#endif // HAVE_DNN_NGRAPH
...
...
modules/dnn/src/layers/pooling_layer.cpp
View file @
3f27f8cf
...
...
@@ -189,7 +189,7 @@ public:
#endif
}
else
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
{
return
type
!=
STOCHASTIC
;
return
!
computeMaxIdx
&&
type
!=
STOCHASTIC
;
}
else
return
(
kernel_size
.
size
()
==
3
&&
backendId
==
DNN_BACKEND_OPENCV
&&
preferableTarget
==
DNN_TARGET_CPU
)
||
...
...
modules/dnn/src/op_inf_engine.cpp
View file @
3f27f8cf
...
...
@@ -573,6 +573,21 @@ InferenceEngine::Core& getCore()
#if !defined(OPENCV_DNN_IE_VPU_TYPE_DEFAULT)
static
bool
detectMyriadX_
()
{
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2019R3)
// Lightweight detection
InferenceEngine
::
Core
&
ie
=
getCore
();
const
std
::
vector
<
std
::
string
>
devices
=
ie
.
GetAvailableDevices
();
for
(
std
::
vector
<
std
::
string
>::
const_iterator
i
=
devices
.
begin
();
i
!=
devices
.
end
();
++
i
)
{
if
(
i
->
find
(
"MYRIAD"
)
!=
std
::
string
::
npos
)
{
const
std
::
string
name
=
ie
.
GetMetric
(
*
i
,
METRIC_KEY
(
FULL_DEVICE_NAME
)).
as
<
std
::
string
>
();
CV_LOG_INFO
(
NULL
,
"Myriad device: "
<<
name
);
return
name
.
find
(
"MyriadX"
)
!=
std
::
string
::
npos
||
name
.
find
(
"Myriad X"
)
!=
std
::
string
::
npos
;
}
}
return
false
;
#else
InferenceEngine
::
Builder
::
Network
builder
(
""
);
InferenceEngine
::
idx_t
inpId
=
builder
.
addLayer
(
InferenceEngine
::
Builder
::
InputLayer
().
setPort
(
InferenceEngine
::
Port
({
1
})));
...
...
@@ -633,6 +648,7 @@ static bool detectMyriadX_()
return
false
;
}
return
true
;
#endif
}
#endif // !defined(OPENCV_DNN_IE_VPU_TYPE_DEFAULT)
...
...
modules/dnn/test/test_backends.cpp
View file @
3f27f8cf
...
...
@@ -189,8 +189,8 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_Caffe_Different_Width_Height)
if
(
backend
==
DNN_BACKEND_HALIDE
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_HALIDE
);
#if defined(INF_ENGINE_RELEASE)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
if
(
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
);
#endif
Mat
sample
=
imread
(
findDataFile
(
"dnn/street.png"
));
...
...
@@ -223,8 +223,8 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_v1_TensorFlow_Different_Width_Height)
if
(
backend
==
DNN_BACKEND_HALIDE
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_HALIDE
);
#if defined(INF_ENGINE_RELEASE)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
if
(
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
);
#endif
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019020000)
...
...
modules/dnn/test/test_caffe_importer.cpp
View file @
3f27f8cf
...
...
@@ -660,9 +660,11 @@ TEST_P(Test_Caffe_nets, FasterRCNN_zf)
(
target
==
DNN_TARGET_CPU
?
CV_TEST_TAG_MEMORY_512MB
:
CV_TEST_TAG_MEMORY_1GB
),
CV_TEST_TAG_DEBUG_LONG
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_OPENCL_FP16
)
if
((
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
target
==
DNN_TARGET_OPENCL_FP16
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
)
if
((
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
);
static
Mat
ref
=
(
Mat_
<
float
>
(
3
,
7
)
<<
0
,
2
,
0.90121
,
120.407
,
115.83
,
570.586
,
528.395
,
0
,
7
,
0.988779
,
469.849
,
75.1756
,
718.64
,
186.762
,
...
...
@@ -677,9 +679,11 @@ TEST_P(Test_Caffe_nets, RFCN)
CV_TEST_TAG_LONG
,
CV_TEST_TAG_DEBUG_VERYLONG
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_OPENCL_FP16
)
if
((
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
target
==
DNN_TARGET_OPENCL_FP16
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
)
if
((
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
);
double
scoreDiff
=
(
backend
==
DNN_BACKEND_OPENCV
&&
target
==
DNN_TARGET_OPENCL_FP16
)
?
4e-3
:
default_l1
;
double
iouDiff
=
(
backend
==
DNN_BACKEND_OPENCV
&&
target
==
DNN_TARGET_OPENCL_FP16
)
?
8e-2
:
default_lInf
;
...
...
modules/dnn/test/test_darknet_importer.cpp
View file @
3f27f8cf
...
...
@@ -307,8 +307,8 @@ TEST_P(Test_Darknet_nets, YoloVoc)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16
);
#endif
#if defined(INF_ENGINE_RELEASE)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
if
(
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
);
// need to update check function
#endif
...
...
@@ -343,8 +343,8 @@ TEST_P(Test_Darknet_nets, TinyYoloVoc)
applyTestTag
(
CV_TEST_TAG_MEMORY_512MB
);
#if defined(INF_ENGINE_RELEASE)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
if
(
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
);
// need to update check function
#endif
// batchId, classId, confidence, left, top, right, bottom
...
...
@@ -460,7 +460,8 @@ TEST_P(Test_Darknet_nets, YOLOv3)
std
::
string
weights_file
=
"yolov3.weights"
;
#if defined(INF_ENGINE_RELEASE)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
&&
if
((
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
{
scoreDiff
=
0.04
;
...
...
modules/dnn/test/test_halide_layers.cpp
View file @
3f27f8cf
...
...
@@ -350,11 +350,6 @@ TEST_P(MaxPooling, Accuracy)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
#endif
#if defined(INF_ENGINE_RELEASE)
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
&&
stride
!=
Size
(
1
,
1
)
&&
pad
!=
Size
(
0
,
0
))
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
#endif
LayerParams
lp
;
lp
.
set
(
"pool"
,
"max"
);
lp
.
set
(
"kernel_w"
,
kernel
.
width
);
...
...
@@ -392,7 +387,8 @@ TEST_P(FullyConnected, Accuracy)
bool
hasBias
=
get
<
3
>
(
GetParam
());
Backend
backendId
=
get
<
0
>
(
get
<
4
>
(
GetParam
()));
Target
targetId
=
get
<
1
>
(
get
<
4
>
(
GetParam
()));
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
if
((
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
(
targetId
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)))
{
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16
);
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
);
...
...
modules/dnn/test/test_ie_models.cpp
View file @
3f27f8cf
...
...
@@ -134,12 +134,13 @@ static const std::vector<std::string> getOpenVINOTestModelsList()
return
result
;
}
static
inline
void
genData
(
const
std
::
vector
<
size_t
>&
dims
,
Mat
&
m
,
Blob
::
Ptr
&
dataPtr
)
static
inline
void
genData
(
const
InferenceEngine
::
TensorDesc
&
desc
,
Mat
&
m
,
Blob
::
Ptr
&
dataPtr
)
{
const
std
::
vector
<
size_t
>&
dims
=
desc
.
getDims
();
m
.
create
(
std
::
vector
<
int
>
(
dims
.
begin
(),
dims
.
end
()),
CV_32F
);
randu
(
m
,
-
1
,
1
);
dataPtr
=
make_shared_blob
<
float
>
(
{
Precision
::
FP32
,
dims
,
Layout
::
ANY
}
,
(
float
*
)
m
.
data
);
dataPtr
=
make_shared_blob
<
float
>
(
desc
,
(
float
*
)
m
.
data
);
}
void
runIE
(
Target
target
,
const
std
::
string
&
xmlPath
,
const
std
::
string
&
binPath
,
...
...
@@ -238,7 +239,7 @@ void runIE(Target target, const std::string& xmlPath, const std::string& binPath
BlobMap
inputBlobs
;
for
(
auto
&
it
:
net
.
getInputsInfo
())
{
genData
(
it
.
second
->
getTensorDesc
()
.
getDims
()
,
inputsMap
[
it
.
first
],
inputBlobs
[
it
.
first
]);
genData
(
it
.
second
->
getTensorDesc
(),
inputsMap
[
it
.
first
],
inputBlobs
[
it
.
first
]);
}
infRequest
.
SetInput
(
inputBlobs
);
...
...
@@ -247,7 +248,7 @@ void runIE(Target target, const std::string& xmlPath, const std::string& binPath
BlobMap
outputBlobs
;
for
(
auto
&
it
:
net
.
getOutputsInfo
())
{
genData
(
it
.
second
->
getTensorDesc
()
.
getDims
()
,
outputsMap
[
it
.
first
],
outputBlobs
[
it
.
first
]);
genData
(
it
.
second
->
getTensorDesc
(),
outputsMap
[
it
.
first
],
outputBlobs
[
it
.
first
]);
}
infRequest
.
SetOutput
(
outputBlobs
);
...
...
modules/dnn/test/test_layers.cpp
View file @
3f27f8cf
...
...
@@ -846,6 +846,8 @@ TEST_P(Test_Caffe_layers, PriorBox_squares)
{
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
LayerParams
lp
;
lp
.
name
=
"testPriorBox"
;
lp
.
type
=
"PriorBox"
;
...
...
@@ -1276,7 +1278,7 @@ static void test_dldt_fused_output(Backend backend, Target target)
}
net
.
setPreferableBackend
(
backend
);
net
.
setPreferableTarget
(
target
);
net
.
setInput
(
Mat
({
1
,
1
,
1
,
1
},
CV_32FC1
,
Scalar
(
1
)));
net
.
setInput
(
Mat
({
1
,
1
,
2
,
3
},
CV_32FC1
,
Scalar
(
1
)));
net
.
forward
();
}
...
...
@@ -1315,7 +1317,7 @@ TEST_P(Test_DLDT_layers, multiple_networks)
nets
[
i
].
addLayerToPrev
(
lp
.
name
,
lp
.
type
,
lp
);
nets
[
i
].
setPreferableBackend
(
backend
);
nets
[
i
].
setPreferableTarget
(
target
);
nets
[
i
].
setInput
(
Mat
({
1
,
1
,
1
,
1
},
CV_32FC1
,
Scalar
(
1
)));
nets
[
i
].
setInput
(
Mat
({
1
,
1
,
2
,
3
},
CV_32FC1
,
Scalar
(
1
)));
}
Mat
out_1
=
nets
[
0
].
forward
();
Mat
out_2
=
nets
[
1
].
forward
();
...
...
modules/dnn/test/test_onnx_importer.cpp
View file @
3f27f8cf
...
...
@@ -345,9 +345,12 @@ TEST_P(Test_ONNX_layers, Div)
net
.
setPreferableBackend
(
backend
);
net
.
setPreferableTarget
(
target
);
Mat
inp1
=
blobFromNPY
(
_tf
(
"data/input_div_0.npy"
));
Mat
inp2
=
blobFromNPY
(
_tf
(
"data/input_div_1.npy"
));
// Reference output values range is -68.80928, 2.991873. So to avoid computational
// difference for FP16 we'll perform reversed division (just swap inputs).
Mat
inp1
=
blobFromNPY
(
_tf
(
"data/input_div_1.npy"
));
Mat
inp2
=
blobFromNPY
(
_tf
(
"data/input_div_0.npy"
));
Mat
ref
=
blobFromNPY
(
_tf
(
"data/output_div.npy"
));
cv
::
divide
(
1.0
,
ref
,
ref
);
checkBackend
(
&
inp1
,
&
ref
);
net
.
setInput
(
inp1
,
"0"
);
...
...
@@ -448,6 +451,9 @@ TEST_P(Test_ONNX_nets, Googlenet)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
const
String
model
=
_tf
(
"models/googlenet.onnx"
,
false
);
Net
net
=
readNetFromONNX
(
model
);
...
...
@@ -491,7 +497,7 @@ TEST_P(Test_ONNX_nets, RCNN_ILSVRC13)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
#endif
// Reference output values are in range [-4.992, -1.161]
testONNXModels
(
"rcnn_ilsvrc13"
,
pb
,
0.004
5
);
testONNXModels
(
"rcnn_ilsvrc13"
,
pb
,
0.004
6
);
}
TEST_P
(
Test_ONNX_nets
,
VGG16_bn
)
...
...
@@ -558,10 +564,12 @@ TEST_P(Test_ONNX_nets, TinyYolov2)
)
applyTestTag
(
target
==
DNN_TARGET_OPENCL
?
CV_TEST_TAG_DNN_SKIP_IE_OPENCL
:
CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
if
(
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
?
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
:
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
#endif
// output range: [-11; 8]
...
...
@@ -594,6 +602,12 @@ TEST_P(Test_ONNX_nets, LResNet100E_IR)
if
(
target
==
DNN_TARGET_OPENCL
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
}
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
{
if
(
target
==
DNN_TARGET_OPENCL_FP16
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
if
(
target
==
DNN_TARGET_OPENCL
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
if
(
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
}
double
l1
=
default_l1
;
double
lInf
=
default_lInf
;
...
...
@@ -612,10 +626,11 @@ TEST_P(Test_ONNX_nets, LResNet100E_IR)
TEST_P
(
Test_ONNX_nets
,
Emotion_ferplus
)
{
#if defined(INF_ENGINE_RELEASE)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
?
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
:
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
#endif
double
l1
=
default_l1
;
...
...
@@ -652,7 +667,8 @@ TEST_P(Test_ONNX_nets, DenseNet121)
TEST_P
(
Test_ONNX_nets
,
Inception_v1
)
{
#if defined(INF_ENGINE_RELEASE)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
)
if
((
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
);
#endif
testONNXModels
(
"inception_v1"
,
pb
);
...
...
modules/dnn/test/test_tf_importer.cpp
View file @
3f27f8cf
...
...
@@ -247,10 +247,13 @@ TEST_P(Test_TensorFlow_layers, ave_pool_same)
{
// Reference output values are in range [-0.519531, 0.112976]
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
if
(
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
{
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
else
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
}
#endif
runTensorFlowNet
(
"ave_pool_same"
);
}
...
...
@@ -373,6 +376,8 @@ TEST_P(Test_TensorFlow_layers, l2_normalize_3d)
#if defined(INF_ENGINE_RELEASE)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
#endif
runTensorFlowNet
(
"l2_normalize_3d"
);
...
...
@@ -383,11 +388,15 @@ class Test_TensorFlow_nets : public DNNTestLayer {};
TEST_P
(
Test_TensorFlow_nets
,
MobileNet_SSD
)
{
#if defined(INF_ENGINE_RELEASE)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
)
if
(
target
==
DNN_TARGET_MYRIAD
)
{
#if INF_ENGINE_VER_MAJOR_GE(2019020000)
if
(
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
?
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
:
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
#endif
}
#endif
...
...
@@ -503,6 +512,10 @@ TEST_P(Test_TensorFlow_nets, Faster_RCNN)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
(
INF_ENGINE_VER_MAJOR_LT
(
2019020000
)
||
target
!=
DNN_TARGET_CPU
))
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
if
(
INF_ENGINE_VER_MAJOR_GT
(
2019030000
)
&&
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
#endif
// segfault: inference-engine/thirdparty/clDNN/src/gpu/detection_output_cpu.cpp:111:
// Assertion `prior_height > 0' failed.
...
...
modules/dnn/test/test_torch_importer.cpp
View file @
3f27f8cf
...
...
@@ -211,6 +211,8 @@ TEST_P(Test_Torch_layers, net_conv_gemm_lrn)
{
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
runTorchNet
(
"net_conv_gemm_lrn"
,
""
,
false
,
true
,
true
,
target
==
DNN_TARGET_OPENCL_FP16
?
0.046
:
0.0
,
target
==
DNN_TARGET_OPENCL_FP16
?
0.023
:
0.0
);
...
...
@@ -348,6 +350,13 @@ TEST_P(Test_Torch_nets, ENet_accuracy)
if
(
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
throw
SkipTestException
(
""
);
}
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
&&
target
!=
DNN_TARGET_CPU
)
{
if
(
target
==
DNN_TARGET_OPENCL_FP16
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
if
(
target
==
DNN_TARGET_OPENCL
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
if
(
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
throw
SkipTestException
(
""
);
}
Net
net
;
{
...
...
@@ -400,6 +409,9 @@ TEST_P(Test_Torch_nets, FastNeuralStyle_accuracy)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
&&
target
==
DNN_TARGET_MYRIAD
&&
getInferenceEngineVPUType
()
==
CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
#endif
checkBackend
();
...
...
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