Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
06c15e76
P
PaddleOCR
项目概览
weixin_41840029
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
06c15e76
编写于
4月 21, 2021
作者:
B
buptlihang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add PolygonScoreAcc to improve polygon detect
上级
63221916
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
0 deletion
+36
-0
deploy/cpp_infer/include/postprocess_op.h
deploy/cpp_infer/include/postprocess_op.h
+1
-0
deploy/cpp_infer/src/postprocess_op.cpp
deploy/cpp_infer/src/postprocess_op.cpp
+35
-0
未找到文件。
deploy/cpp_infer/include/postprocess_op.h
浏览文件 @
06c15e76
...
...
@@ -51,6 +51,7 @@ public:
float
&
ssid
);
float
BoxScoreFast
(
std
::
vector
<
std
::
vector
<
float
>>
box_array
,
cv
::
Mat
pred
);
float
PolygonScoreAcc
(
std
::
vector
<
cv
::
Point
>
contour
,
cv
::
Mat
pred
);
std
::
vector
<
std
::
vector
<
std
::
vector
<
int
>>>
BoxesFromBitmap
(
const
cv
::
Mat
pred
,
const
cv
::
Mat
bitmap
,
...
...
deploy/cpp_infer/src/postprocess_op.cpp
浏览文件 @
06c15e76
...
...
@@ -159,6 +159,39 @@ std::vector<std::vector<float>> PostProcessor::GetMiniBoxes(cv::RotatedRect box,
return
array
;
}
float
PostProcessor
::
PolygonScoreAcc
(
std
::
vector
<
cv
::
Point
>
contour
,
cv
::
Mat
pred
){
int
width
=
pred
.
cols
;
int
height
=
pred
.
rows
;
std
::
vector
<
float
>
box_x
;
std
::
vector
<
float
>
box_y
;
for
(
int
i
=
0
;
i
<
contour
.
size
();
++
i
){
box_x
.
push_back
(
contour
[
i
].
x
);
box_y
.
push_back
(
contour
[
i
].
y
);
}
int
xmin
=
std
::
clamp
(
int
(
std
::
floor
(
*
(
std
::
min_element
(
box_x
.
begin
(),
box_x
.
end
())))),
0
,
width
-
1
);
int
xmax
=
std
::
clamp
(
int
(
std
::
ceil
(
*
(
std
::
max_element
(
box_x
.
begin
(),
box_x
.
end
())))),
0
,
width
-
1
);
int
ymin
=
std
::
clamp
(
int
(
std
::
floor
(
*
(
std
::
min_element
(
box_y
.
begin
(),
box_y
.
end
())))),
0
,
height
-
1
);
int
ymax
=
std
::
clamp
(
int
(
std
::
ceil
(
*
(
std
::
max_element
(
box_y
.
begin
(),
box_y
.
end
())))),
0
,
height
-
1
);
cv
::
Mat
mask
;
mask
=
cv
::
Mat
::
zeros
(
ymax
-
ymin
+
1
,
xmax
-
xmin
+
1
,
CV_8UC1
);
cv
::
Point
rook_point
[
contour
.
size
()];
for
(
int
i
=
0
;
i
<
contour
.
size
();
++
i
){
rook_point
[
i
]
=
cv
::
Point
(
int
(
box_x
[
i
])
-
xmin
,
int
(
box_y
[
i
])
-
ymin
);
}
const
cv
::
Point
*
ppt
[
1
]
=
{
rook_point
};
int
npt
[]
=
{
int
(
contour
.
size
())};
cv
::
fillPoly
(
mask
,
ppt
,
npt
,
1
,
cv
::
Scalar
(
1
));
cv
::
Mat
croppedImg
;
pred
(
cv
::
Rect
(
xmin
,
ymin
,
xmax
-
xmin
+
1
,
ymax
-
ymin
+
1
)).
copyTo
(
croppedImg
);
float
score
=
cv
::
mean
(
croppedImg
,
mask
)[
0
];
return
score
;
}
float
PostProcessor
::
BoxScoreFast
(
std
::
vector
<
std
::
vector
<
float
>>
box_array
,
cv
::
Mat
pred
)
{
auto
array
=
box_array
;
...
...
@@ -235,6 +268,8 @@ PostProcessor::BoxesFromBitmap(const cv::Mat pred, const cv::Mat bitmap,
float
score
;
score
=
BoxScoreFast
(
array
,
pred
);
/* compute using polygon*/
// score = PolygonScoreAcc(contours[_i], pred);
if
(
score
<
box_thresh
)
continue
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录