Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
939a35d6
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看板
提交
939a35d6
编写于
5月 26, 2022
作者:
Z
zhiboniu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more details
上级
a4e1da66
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
9 deletion
+25
-9
deploy/configs/inference_attr.yaml
deploy/configs/inference_attr.yaml
+3
-3
deploy/python/postprocess.py
deploy/python/postprocess.py
+17
-3
deploy/python/predict_cls.py
deploy/python/predict_cls.py
+4
-3
ppcls/metric/metrics.py
ppcls/metric/metrics.py
+1
-0
未找到文件。
deploy/configs/inference_attr.yaml
浏览文件 @
939a35d6
...
...
@@ -27,7 +27,7 @@ PreProcess:
PostProcess
:
main_indicator
:
Attribute
Attribute
:
threshold
:
0.5
glasses_threshold
:
0.3
hold_threshold
:
0.6
threshold
:
0.5
#default threshold
glasses_threshold
:
0.3
#threshold only for glasses
hold_threshold
:
0.6
#threshold only for hold
\ No newline at end of file
deploy/python/postprocess.py
浏览文件 @
939a35d6
...
...
@@ -64,9 +64,17 @@ class ThreshOutput(object):
for
idx
,
probs
in
enumerate
(
x
):
score
=
probs
[
1
]
if
score
<
self
.
threshold
:
result
=
{
"class_ids"
:
[
0
],
"scores"
:
[
1
-
score
],
"label_names"
:
[
self
.
label_0
]}
result
=
{
"class_ids"
:
[
0
],
"scores"
:
[
1
-
score
],
"label_names"
:
[
self
.
label_0
]
}
else
:
result
=
{
"class_ids"
:
[
1
],
"scores"
:
[
score
],
"label_names"
:
[
self
.
label_1
]}
result
=
{
"class_ids"
:
[
1
],
"scores"
:
[
score
],
"label_names"
:
[
self
.
label_1
]
}
if
file_names
is
not
None
:
result
[
"file_name"
]
=
file_names
[
idx
]
y
.
append
(
result
)
...
...
@@ -264,5 +272,11 @@ class Attribute(object):
shoe
=
'Boots'
if
res
[
14
]
>
self
.
threshold
else
'No boots'
label_res
.
append
(
shoe
)
batch_res
.
append
(
label_res
)
threshold_list
=
[
0.5
]
*
len
(
res
)
threshold_list
[
1
]
=
self
.
glasses_threshold
threshold_list
[
18
]
=
self
.
hold_threshold
pred_res
=
(
np
.
array
(
res
)
>
np
.
array
(
threshold_list
)
).
astype
(
np
.
int8
).
tolist
()
batch_res
.
append
([
label_res
,
pred_res
])
return
batch_res
deploy/python/predict_cls.py
浏览文件 @
939a35d6
...
...
@@ -140,9 +140,10 @@ def main(config):
for
number
,
result_dict
in
enumerate
(
batch_results
):
if
"Attribute"
in
config
[
"PostProcess"
]:
filename
=
batch_names
[
number
]
attr_message
=
result_dict
print
(
"{}:
\t
class id(s): {}"
.
format
(
filename
,
attr_message
))
attr_message
=
result_dict
[
0
]
pred_res
=
result_dict
[
1
]
print
(
"{}:
\t
attributes: {},
\n
predict output: {}"
.
format
(
filename
,
attr_message
,
pred_res
))
else
:
filename
=
batch_names
[
number
]
clas_ids
=
result_dict
[
"class_ids"
]
...
...
ppcls/metric/metrics.py
浏览文件 @
939a35d6
...
...
@@ -391,6 +391,7 @@ class AccuracyScore(MultiLabelMetric):
def
get_attr_metrics
(
gt_label
,
preds_probs
,
threshold
):
"""
index: evaluated label index
adapted from "https://github.com/valencebond/Rethinking_of_PAR/blob/master/metrics/pedestrian_metrics.py"
"""
pred_label
=
(
preds_probs
>
threshold
).
astype
(
int
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录