Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
a2853393
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a2853393
编写于
8月 03, 2020
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17998 from dkurt:dnn_fix_ngraph
上级
d6952087
cf8f65d8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
27 deletion
+46
-27
modules/dnn/src/layers/fully_connected_layer.cpp
modules/dnn/src/layers/fully_connected_layer.cpp
+1
-1
modules/dnn/src/layers/permute_layer.cpp
modules/dnn/src/layers/permute_layer.cpp
+2
-1
modules/dnn/test/test_layers.cpp
modules/dnn/test/test_layers.cpp
+18
-11
modules/dnn/test/test_misc.cpp
modules/dnn/test/test_misc.cpp
+25
-14
未找到文件。
modules/dnn/src/layers/fully_connected_layer.cpp
浏览文件 @
a2853393
...
...
@@ -565,7 +565,7 @@ public:
}
else
{
std
::
vector
<
size_t
>
data
=
{(
size_t
)
ieInpNode
->
get_shape
()[
0
],
(
size
_t
)
blobs
[
0
].
size
[
1
]};
std
::
vector
<
int64_t
>
data
=
{(
int64_t
)
ieInpNode
->
get_shape
()[
0
],
(
int64
_t
)
blobs
[
0
].
size
[
1
]};
auto
new_shape
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
ngraph
::
element
::
i64
,
ngraph
::
Shape
{
2
},
data
.
data
());
auto
inp
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
Reshape
>
(
ieInpNode
,
new_shape
,
true
);
...
...
modules/dnn/src/layers/permute_layer.cpp
浏览文件 @
a2853393
...
...
@@ -385,8 +385,9 @@ public:
const
std
::
vector
<
Ptr
<
BackendNode
>
>&
nodes
)
CV_OVERRIDE
{
auto
&
ieInpNode
=
nodes
[
0
].
dynamicCast
<
InfEngineNgraphNode
>
()
->
node
;
std
::
vector
<
int64_t
>
order
(
_order
.
begin
(),
_order
.
end
());
auto
tr_axes
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
ngraph
::
element
::
i64
,
ngraph
::
Shape
({
_order
.
size
()}),
_
order
.
data
());
ngraph
::
Shape
({
order
.
size
()}),
order
.
data
());
auto
transpose
=
std
::
make_shared
<
ngraph
::
op
::
Transpose
>
(
ieInpNode
,
tr_axes
);
return
Ptr
<
BackendNode
>
(
new
InfEngineNgraphNode
(
transpose
));
}
...
...
modules/dnn/test/test_layers.cpp
浏览文件 @
a2853393
...
...
@@ -1108,6 +1108,9 @@ TEST_P(Layer_Test_Convolution_DLDT, Accuracy)
const
Backend
backendId
=
get
<
0
>
(
GetParam
());
const
Target
targetId
=
get
<
1
>
(
GetParam
());
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
targetId
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
throw
SkipTestException
(
"No support for async forward"
);
...
...
@@ -1118,9 +1121,8 @@ TEST_P(Layer_Test_Convolution_DLDT, Accuracy)
else
FAIL
()
<<
"Unknown backendId"
;
std
::
string
suffix
=
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
targetId
==
DNN_TARGET_MYRIAD
)
?
"_fp16"
:
""
;
Net
netDefault
=
readNet
(
_tf
(
"layer_convolution.caffemodel"
),
_tf
(
"layer_convolution.prototxt"
));
Net
net
=
readNet
(
_tf
(
"layer_convolution
"
+
suffix
+
".xml"
),
_tf
(
"layer_convolution"
+
suffix
+
"
.bin"
));
Net
net
=
readNet
(
_tf
(
"layer_convolution
.xml"
),
_tf
(
"layer_convolution
.bin"
));
Mat
inp
=
blobFromNPY
(
_tf
(
"blob.npy"
));
...
...
@@ -1140,7 +1142,10 @@ TEST_P(Layer_Test_Convolution_DLDT, Accuracy)
std
::
vector
<
int
>
outLayers
=
net
.
getUnconnectedOutLayers
();
ASSERT_EQ
(
net
.
getLayer
(
outLayers
[
0
])
->
name
,
"output"
);
ASSERT_EQ
(
net
.
getLayer
(
outLayers
[
0
])
->
type
,
"Convolution"
);
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
)
ASSERT_EQ
(
net
.
getLayer
(
outLayers
[
0
])
->
type
,
"Convolution"
);
else
ASSERT_EQ
(
net
.
getLayer
(
outLayers
[
0
])
->
type
,
"Add"
);
}
TEST_P
(
Layer_Test_Convolution_DLDT
,
setInput_uint8
)
...
...
@@ -1148,6 +1153,9 @@ TEST_P(Layer_Test_Convolution_DLDT, setInput_uint8)
const
Backend
backendId
=
get
<
0
>
(
GetParam
());
const
Target
targetId
=
get
<
1
>
(
GetParam
());
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
targetId
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
throw
SkipTestException
(
"No support for async forward"
);
...
...
@@ -1164,12 +1172,10 @@ TEST_P(Layer_Test_Convolution_DLDT, setInput_uint8)
randu
(
inputs
[
0
],
0
,
255
);
inputs
[
0
].
convertTo
(
inputs
[
1
],
CV_32F
);
std
::
string
suffix
=
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
targetId
==
DNN_TARGET_MYRIAD
)
?
"_fp16"
:
""
;
Mat
outs
[
2
];
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
Net
net
=
readNet
(
_tf
(
"layer_convolution
"
+
suffix
+
".xml"
),
_tf
(
"layer_convolution"
+
suffix
+
"
.bin"
));
Net
net
=
readNet
(
_tf
(
"layer_convolution
.xml"
),
_tf
(
"layer_convolution
.bin"
));
net
.
setPreferableBackend
(
backendId
);
net
.
setPreferableTarget
(
targetId
);
net
.
setInput
(
inputs
[
i
]);
...
...
@@ -1185,6 +1191,9 @@ TEST_P(Layer_Test_Convolution_DLDT, multithreading)
const
Backend
backendId
=
get
<
0
>
(
GetParam
());
const
Target
targetId
=
get
<
1
>
(
GetParam
());
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
targetId
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
throw
SkipTestException
(
"No support for async forward"
);
...
...
@@ -1195,9 +1204,8 @@ TEST_P(Layer_Test_Convolution_DLDT, multithreading)
else
FAIL
()
<<
"Unknown backendId"
;
std
::
string
suffix
=
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
targetId
==
DNN_TARGET_MYRIAD
)
?
"_fp16"
:
""
;
std
::
string
xmlPath
=
_tf
(
"layer_convolution"
+
suffix
+
".xml"
);
std
::
string
binPath
=
_tf
(
"layer_convolution"
+
suffix
+
".bin"
);
std
::
string
xmlPath
=
_tf
(
"layer_convolution.xml"
);
std
::
string
binPath
=
_tf
(
"layer_convolution.bin"
);
Net
firstNet
=
readNet
(
xmlPath
,
binPath
);
Net
secondNet
=
readNet
(
xmlPath
,
binPath
);
Mat
inp
=
blobFromNPY
(
_tf
(
"blob.npy"
));
...
...
@@ -1256,8 +1264,7 @@ TEST_P(Test_DLDT_two_inputs_3dim, as_IR)
int
secondInpType
=
get
<
1
>
(
GetParam
());
Target
targetId
=
get
<
2
>
(
GetParam
());
std
::
string
suffix
=
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
targetId
==
DNN_TARGET_MYRIAD
)
?
"_fp16"
:
""
;
Net
net
=
readNet
(
_tf
(
"net_two_inputs"
+
suffix
+
".xml"
),
_tf
(
"net_two_inputs.bin"
));
Net
net
=
readNet
(
_tf
(
"net_two_inputs.xml"
),
_tf
(
"net_two_inputs.bin"
));
std
::
vector
<
int
>
inpSize
=
get
<
3
>
(
GetParam
());
Mat
firstInp
(
3
,
inpSize
.
data
(),
firstInpType
);
Mat
secondInp
(
3
,
inpSize
.
data
(),
secondInpType
);
...
...
modules/dnn/test/test_misc.cpp
浏览文件 @
a2853393
...
...
@@ -440,12 +440,14 @@ TEST_P(Async, model_optimizer_pipeline_set_and_forward_single)
const
Backend
backendId
=
get
<
0
>
(
get
<
1
>
(
GetParam
()));
const
Target
targetId
=
get
<
1
>
(
get
<
1
>
(
GetParam
()));
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
targetId
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
throw
SkipTestException
(
"No support for async forward"
);
const
std
::
string
suffix
=
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
targetId
==
DNN_TARGET_MYRIAD
)
?
"_fp16"
:
""
;
const
std
::
string
&
model
=
findDataFile
(
"dnn/layers/layer_convolution"
+
suffix
+
".bin"
);
const
std
::
string
&
proto
=
findDataFile
(
"dnn/layers/layer_convolution"
+
suffix
+
".xml"
);
const
std
::
string
&
model
=
findDataFile
(
"dnn/layers/layer_convolution.bin"
);
const
std
::
string
&
proto
=
findDataFile
(
"dnn/layers/layer_convolution.xml"
);
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
)
setInferenceEngineBackendType
(
CV_DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_API
);
...
...
@@ -499,12 +501,14 @@ TEST_P(Async, model_optimizer_pipeline_set_and_forward_all)
const
Backend
backendId
=
get
<
0
>
(
get
<
1
>
(
GetParam
()));
const
Target
targetId
=
get
<
1
>
(
get
<
1
>
(
GetParam
()));
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
targetId
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
throw
SkipTestException
(
"No support for async forward"
);
const
std
::
string
suffix
=
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
targetId
==
DNN_TARGET_MYRIAD
)
?
"_fp16"
:
""
;
const
std
::
string
&
model
=
findDataFile
(
"dnn/layers/layer_convolution"
+
suffix
+
".bin"
);
const
std
::
string
&
proto
=
findDataFile
(
"dnn/layers/layer_convolution"
+
suffix
+
".xml"
);
const
std
::
string
&
model
=
findDataFile
(
"dnn/layers/layer_convolution.bin"
);
const
std
::
string
&
proto
=
findDataFile
(
"dnn/layers/layer_convolution.xml"
);
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
)
setInferenceEngineBackendType
(
CV_DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_API
);
...
...
@@ -673,9 +677,11 @@ TEST_P(Test_Model_Optimizer, forward_two_nets)
const
Backend
backendId
=
get
<
0
>
(
GetParam
());
const
Target
targetId
=
get
<
1
>
(
GetParam
());
const
std
::
string
suffix
=
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
targetId
==
DNN_TARGET_MYRIAD
)
?
"_fp16"
:
""
;
const
std
::
string
&
model
=
findDataFile
(
"dnn/layers/layer_convolution"
+
suffix
+
".bin"
);
const
std
::
string
&
proto
=
findDataFile
(
"dnn/layers/layer_convolution"
+
suffix
+
".xml"
);
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
targetId
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
const
std
::
string
&
model
=
findDataFile
(
"dnn/layers/layer_convolution.bin"
);
const
std
::
string
&
proto
=
findDataFile
(
"dnn/layers/layer_convolution.xml"
);
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
)
setInferenceEngineBackendType
(
CV_DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_API
);
...
...
@@ -712,12 +718,14 @@ TEST_P(Test_Model_Optimizer, readFromBuffer)
const
Backend
backendId
=
get
<
0
>
(
GetParam
());
const
Target
targetId
=
get
<
1
>
(
GetParam
());
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
targetId
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
backendId
!=
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
throw
SkipTestException
(
"No support for async forward"
);
const
std
::
string
suffix
=
(
targetId
==
DNN_TARGET_OPENCL_FP16
||
targetId
==
DNN_TARGET_MYRIAD
)
?
"_fp16"
:
""
;
const
std
::
string
&
weightsFile
=
findDataFile
(
"dnn/layers/layer_convolution"
+
suffix
+
".bin"
);
const
std
::
string
&
modelFile
=
findDataFile
(
"dnn/layers/layer_convolution"
+
suffix
+
".xml"
);
const
std
::
string
&
weightsFile
=
findDataFile
(
"dnn/layers/layer_convolution.bin"
);
const
std
::
string
&
modelFile
=
findDataFile
(
"dnn/layers/layer_convolution.xml"
);
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
)
setInferenceEngineBackendType
(
CV_DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_API
);
...
...
@@ -765,8 +773,11 @@ TEST_P(Test_Model_Optimizer, flexible_inputs)
const
Backend
backendId
=
get
<
0
>
(
GetParam
());
const
Target
targetId
=
get
<
1
>
(
GetParam
());
const
std
::
string
&
model
=
findDataFile
(
"dnn/layers/layer_convolution_fp16.bin"
);
const
std
::
string
&
proto
=
findDataFile
(
"dnn/layers/layer_convolution_fp16.xml"
);
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
targetId
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
const
std
::
string
&
model
=
findDataFile
(
"dnn/layers/layer_convolution.bin"
);
const
std
::
string
&
proto
=
findDataFile
(
"dnn/layers/layer_convolution.xml"
);
if
(
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
)
setInferenceEngineBackendType
(
CV_DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_API
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录