Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
16968200
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
接近 2 年 前同步成功
通知
116
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看板
提交
16968200
编写于
12月 26, 2022
作者:
weixin_46524038
提交者:
cuicheng01
12月 28, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Some modifications
上级
7badd5bf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
16 deletion
+15
-16
deploy/python/postprocess.py
deploy/python/postprocess.py
+1
-4
ppcls/data/postprocess/attr_rec.py
ppcls/data/postprocess/attr_rec.py
+1
-6
ppcls/metric/metrics.py
ppcls/metric/metrics.py
+13
-6
未找到文件。
deploy/python/postprocess.py
浏览文件 @
16968200
...
...
@@ -374,10 +374,7 @@ class FaceAttribute(object):
gender_list
=
[[
"Male"
,
"男性"
],
[
"Female"
,
"女性"
]]
age_list
=
[[
"Young"
,
"年轻人"
],
[
"Old"
,
"老年人"
]]
batch_res
=
[]
if
self
.
convert_cn
:
index
=
1
else
:
index
=
0
index
=
1
if
self
.
convert_cn
else
0
for
idx
,
res
in
enumerate
(
x
):
res
=
res
.
tolist
()
label_res
=
[]
...
...
ppcls/data/postprocess/attr_rec.py
浏览文件 @
16968200
...
...
@@ -84,7 +84,6 @@ class PersonAttribute(object):
if
isinstance
(
x
,
dict
):
x
=
x
[
'logits'
]
assert
isinstance
(
x
,
paddle
.
Tensor
)
if
file_names
is
not
None
:
assert
x
.
shape
[
0
]
==
len
(
file_names
)
x
=
F
.
sigmoid
(
x
).
numpy
()
...
...
@@ -99,7 +98,6 @@ class PersonAttribute(object):
'Skirt&Dress'
]
batch_res
=
[]
for
idx
,
res
in
enumerate
(
x
):
res
=
res
.
tolist
()
label_res
=
[]
...
...
@@ -209,10 +207,7 @@ class FaceAttribute(object):
gender_list
=
[[
"Male"
,
"男性"
],
[
"Female"
,
"女性"
]]
age_list
=
[[
"Young"
,
"年轻人"
],
[
"Old"
,
"老年人"
]]
batch_res
=
[]
if
self
.
convert_cn
:
index
=
1
else
:
index
=
0
index
=
1
if
self
.
convert_cn
else
0
for
idx
,
res
in
enumerate
(
x
):
res
=
res
.
tolist
()
label_res
=
[]
...
...
ppcls/metric/metrics.py
浏览文件 @
16968200
...
...
@@ -219,12 +219,17 @@ class TprAtFpr(nn.Layer):
class
MultilabelMeanAccuracy
(
nn
.
Layer
):
def
__init__
(
self
,
class_num
=
40
):
def
__init__
(
self
,
start_threshold
=
0.4
,
num_iterations
=
10
,
end_threshold
=
0.9
):
super
().
__init__
()
self
.
start_threshold
=
start_threshold
self
.
num_iterations
=
num_iterations
self
.
end_threshold
=
end_threshold
self
.
gt_all_score_list
=
[]
self
.
gt_label_score_list
=
[]
self
.
max_acc
=
0.
self
.
class_num
=
class_num
def
forward
(
self
,
x
,
label
):
if
isinstance
(
x
,
dict
):
...
...
@@ -251,8 +256,10 @@ class MultilabelMeanAccuracy(nn.Layer):
result
=
""
gt_all_score_list
=
np
.
array
(
self
.
gt_all_score_list
)
gt_label_score_list
=
np
.
array
(
self
.
gt_label_score_list
)
for
i
in
range
(
10
):
threshold
=
0.4
+
i
*
0.05
for
i
in
range
(
self
.
num_iterations
):
threshold
=
self
.
start_threshold
+
i
*
(
self
.
end_threshold
-
self
.
start_threshold
)
/
self
.
num_iterations
pred_label
=
(
gt_all_score_list
>
threshold
).
astype
(
int
)
TP
=
np
.
sum
(
(
gt_label_score_list
==
1
)
*
(
pred_label
==
1
)).
astype
(
float
)
...
...
@@ -262,8 +269,8 @@ class MultilabelMeanAccuracy(nn.Layer):
if
max_acc
<=
acc
:
max_acc
=
acc
result
=
"threshold: {}, mean_acc: {}"
.
format
(
threshold
,
max_acc
/
self
.
class_num
)
self
.
max_acc
=
max_acc
/
self
.
class_num
threshold
,
max_acc
/
len
(
gt_label_score_list
[
0
])
)
self
.
max_acc
=
max_acc
/
len
(
gt_label_score_list
[
0
])
return
result
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录