Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
508cea54
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
大约 1 年 前同步成功
通知
115
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
508cea54
编写于
6月 20, 2021
作者:
D
dyning
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug for rec nms
上级
e1f13ed9
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
13 addition
and
14 deletion
+13
-14
deploy/configs/inference_cartoon.yaml
deploy/configs/inference_cartoon.yaml
+1
-1
deploy/configs/inference_logo.yaml
deploy/configs/inference_logo.yaml
+1
-1
deploy/configs/inference_product.yaml
deploy/configs/inference_product.yaml
+1
-1
deploy/configs/inference_vehicle.yaml
deploy/configs/inference_vehicle.yaml
+1
-1
deploy/python/predict_system.py
deploy/python/predict_system.py
+3
-6
deploy/utils/draw_bbox.py
deploy/utils/draw_bbox.py
+6
-4
未找到文件。
deploy/configs/inference_cartoon.yaml
浏览文件 @
508cea54
...
...
@@ -2,7 +2,7 @@ Global:
infer_imgs
:
"
./recognition_demo_data_v1.0/test_cartoon"
det_inference_model_dir
:
"
./models/ppyolov2_r50vd_dcn_mainbody_v1.0_infer/"
rec_inference_model_dir
:
"
./models/cartoon_rec_ResNet50_iCartoon_v1.0_infer/"
rec_nms_thresold
:
0.
1
rec_nms_thresold
:
0.
05
batch_size
:
1
image_shape
:
[
3
,
640
,
640
]
...
...
deploy/configs/inference_logo.yaml
浏览文件 @
508cea54
...
...
@@ -2,7 +2,7 @@ Global:
infer_imgs
:
"
./recognition_demo_data_v1.0/gallery/test_logo"
det_inference_model_dir
:
"
./models/ppyolov2_r50vd_dcn_mainbody_v1.0_infer/"
rec_inference_model_dir
:
"
./models/logo_rec_ResNet50_Logo3K_v1.0_infer/"
rec_nms_thresold
:
0.
3
rec_nms_thresold
:
0.
05
batch_size
:
1
image_shape
:
[
3
,
640
,
640
]
...
...
deploy/configs/inference_product.yaml
浏览文件 @
508cea54
...
...
@@ -2,7 +2,7 @@ Global:
infer_imgs
:
"
./recognition_demo_data_v1.0/test_product/daoxiangcunjinzhubing_6.jpg"
det_inference_model_dir
:
"
./models/ppyolov2_r50vd_dcn_mainbody_v1.0_infer"
rec_inference_model_dir
:
"
./models/product_ResNet50_vd_aliproduct_v1.0_infer"
rec_nms_thresold
:
0.
3
rec_nms_thresold
:
0.
05
batch_size
:
1
image_shape
:
[
3
,
640
,
640
]
...
...
deploy/configs/inference_vehicle.yaml
浏览文件 @
508cea54
...
...
@@ -2,7 +2,7 @@ Global:
infer_imgs
:
"
./recognition_demo_data_v1.0/test_vehicle/"
det_inference_model_dir
:
"
./models/ppyolov2_r50vd_dcn_mainbody_v1.0_infer/"
rec_inference_model_dir
:
"
./models/vehicle_cls_ResNet50_CompCars_v1.0_infer/"
rec_nms_thresold
:
0.
3
rec_nms_thresold
:
0.
05
batch_size
:
1
image_shape
:
[
3
,
640
,
640
]
...
...
deploy/python/predict_system.py
浏览文件 @
508cea54
...
...
@@ -56,7 +56,7 @@ class SystemPredictor(object):
})
return
results
def
nms_to_rec_results
(
self
,
results
,
thresh
=
0.
3
):
def
nms_to_rec_results
(
self
,
results
,
thresh
=
0.
1
):
filtered_results
=
[]
x1
=
np
.
array
([
r
[
"bbox"
][
0
]
for
r
in
results
]).
astype
(
"float32"
)
y1
=
np
.
array
([
r
[
"bbox"
][
1
]
for
r
in
results
]).
astype
(
"float32"
)
...
...
@@ -66,22 +66,19 @@ class SystemPredictor(object):
areas
=
(
x2
-
x1
+
1
)
*
(
y2
-
y1
+
1
)
order
=
scores
.
argsort
()[::
-
1
]
while
order
.
size
>
0
:
i
=
order
[
0
]
xx1
=
np
.
maximum
(
x1
[
i
],
x1
[
order
[
1
:]])
yy1
=
np
.
m
in
imum
(
y1
[
i
],
y1
[
order
[
1
:]])
yy1
=
np
.
m
ax
imum
(
y1
[
i
],
y1
[
order
[
1
:]])
xx2
=
np
.
minimum
(
x2
[
i
],
x2
[
order
[
1
:]])
yy2
=
np
.
m
ax
imum
(
y2
[
i
],
y2
[
order
[
1
:]])
yy2
=
np
.
m
in
imum
(
y2
[
i
],
y2
[
order
[
1
:]])
w
=
np
.
maximum
(
0.0
,
xx2
-
xx1
+
1
)
h
=
np
.
maximum
(
0.0
,
yy2
-
yy1
+
1
)
inter
=
w
*
h
ovr
=
inter
/
(
areas
[
i
]
+
areas
[
order
[
1
:]]
-
inter
)
inds
=
np
.
where
(
ovr
<=
thresh
)[
0
]
order
=
order
[
inds
+
1
]
filtered_results
.
append
(
results
[
i
])
return
filtered_results
...
...
deploy/utils/draw_bbox.py
浏览文件 @
508cea54
...
...
@@ -28,7 +28,8 @@ def draw_bbox_results(image,
draw
=
ImageDraw
.
Draw
(
image
)
font
=
ImageFont
.
truetype
(
font_path
,
20
,
encoding
=
"utf-8"
)
color
=
(
0
,
255
,
0
)
# color = (0, 255, 0)
color
=
(
0
,
102
,
255
)
for
result
in
results
:
# empty results
...
...
@@ -40,9 +41,10 @@ def draw_bbox_results(image,
th
=
20
tw
=
int
(
len
(
result
[
"rec_docs"
])
*
20
)
+
60
start_y
=
max
(
0
,
ymin
-
th
)
draw
.
rectangle
(
[(
xmin
+
1
,
start_y
),
(
xmin
+
tw
+
1
,
start_y
+
th
)],
outline
=
color
)
# draw.rectangle(
# [(xmin + 1, start_y), (xmin + tw + 1, start_y + th)],
# outline=color)
draw
.
text
((
xmin
+
1
,
start_y
),
text
,
fill
=
color
,
font
=
font
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录