Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenCV
opencv
提交
719059f6
O
opencv
项目概览
OpenCV
/
opencv
上一次同步 9 个月
通知
992
Star
71100
Fork
55581
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
719059f6
编写于
6月 15, 2021
作者:
M
Maxim Pashchenkov
提交者:
Alexander Alekhin
10月 12, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
G-API: Removing ParseSSD overload.
* Removed specialization. * Removed united original commit:
651967b9
上级
4eb82c2e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
52 deletion
+32
-52
modules/gapi/include/opencv2/gapi/infer/parsers.hpp
modules/gapi/include/opencv2/gapi/infer/parsers.hpp
+5
-4
modules/gapi/src/backends/cpu/gcpucore.cpp
modules/gapi/src/backends/cpu/gcpucore.cpp
+13
-2
modules/gapi/src/backends/cpu/gnnparsers.cpp
modules/gapi/src/backends/cpu/gnnparsers.cpp
+10
-37
modules/gapi/src/backends/cpu/gnnparsers.hpp
modules/gapi/src/backends/cpu/gnnparsers.hpp
+4
-9
未找到文件。
modules/gapi/include/opencv2/gapi/infer/parsers.hpp
浏览文件 @
719059f6
...
@@ -69,7 +69,8 @@ GAPI_EXPORTS_W std::tuple<GArray<Rect>, GArray<int>> parseSSD(const GMat& in,
...
@@ -69,7 +69,8 @@ GAPI_EXPORTS_W std::tuple<GArray<Rect>, GArray<int>> parseSSD(const GMat& in,
const
float
confidenceThreshold
=
0.5
f
,
const
float
confidenceThreshold
=
0.5
f
,
const
int
filterLabel
=
-
1
);
const
int
filterLabel
=
-
1
);
/** @overload
/** @brief Parses output of SSD network.
Extracts detection information (box, confidence) from SSD output and
Extracts detection information (box, confidence) from SSD output and
filters it by given confidence and by going out of bounds.
filters it by given confidence and by going out of bounds.
...
@@ -87,9 +88,9 @@ the larger side of the rectangle.
...
@@ -87,9 +88,9 @@ the larger side of the rectangle.
*/
*/
GAPI_EXPORTS_W
GArray
<
Rect
>
parseSSD
(
const
GMat
&
in
,
GAPI_EXPORTS_W
GArray
<
Rect
>
parseSSD
(
const
GMat
&
in
,
const
GOpaque
<
Size
>&
inSz
,
const
GOpaque
<
Size
>&
inSz
,
const
float
confidenceThreshold
=
0.5
f
,
const
float
confidenceThreshold
,
const
bool
alignmentToSquare
=
false
,
const
bool
alignmentToSquare
,
const
bool
filterOutOfBounds
=
false
);
const
bool
filterOutOfBounds
);
/** @brief Parses output of Yolo network.
/** @brief Parses output of Yolo network.
...
...
modules/gapi/src/backends/cpu/gcpucore.cpp
浏览文件 @
719059f6
...
@@ -652,7 +652,12 @@ GAPI_OCV_KERNEL(GCPUParseSSDBL, cv::gapi::nn::parsers::GParseSSDBL)
...
@@ -652,7 +652,12 @@ GAPI_OCV_KERNEL(GCPUParseSSDBL, cv::gapi::nn::parsers::GParseSSDBL)
std
::
vector
<
cv
::
Rect
>&
out_boxes
,
std
::
vector
<
cv
::
Rect
>&
out_boxes
,
std
::
vector
<
int
>&
out_labels
)
std
::
vector
<
int
>&
out_labels
)
{
{
cv
::
parseSSDBL
(
in_ssd_result
,
in_size
,
confidence_threshold
,
filter_label
,
out_boxes
,
out_labels
);
cv
::
ParseSSD
(
in_ssd_result
,
in_size
,
confidence_threshold
,
filter_label
,
false
,
false
,
out_boxes
,
out_labels
);
}
}
};
};
...
@@ -665,7 +670,13 @@ GAPI_OCV_KERNEL(GOCVParseSSD, cv::gapi::nn::parsers::GParseSSD)
...
@@ -665,7 +670,13 @@ GAPI_OCV_KERNEL(GOCVParseSSD, cv::gapi::nn::parsers::GParseSSD)
const
bool
filter_out_of_bounds
,
const
bool
filter_out_of_bounds
,
std
::
vector
<
cv
::
Rect
>&
out_boxes
)
std
::
vector
<
cv
::
Rect
>&
out_boxes
)
{
{
cv
::
parseSSD
(
in_ssd_result
,
in_size
,
confidence_threshold
,
alignment_to_square
,
filter_out_of_bounds
,
out_boxes
);
std
::
vector
<
int
>
unused_labels
;
cv
::
ParseSSD
(
in_ssd_result
,
in_size
,
confidence_threshold
,
-
1
,
alignment_to_square
,
filter_out_of_bounds
,
out_boxes
,
unused_labels
);
}
}
};
};
...
...
modules/gapi/src/backends/cpu/gnnparsers.cpp
浏览文件 @
719059f6
...
@@ -170,48 +170,18 @@ private:
...
@@ -170,48 +170,18 @@ private:
}
// namespace nn
}
// namespace nn
}
// namespace gapi
}
// namespace gapi
void
parseSSDBL
(
const
cv
::
Mat
&
in_ssd_result
,
void
ParseSSD
(
const
cv
::
Mat
&
in_ssd_result
,
const
cv
::
Size
&
in_size
,
const
float
confidence_threshold
,
const
int
filter_label
,
std
::
vector
<
cv
::
Rect
>&
out_boxes
,
std
::
vector
<
int
>&
out_labels
)
{
cv
::
gapi
::
nn
::
SSDParser
parser
(
in_ssd_result
.
size
,
in_size
,
in_ssd_result
.
ptr
<
float
>
());
out_boxes
.
clear
();
out_labels
.
clear
();
cv
::
Rect
rc
;
float
image_id
,
confidence
;
int
label
;
const
size_t
range
=
parser
.
getMaxProposals
();
for
(
size_t
i
=
0
;
i
<
range
;
++
i
)
{
std
::
tie
(
rc
,
image_id
,
confidence
,
label
)
=
parser
.
extract
(
i
);
if
(
image_id
<
0.
f
)
{
break
;
// marks end-of-detections
}
if
(
confidence
<
confidence_threshold
||
(
filter_label
!=
-
1
&&
label
!=
filter_label
))
{
continue
;
// filter out object classes if filter is specified
}
// and skip objects with low confidence
out_boxes
.
emplace_back
(
rc
&
parser
.
getSurface
());
out_labels
.
emplace_back
(
label
);
}
}
void
parseSSD
(
const
cv
::
Mat
&
in_ssd_result
,
const
cv
::
Size
&
in_size
,
const
cv
::
Size
&
in_size
,
const
float
confidence_threshold
,
const
float
confidence_threshold
,
const
int
filter_label
,
const
bool
alignment_to_square
,
const
bool
alignment_to_square
,
const
bool
filter_out_of_bounds
,
const
bool
filter_out_of_bounds
,
std
::
vector
<
cv
::
Rect
>&
out_boxes
)
std
::
vector
<
cv
::
Rect
>&
out_boxes
,
std
::
vector
<
int
>&
out_labels
)
{
{
cv
::
gapi
::
nn
::
SSDParser
parser
(
in_ssd_result
.
size
,
in_size
,
in_ssd_result
.
ptr
<
float
>
());
cv
::
gapi
::
nn
::
SSDParser
parser
(
in_ssd_result
.
size
,
in_size
,
in_ssd_result
.
ptr
<
float
>
());
out_boxes
.
clear
();
out_boxes
.
clear
();
out_labels
.
clear
();
cv
::
Rect
rc
;
cv
::
Rect
rc
;
float
image_id
,
confidence
;
float
image_id
,
confidence
;
int
label
;
int
label
;
...
@@ -228,12 +198,14 @@ void parseSSD(const cv::Mat& in_ssd_result,
...
@@ -228,12 +198,14 @@ void parseSSD(const cv::Mat& in_ssd_result,
{
{
continue
;
// skip objects with low confidence
continue
;
// skip objects with low confidence
}
}
if
((
filter_label
!=
-
1
)
&&
(
label
!=
filter_label
))
{
continue
;
// filter out object classes if filter is specified
}
if
(
alignment_to_square
)
if
(
alignment_to_square
)
{
{
parser
.
adjustBoundingBox
(
rc
);
parser
.
adjustBoundingBox
(
rc
);
}
}
const
auto
clipped_rc
=
rc
&
parser
.
getSurface
();
const
auto
clipped_rc
=
rc
&
parser
.
getSurface
();
if
(
filter_out_of_bounds
)
if
(
filter_out_of_bounds
)
{
{
...
@@ -243,6 +215,7 @@ void parseSSD(const cv::Mat& in_ssd_result,
...
@@ -243,6 +215,7 @@ void parseSSD(const cv::Mat& in_ssd_result,
}
}
}
}
out_boxes
.
emplace_back
(
clipped_rc
);
out_boxes
.
emplace_back
(
clipped_rc
);
out_labels
.
emplace_back
(
label
);
}
}
}
}
...
...
modules/gapi/src/backends/cpu/gnnparsers.hpp
浏览文件 @
719059f6
...
@@ -11,19 +11,14 @@
...
@@ -11,19 +11,14 @@
namespace
cv
namespace
cv
{
{
void
parseSSDBL
(
const
cv
::
Mat
&
in_ssd_result
,
void
ParseSSD
(
const
cv
::
Mat
&
in_ssd_result
,
const
cv
::
Size
&
in_size
,
const
float
confidence_threshold
,
const
int
filter_label
,
std
::
vector
<
cv
::
Rect
>&
out_boxes
,
std
::
vector
<
int
>&
out_labels
);
void
parseSSD
(
const
cv
::
Mat
&
in_ssd_result
,
const
cv
::
Size
&
in_size
,
const
cv
::
Size
&
in_size
,
const
float
confidence_threshold
,
const
float
confidence_threshold
,
const
int
filter_label
,
const
bool
alignment_to_square
,
const
bool
alignment_to_square
,
const
bool
filter_out_of_bounds
,
const
bool
filter_out_of_bounds
,
std
::
vector
<
cv
::
Rect
>&
out_boxes
);
std
::
vector
<
cv
::
Rect
>&
out_boxes
,
std
::
vector
<
int
>&
out_labels
);
void
parseYolo
(
const
cv
::
Mat
&
in_yolo_result
,
void
parseYolo
(
const
cv
::
Mat
&
in_yolo_result
,
const
cv
::
Size
&
in_size
,
const
cv
::
Size
&
in_size
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录