Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
8a95f4f0
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,发现更多精彩内容 >>
提交
8a95f4f0
编写于
4月 07, 2023
作者:
T
TolyaTalamanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Handle meta for multiple infer inputs
上级
f5a92cb4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
13 deletion
+23
-13
modules/gapi/src/backends/ie/giebackend.cpp
modules/gapi/src/backends/ie/giebackend.cpp
+23
-13
未找到文件。
modules/gapi/src/backends/ie/giebackend.cpp
浏览文件 @
8a95f4f0
...
...
@@ -456,6 +456,7 @@ public:
cv
::
gimpl
::
GIslandExecutable
::
IOutput
&
output
,
const
cv
::
GArgs
&
args
,
const
std
::
vector
<
cv
::
gimpl
::
RcDesc
>
&
outs
,
cv
::
GRunArg
::
Meta
&&
meta
,
std
::
vector
<
cv
::
gimpl
::
GIslandExecutable
::
InObj
>
&&
input_objs
,
std
::
vector
<
cv
::
gimpl
::
GIslandExecutable
::
OutObj
>
&&
output_objs
);
...
...
@@ -477,9 +478,8 @@ public:
const
cv
::
Mat
&
inMat
(
std
::
size_t
input
)
const
;
const
cv
::
MediaFrame
&
inFrame
(
std
::
size_t
input
)
const
;
const
cv
::
GRunArg
&
input
(
std
::
size_t
idx
)
const
;
cv
::
GRunArgP
output
(
std
::
size_t
idx
);
cv
::
Mat
&
outMatR
(
std
::
size_t
idx
);
cv
::
GRunArgP
output
(
std
::
size_t
idx
);
cv
::
Mat
&
outMatR
(
std
::
size_t
idx
);
const
IEUnit
&
uu
;
cv
::
gimpl
::
GIslandExecutable
::
IOutput
&
out
;
...
...
@@ -491,6 +491,8 @@ public:
// To store exception appeared in callback.
std
::
exception_ptr
eptr
;
const
cv
::
GRunArg
::
Meta
&
getMeta
()
{
return
m_meta
;
};
using
req_key_t
=
void
*
;
cv
::
MediaFrame
*
prepareKeepAliveFrameSlot
(
req_key_t
key
);
size_t
releaseKeepAliveFrame
(
req_key_t
key
);
...
...
@@ -499,6 +501,9 @@ private:
cv
::
GArg
packArg
(
const
cv
::
GArg
&
arg
);
// To propagate accumulated meta from all inputs to output.
cv
::
GRunArg
::
Meta
m_meta
;
// To store input/output data from frames
std
::
vector
<
cv
::
gimpl
::
GIslandExecutable
::
InObj
>
m_input_objs
;
std
::
vector
<
cv
::
gimpl
::
GIslandExecutable
::
OutObj
>
m_output_objs
;
...
...
@@ -525,9 +530,11 @@ IECallContext::IECallContext(const IEUnit &
cv
::
gimpl
::
GIslandExecutable
::
IOutput
&
output
,
const
cv
::
GArgs
&
args
,
const
std
::
vector
<
cv
::
gimpl
::
RcDesc
>
&
outs
,
cv
::
GRunArg
::
Meta
&&
meta
,
std
::
vector
<
cv
::
gimpl
::
GIslandExecutable
::
InObj
>
&&
input_objs
,
std
::
vector
<
cv
::
gimpl
::
GIslandExecutable
::
OutObj
>
&&
output_objs
)
:
uu
(
unit
),
out
(
output
),
m_input_objs
(
std
::
move
(
input_objs
)),
m_output_objs
(
std
::
move
(
output_objs
))
:
uu
(
unit
),
out
(
output
),
m_meta
(
std
::
move
(
meta
)),
m_input_objs
(
std
::
move
(
input_objs
)),
m_output_objs
(
std
::
move
(
output_objs
))
{
for
(
auto
&
it
:
m_input_objs
)
cv
::
gimpl
::
magazine
::
bindInArg
(
m_res
,
it
.
first
,
it
.
second
);
for
(
auto
&
it
:
m_output_objs
)
cv
::
gimpl
::
magazine
::
bindOutArg
(
m_res
,
it
.
first
,
it
.
second
);
...
...
@@ -575,10 +582,6 @@ cv::GRunArgP IECallContext::output(std::size_t idx) {
return
m_output_objs
[
idx
].
second
;
};
const
cv
::
GRunArg
&
IECallContext
::
input
(
std
::
size_t
idx
)
const
{
return
m_input_objs
[
idx
].
second
;
}
cv
::
detail
::
VectorRef
&
IECallContext
::
outVecRef
(
std
::
size_t
idx
)
{
return
cv
::
util
::
get
<
cv
::
detail
::
VectorRef
>
(
m_results
.
at
(
idx
));
}
...
...
@@ -1062,6 +1065,12 @@ void cv::gimpl::ie::GIEExecutable::run(cv::gimpl::GIslandExecutable::IInput &in
GAPI_Assert
(
cv
::
util
::
holds_alternative
<
cv
::
GRunArgs
>
(
in_msg
));
const
auto
in_vector
=
cv
::
util
::
get
<
cv
::
GRunArgs
>
(
in_msg
);
// NB: Collect meta from all inputs.
cv
::
GRunArg
::
Meta
stub_meta
;
for
(
auto
&&
in_arg
:
in_vector
)
{
stub_meta
.
insert
(
in_arg
.
meta
.
begin
(),
in_arg
.
meta
.
end
());
}
// (1) Collect island inputs/outputs
input_objs
.
reserve
(
in_desc
.
size
());
...
...
@@ -1084,7 +1093,7 @@ void cv::gimpl::ie::GIEExecutable::run(cv::gimpl::GIslandExecutable::IInput &in
const
auto
&
op
=
m_gm
.
metadata
(
this_nh
).
get
<
Op
>
();
// (2) Create kernel context
auto
ctx
=
std
::
make_shared
<
IECallContext
>
(
uu
,
out
,
op
.
args
,
op
.
outs
,
std
::
move
(
input_objs
),
std
::
move
(
output_objs
));
std
::
move
(
stub_meta
),
std
::
move
(
input_objs
),
std
::
move
(
output_objs
));
const
auto
&
kk
=
giem
.
metadata
(
this_nh
).
get
<
IECallable
>
();
...
...
@@ -1096,6 +1105,7 @@ void cv::gimpl::ie::GIEExecutable::run(cv::gimpl::GIslandExecutable::IInput &in
for
(
auto
i
:
ade
::
util
::
iota
(
ctx
->
uu
.
params
.
num_out
))
{
auto
output
=
ctx
->
output
(
i
);
ctx
->
out
.
meta
(
output
,
ctx
->
getMeta
());
ctx
->
out
.
post
(
std
::
move
(
output
),
eptr
);
}
return
;
...
...
@@ -1247,7 +1257,7 @@ static void PostOutputs(InferenceEngine::InferRequest &request,
IE
::
Blob
::
Ptr
this_blob
=
request
.
GetBlob
(
ctx
->
uu
.
params
.
output_names
[
i
]);
copyFromIE
(
this_blob
,
out_mat
);
auto
output
=
ctx
->
output
(
i
);
ctx
->
out
.
meta
(
output
,
ctx
->
input
(
0
).
meta
);
ctx
->
out
.
meta
(
output
,
ctx
->
getMeta
()
);
ctx
->
out
.
post
(
std
::
move
(
output
),
ctx
->
eptr
);
}
...
...
@@ -1314,7 +1324,7 @@ void PostOutputsList::operator()(InferenceEngine::InferRequest &req,
if
(
finished
==
size
)
{
for
(
auto
i
:
ade
::
util
::
iota
(
ctx
->
uu
.
params
.
num_out
))
{
auto
output
=
ctx
->
output
(
i
);
ctx
->
out
.
meta
(
output
,
ctx
->
input
(
0
).
meta
);
ctx
->
out
.
meta
(
output
,
ctx
->
getMeta
()
);
ctx
->
out
.
post
(
std
::
move
(
output
),
ctx
->
eptr
);
}
}
...
...
@@ -1642,7 +1652,7 @@ struct InferList: public cv::detail::KernelTag {
if
(
in_roi_vec
.
empty
())
{
for
(
auto
i
:
ade
::
util
::
iota
(
ctx
->
uu
.
params
.
num_out
))
{
auto
output
=
ctx
->
output
(
i
);
ctx
->
out
.
meta
(
output
,
ctx
->
input
(
0
).
meta
);
ctx
->
out
.
meta
(
output
,
ctx
->
getMeta
()
);
ctx
->
out
.
post
(
std
::
move
(
output
));
}
return
;
...
...
@@ -1806,7 +1816,7 @@ struct InferList2: public cv::detail::KernelTag {
if
(
list_size
==
0u
)
{
for
(
auto
i
:
ade
::
util
::
iota
(
ctx
->
uu
.
params
.
num_out
))
{
auto
output
=
ctx
->
output
(
i
);
ctx
->
out
.
meta
(
output
,
ctx
->
input
(
0
).
meta
);
ctx
->
out
.
meta
(
output
,
ctx
->
getMeta
()
);
ctx
->
out
.
post
(
std
::
move
(
output
));
}
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录