Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
01486ec1
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看板
未验证
提交
01486ec1
编写于
4月 27, 2020
作者:
D
dyning
提交者:
GitHub
4月 27, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #81 from shippingwang/refine_1
refine log format
上级
e3f56640
3197c82c
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
20 addition
and
15 deletion
+20
-15
ppcls/utils/misc.py
ppcls/utils/misc.py
+4
-4
requirements.txt
requirements.txt
+1
-0
tools/eval.py
tools/eval.py
+1
-1
tools/infer/predict.py
tools/infer/predict.py
+0
-4
tools/program.py
tools/program.py
+14
-6
未找到文件。
ppcls/utils/misc.py
浏览文件 @
01486ec1
...
@@ -42,18 +42,18 @@ class AverageMeter(object):
...
@@ -42,18 +42,18 @@ class AverageMeter(object):
@
property
@
property
def
total
(
self
):
def
total
(
self
):
return
'
[{self.name}_sum: {self.sum:{self.fmt}}]
'
.
format
(
self
=
self
)
return
'
{self.name}_sum: {self.sum:{self.fmt}}
'
.
format
(
self
=
self
)
@
property
@
property
def
total_minute
(
self
):
def
total_minute
(
self
):
return
'
[{self.name}_sum: {s:{self.fmt}} min]
'
.
format
(
return
'
{self.name}_sum: {s:{self.fmt}} min
'
.
format
(
s
=
self
.
sum
/
60
,
self
=
self
)
s
=
self
.
sum
/
60
,
self
=
self
)
@
property
@
property
def
mean
(
self
):
def
mean
(
self
):
return
'
[{self.name}_avg: {self.avg:{self.fmt}}]
'
.
format
(
return
'
{self.name}_avg: {self.avg:{self.fmt}}
'
.
format
(
self
=
self
)
if
self
.
need_avg
else
''
self
=
self
)
if
self
.
need_avg
else
''
@
property
@
property
def
value
(
self
):
def
value
(
self
):
return
'
[{self.name}: {self.val:{self.fmt}}]
'
.
format
(
self
=
self
)
return
'
{self.name}: {self.val:{self.fmt}}
'
.
format
(
self
=
self
)
requirements.txt
浏览文件 @
01486ec1
ujson
opencv-python
opencv-python
pillow
pillow
tqdm
tqdm
...
...
tools/eval.py
浏览文件 @
01486ec1
...
@@ -73,7 +73,7 @@ def main(args):
...
@@ -73,7 +73,7 @@ def main(args):
valid_dataloader
.
set_sample_list_generator
(
valid_reader
,
place
)
valid_dataloader
.
set_sample_list_generator
(
valid_reader
,
place
)
compiled_valid_prog
=
program
.
compile
(
config
,
valid_prog
)
compiled_valid_prog
=
program
.
compile
(
config
,
valid_prog
)
program
.
run
(
valid_dataloader
,
exe
,
compiled_valid_prog
,
valid_fetchs
,
0
,
program
.
run
(
valid_dataloader
,
exe
,
compiled_valid_prog
,
valid_fetchs
,
-
1
,
'valid'
)
'valid'
)
...
...
tools/infer/predict.py
浏览文件 @
01486ec1
...
@@ -145,10 +145,6 @@ def main():
...
@@ -145,10 +145,6 @@ def main():
output
=
output
.
flatten
()
output
=
output
.
flatten
()
if
i
>=
10
:
if
i
>=
10
:
test_time
+=
time
.
time
()
-
start_time
test_time
+=
time
.
time
()
-
start_time
cls
=
np
.
argmax
(
output
)
score
=
output
[
cls
]
logger
.
info
(
"class: {0}"
.
format
(
cls
))
logger
.
info
(
"score: {0}"
.
format
(
score
))
fp_message
=
"FP16"
if
args
.
use_fp16
else
"FP32"
fp_message
=
"FP16"
if
args
.
use_fp16
else
"FP32"
logger
.
info
(
"{0}
\t
{1}
\t
batch size: {2}
\t
time(ms): {3}"
.
format
(
logger
.
info
(
"{0}
\t
{1}
\t
batch size: {2}
\t
time(ms): {3}"
.
format
(
...
...
tools/program.py
浏览文件 @
01486ec1
...
@@ -375,7 +375,7 @@ def run(dataloader, exe, program, fetchs, epoch=0, mode='train'):
...
@@ -375,7 +375,7 @@ def run(dataloader, exe, program, fetchs, epoch=0, mode='train'):
metric_list
=
[
f
[
1
]
for
f
in
fetchs
.
values
()]
metric_list
=
[
f
[
1
]
for
f
in
fetchs
.
values
()]
for
m
in
metric_list
:
for
m
in
metric_list
:
m
.
reset
()
m
.
reset
()
batch_time
=
AverageMeter
(
'
cost
'
,
'.3f'
)
batch_time
=
AverageMeter
(
'
elapse
'
,
'.3f'
)
tic
=
time
.
time
()
tic
=
time
.
time
()
for
idx
,
batch
in
enumerate
(
dataloader
()):
for
idx
,
batch
in
enumerate
(
dataloader
()):
metrics
=
exe
.
run
(
program
=
program
,
feed
=
batch
,
fetch_list
=
fetch_list
)
metrics
=
exe
.
run
(
program
=
program
,
feed
=
batch
,
fetch_list
=
fetch_list
)
...
@@ -383,9 +383,17 @@ def run(dataloader, exe, program, fetchs, epoch=0, mode='train'):
...
@@ -383,9 +383,17 @@ def run(dataloader, exe, program, fetchs, epoch=0, mode='train'):
tic
=
time
.
time
()
tic
=
time
.
time
()
for
i
,
m
in
enumerate
(
metrics
):
for
i
,
m
in
enumerate
(
metrics
):
metric_list
[
i
].
update
(
m
[
0
],
len
(
batch
[
0
]))
metric_list
[
i
].
update
(
m
[
0
],
len
(
batch
[
0
]))
fetchs_str
=
''
.
join
([
m
.
value
fetchs_str
=
''
.
join
([
str
(
m
.
value
)
+
' '
for
m
in
metric_list
]
+
[
batch_time
.
value
])
for
m
in
metric_list
]
+
[
batch_time
.
value
])
logger
.
info
(
"[epoch:{:3d}][{:s}][step:{:4d}]{:s}"
.
format
(
if
epoch
!=
-
1
:
logger
.
info
(
"epoch:{:<3d} {:s} step:{:<4d} {:s}s"
.
format
(
epoch
,
mode
,
idx
,
fetchs_str
))
epoch
,
mode
,
idx
,
fetchs_str
))
end_str
=
''
.
join
([
m
.
mean
for
m
in
metric_list
]
+
[
batch_time
.
total
])
else
:
logger
.
info
(
"END [epoch:{:3d}][{:s}]{:s}"
.
format
(
epoch
,
mode
,
end_str
))
logger
.
info
(
"{:s} step:{:<4d} {:s}s"
.
format
(
mode
,
idx
,
fetchs_str
))
end_str
=
''
.
join
([
str
(
m
.
mean
)
+
' '
for
m
in
metric_list
]
+
[
batch_time
.
total
])
if
epoch
!=
-
1
:
logger
.
info
(
"END epoch:{:<3d} {:s} {:s}s"
.
format
(
epoch
,
mode
,
end_str
))
else
:
logger
.
info
(
"END {:s} {:s}s"
.
format
(
mode
,
end_str
))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录