Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
15b18973
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看板
未验证
提交
15b18973
编写于
12月 10, 2020
作者:
L
littletomatodonkey
提交者:
GitHub
12月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix eval script (#464)
* fix eval script * fix dali shell
上级
e3801c55
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
30 addition
and
18 deletion
+30
-18
ppcls/modeling/architectures/hrnet.py
ppcls/modeling/architectures/hrnet.py
+2
-1
ppcls/modeling/architectures/resnest.py
ppcls/modeling/architectures/resnest.py
+1
-0
ppcls/utils/misc.py
ppcls/utils/misc.py
+2
-2
tools/eval.py
tools/eval.py
+3
-3
tools/eval.sh
tools/eval.sh
+5
-5
tools/program.py
tools/program.py
+11
-2
tools/run.sh
tools/run.sh
+2
-2
tools/static/run_dali.sh
tools/static/run_dali.sh
+1
-1
tools/train.py
tools/train.py
+3
-2
未找到文件。
ppcls/modeling/architectures/hrnet.py
浏览文件 @
15b18973
...
...
@@ -179,7 +179,8 @@ class Branches(nn.Layer):
outs
=
[]
for
idx
,
input
in
enumerate
(
inputs
):
conv
=
input
for
basic_block_func
in
self
.
basic_block_list
[
idx
]:
basic_block_list
=
self
.
basic_block_list
[
idx
]
for
basic_block_func
in
basic_block_list
:
conv
=
basic_block_func
(
conv
)
outs
.
append
(
conv
)
return
outs
...
...
ppcls/modeling/architectures/resnest.py
浏览文件 @
15b18973
...
...
@@ -165,6 +165,7 @@ class SplatConv(nn.Layer):
atten
=
self
.
conv3
(
gap
)
atten
=
self
.
rsoftmax
(
atten
)
atten
=
paddle
.
reshape
(
x
=
atten
,
shape
=
[
-
1
,
atten
.
shape
[
1
],
1
,
1
])
if
self
.
radix
>
1
:
attens
=
paddle
.
split
(
atten
,
num_or_sections
=
self
.
radix
,
axis
=
1
)
...
...
ppcls/utils/misc.py
浏览文件 @
15b18973
...
...
@@ -48,12 +48,12 @@ class AverageMeter(object):
@
property
def
total_minute
(
self
):
return
'{self.name}
_sum:
{s:{self.fmt}}{self.postfix} min'
.
format
(
return
'{self.name} {s:{self.fmt}}{self.postfix} min'
.
format
(
s
=
self
.
sum
/
60
,
self
=
self
)
@
property
def
mean
(
self
):
return
'{self.name}
_avg
: {self.avg:{self.fmt}}{self.postfix}'
.
format
(
return
'{self.name}: {self.avg:{self.fmt}}{self.postfix}'
.
format
(
self
=
self
)
if
self
.
need_avg
else
''
@
property
...
...
tools/eval.py
浏览文件 @
15b18973
...
...
@@ -67,7 +67,7 @@ def main(args, return_dict={}):
init_model
(
config
,
net
,
optimizer
=
None
)
valid_dataloader
=
Reader
(
config
,
'valid'
,
places
=
place
)()
net
.
eval
()
with
paddle
.
no_grad
():
top1_acc
=
program
.
run
(
valid_dataloader
,
config
,
net
,
None
,
None
,
0
,
'valid'
)
return_dict
[
"top1_acc"
]
=
top1_acc
...
...
tools/eval.sh
浏览文件 @
15b18973
python
-m
paddle.distributed.launch
\
--
selected_gpus
=
"0
"
\
python
3.7
-m
paddle.distributed.launch
\
--
gpus
=
"0,1,2,3
"
\
tools/eval.py
\
-c
./configs/
eval
.yaml
\
-o
load_static_weights
=
True
\
-o
use_gpu
=
Fals
e
-c
./configs/
ResNet/ResNet50
.yaml
\
-o
pretrained_model
=
"./ResNet50_pretrained"
\
-o
use_gpu
=
Tru
e
tools/program.py
浏览文件 @
15b18973
...
...
@@ -298,6 +298,11 @@ def run(dataloader,
tic
=
time
.
time
()
for
idx
,
batch
in
enumerate
(
dataloader
()):
# avoid statistics from warmup time
if
idx
==
10
:
metric_list
[
"batch_time"
].
reset
()
metric_list
[
"reader_time"
].
reset
()
metric_list
[
'reader_time'
].
update
(
time
.
time
()
-
tic
)
batch_size
=
len
(
batch
[
0
])
feeds
=
create_feeds
(
batch
,
use_mix
)
...
...
@@ -327,11 +332,15 @@ def run(dataloader,
metric_list
[
"batch_time"
].
update
(
time
.
time
()
-
tic
)
tic
=
time
.
time
()
fetchs_str
=
' '
.
join
([
str
(
m
.
value
)
for
m
in
metric_list
.
values
()])
fetchs_str
=
' '
.
join
([
str
(
metric_list
[
key
].
mean
)
if
"time"
in
key
else
str
(
metric_list
[
key
].
value
)
for
key
in
metric_list
])
if
idx
%
print_interval
==
0
:
ips_info
=
"ips: {:.5f} images/sec."
.
format
(
batch_size
/
metric_list
[
"batch_time"
].
val
)
batch_size
/
metric_list
[
"batch_time"
].
avg
)
if
mode
==
'eval'
:
logger
.
info
(
"{:s} step:{:<4d}, {:s} {:s}"
.
format
(
mode
,
idx
,
fetchs_str
,
ips_info
))
...
...
tools/run.sh
浏览文件 @
15b18973
#!/usr/bin/env bash
python
-m
paddle.distributed.launch
\
--
selected_
gpus
=
"0,1,2,3"
\
python
3.7
-m
paddle.distributed.launch
\
--gpus
=
"0,1,2,3"
\
tools/train.py
\
-c
./configs/ResNet/ResNet50.yaml
\
-o
print_interval
=
10
tools/static/run_dali.sh
浏览文件 @
15b18973
...
...
@@ -4,7 +4,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3"
export
FLAGS_fraction_of_gpu_memory_to_use
=
0.80
python3.7
-m
paddle.distributed.launch
\
--
selected_
gpus
=
"0,1,2,3"
\
--gpus
=
"0,1,2,3"
\
tools/static/train.py
\
-c
./configs/ResNet/ResNet50.yaml
\
-o
print_interval
=
10
\
...
...
tools/train.py
浏览文件 @
15b18973
...
...
@@ -92,8 +92,9 @@ def main(args):
# 2. validate with validate dataset
if
config
.
validate
and
epoch_id
%
config
.
valid_interval
==
0
:
net
.
eval
()
top1_acc
=
program
.
run
(
valid_dataloader
,
config
,
net
,
None
,
None
,
epoch_id
,
'valid'
)
with
paddle
.
no_grad
():
top1_acc
=
program
.
run
(
valid_dataloader
,
config
,
net
,
None
,
None
,
epoch_id
,
'valid'
)
if
top1_acc
>
best_top1_acc
:
best_top1_acc
=
top1_acc
best_top1_epoch
=
epoch_id
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录