Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
f2057ce1
O
Opencv
项目概览
Greenplum
/
Opencv
9 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
f2057ce1
编写于
6月 29, 2021
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dnn(ie): replace deprecated calls
上级
6797fd65
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
14 deletion
+37
-14
modules/dnn/src/ie_ngraph.cpp
modules/dnn/src/ie_ngraph.cpp
+37
-14
未找到文件。
modules/dnn/src/ie_ngraph.cpp
浏览文件 @
f2057ce1
...
...
@@ -654,7 +654,11 @@ void InfEngineNgraphNet::initPlugin(InferenceEngine::CNNNetwork& net)
try
{
InferenceEngine
::
IExtensionPtr
extension
=
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2021_4)
std
::
make_shared
<
InferenceEngine
::
Extension
>
(
libName
);
#else
InferenceEngine
::
make_so_pointer
<
InferenceEngine
::
IExtension
>
(
libName
);
#endif
ie
.
AddExtension
(
extension
,
"CPU"
);
CV_LOG_INFO
(
NULL
,
"DNN-IE: Loaded extension plugin: "
<<
libName
);
...
...
@@ -1002,35 +1006,54 @@ void InfEngineNgraphNet::forward(const std::vector<Ptr<BackendWrapper> >& outBlo
reqWrapper
->
req
.
SetInput
(
inpBlobs
);
reqWrapper
->
req
.
SetOutput
(
outBlobs
);
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2021_4)
InferenceEngine
::
InferRequest
infRequest
=
reqWrapper
->
req
;
NgraphReqWrapper
*
wrapperPtr
=
reqWrapper
.
get
();
CV_Assert
(
wrapperPtr
&&
"Internal error"
);
#else
InferenceEngine
::
IInferRequest
::
Ptr
infRequestPtr
=
reqWrapper
->
req
;
infRequestPtr
->
SetUserData
(
reqWrapper
.
get
(),
0
);
CV_Assert
(
infRequestPtr
);
InferenceEngine
::
IInferRequest
&
infRequest
=
*
infRequestPtr
.
get
();
infRequest
.
SetUserData
(
reqWrapper
.
get
(),
0
);
#endif
infRequestPtr
->
SetCompletionCallback
(
[](
InferenceEngine
::
IInferRequest
::
Ptr
request
,
InferenceEngine
::
StatusCode
status
)
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2021_4)
// do NOT capture 'reqWrapper' (smart ptr) in the lambda callback
infRequest
.
SetCompletionCallback
<
std
::
function
<
void
(
InferenceEngine
::
InferRequest
,
InferenceEngine
::
StatusCode
)
>>
(
[
wrapperPtr
](
InferenceEngine
::
InferRequest
/*request*/
,
InferenceEngine
::
StatusCode
status
)
#else
infRequest
.
SetCompletionCallback
(
[](
InferenceEngine
::
IInferRequest
::
Ptr
requestPtr
,
InferenceEngine
::
StatusCode
status
)
#endif
{
CV_LOG_DEBUG
(
NULL
,
"DNN(nGraph): completionCallback("
<<
(
int
)
status
<<
")"
);
#if !INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2021_4)
CV_Assert
(
requestPtr
);
InferenceEngine
::
IInferRequest
&
request
=
*
requestPtr
.
get
();
NgraphReqWrapper
*
wrapper
;
request
->
GetUserData
((
void
**
)
&
wrapper
,
0
);
CV_Assert
(
wrapper
&&
"Internal error"
);
NgraphReqWrapper
*
wrapperPtr
;
request
.
GetUserData
((
void
**
)
&
wrapperPtr
,
0
);
CV_Assert
(
wrapperPtr
&&
"Internal error"
);
#endif
NgraphReqWrapper
&
wrapper
=
*
wrapperPtr
;
size_t
processedOutputs
=
0
;
try
{
for
(;
processedOutputs
<
wrapper
->
outProms
.
size
();
++
processedOutputs
)
for
(;
processedOutputs
<
wrapper
.
outProms
.
size
();
++
processedOutputs
)
{
const
std
::
string
&
name
=
wrapper
->
outsNames
[
processedOutputs
];
Mat
m
=
ngraphBlobToMat
(
wrapper
->
req
.
GetBlob
(
name
));
const
std
::
string
&
name
=
wrapper
.
outsNames
[
processedOutputs
];
Mat
m
=
ngraphBlobToMat
(
wrapper
.
req
.
GetBlob
(
name
));
try
{
CV_Assert
(
status
==
InferenceEngine
::
StatusCode
::
OK
);
wrapper
->
outProms
[
processedOutputs
].
setValue
(
m
.
clone
());
wrapper
.
outProms
[
processedOutputs
].
setValue
(
m
.
clone
());
}
catch
(...)
{
try
{
wrapper
->
outProms
[
processedOutputs
].
setException
(
std
::
current_exception
());
wrapper
.
outProms
[
processedOutputs
].
setException
(
std
::
current_exception
());
}
catch
(...)
{
CV_LOG_ERROR
(
NULL
,
"DNN: Exception occurred during async inference exception propagation"
);
}
...
...
@@ -1040,16 +1063,16 @@ void InfEngineNgraphNet::forward(const std::vector<Ptr<BackendWrapper> >& outBlo
catch
(...)
{
std
::
exception_ptr
e
=
std
::
current_exception
();
for
(;
processedOutputs
<
wrapper
->
outProms
.
size
();
++
processedOutputs
)
for
(;
processedOutputs
<
wrapper
.
outProms
.
size
();
++
processedOutputs
)
{
try
{
wrapper
->
outProms
[
processedOutputs
].
setException
(
e
);
wrapper
.
outProms
[
processedOutputs
].
setException
(
e
);
}
catch
(...)
{
CV_LOG_ERROR
(
NULL
,
"DNN: Exception occurred during async inference exception propagation"
);
}
}
}
wrapper
->
isReady
=
true
;
wrapper
.
isReady
=
true
;
}
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录