Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
c32b8b15
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看板
提交
c32b8b15
编写于
4月 20, 2020
作者:
S
shippingwang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine code
上级
5ae03cfb
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
34 addition
and
17 deletion
+34
-17
configs/eval.yaml
configs/eval.yaml
+4
-4
configs/flower.yaml
configs/flower.yaml
+6
-5
ppcls/utils/check.py
ppcls/utils/check.py
+1
-1
ppcls/utils/config.py
ppcls/utils/config.py
+11
-2
tools/eval.py
tools/eval.py
+3
-2
tools/eval.sh
tools/eval.sh
+6
-0
tools/program.py
tools/program.py
+1
-0
tools/run.sh
tools/run.sh
+0
-1
tools/train.py
tools/train.py
+2
-2
未找到文件。
configs/eval.yaml
浏览文件 @
c32b8b15
mode
:
'
valid'
mode
:
'
valid'
ARCHITECTURE
:
ARCHITECTURE
:
name
:
"
"
name
:
"
ResNet50_vd
"
pretrained_model
:
"
"
pretrained_model
:
"
./pretrained_model/ResNet50_vd_pretrained
"
classes_num
:
1000
classes_num
:
1000
total_images
:
1281167
total_images
:
1281167
topk
:
5
topk
:
5
...
@@ -11,8 +11,8 @@ image_shape: [3, 224, 224]
...
@@ -11,8 +11,8 @@ image_shape: [3, 224, 224]
VALID
:
VALID
:
batch_size
:
16
batch_size
:
16
num_workers
:
4
num_workers
:
4
file_list
:
"
.
.
/dataset/ILSVRC2012/val_list.txt"
file_list
:
"
./dataset/ILSVRC2012/val_list.txt"
data_dir
:
"
.
.
/dataset/ILSVRC2012/"
data_dir
:
"
./dataset/ILSVRC2012/"
shuffle_seed
:
0
shuffle_seed
:
0
transforms
:
transforms
:
-
DecodeImage
:
-
DecodeImage
:
...
...
configs/flower.yaml
浏览文件 @
c32b8b15
mode
:
'
train'
mode
:
'
train'
architecture
:
'
ResNet50_vd'
ARCHITECTURE
:
name
:
'
ResNet50_vd'
pretrained_model
:
pretrained_model
:
model_save_dir
:
"
./output/"
model_save_dir
:
"
./output/"
classes_num
:
102
classes_num
:
102
...
@@ -29,8 +30,8 @@ OPTIMIZER:
...
@@ -29,8 +30,8 @@ OPTIMIZER:
TRAIN
:
TRAIN
:
batch_size
:
32
batch_size
:
32
num_workers
:
1
num_workers
:
1
file_list
:
"
./dataset/flower102/train_list.txt"
file_list
:
"
./dataset/flower
s
102/train_list.txt"
data_dir
:
"
./dataset/flower102"
data_dir
:
"
./dataset/flower
s
102"
shuffle_seed
:
0
shuffle_seed
:
0
transforms
:
transforms
:
-
DecodeImage
:
-
DecodeImage
:
...
@@ -54,8 +55,8 @@ TRAIN:
...
@@ -54,8 +55,8 @@ TRAIN:
VALID
:
VALID
:
batch_size
:
64
batch_size
:
64
num_workers
:
1
num_workers
:
1
file_list
:
"
./dataset/flower102/val_list.txt"
file_list
:
"
./dataset/flower
s
102/val_list.txt"
data_dir
:
"
./dataset/flower102/"
data_dir
:
"
./dataset/flower
s
102/"
shuffle_seed
:
0
shuffle_seed
:
0
transforms
:
transforms
:
-
DecodeImage
:
-
DecodeImage
:
...
...
ppcls/utils/check.py
浏览文件 @
c32b8b15
...
@@ -67,7 +67,7 @@ def check_architecture(architecture):
...
@@ -67,7 +67,7 @@ def check_architecture(architecture):
similar_names
=
similar_architectures
(
architecture
[
"name"
],
similar_names
=
similar_architectures
(
architecture
[
"name"
],
get_architectures
())
get_architectures
())
model_list
=
', '
.
join
(
similar_names
)
model_list
=
', '
.
join
(
similar_names
)
err
=
"
{}
is not exist! Maybe you want: [{}]"
\
err
=
"
Architecture [{}]
is not exist! Maybe you want: [{}]"
\
""
.
format
(
architecture
[
"name"
],
model_list
)
""
.
format
(
architecture
[
"name"
],
model_list
)
try
:
try
:
assert
architecture
[
"name"
]
in
similar_names
assert
architecture
[
"name"
]
in
similar_names
...
...
ppcls/utils/config.py
浏览文件 @
c32b8b15
...
@@ -63,7 +63,11 @@ def print_dict(d, delimiter=0):
...
@@ -63,7 +63,11 @@ def print_dict(d, delimiter=0):
Recursively visualize a dict and
Recursively visualize a dict and
indenting acrrording by the relationship of keys.
indenting acrrording by the relationship of keys.
"""
"""
dk
=
[]
dv
=
[]
for
k
,
v
in
d
.
items
():
for
k
,
v
in
d
.
items
():
if
k
in
CONFIG_SECS
:
if
k
in
CONFIG_SECS
:
logger
.
info
(
"-"
*
60
)
logger
.
info
(
"-"
*
60
)
...
@@ -75,11 +79,16 @@ def print_dict(d, delimiter=0):
...
@@ -75,11 +79,16 @@ def print_dict(d, delimiter=0):
for
value
in
v
:
for
value
in
v
:
print_dict
(
value
,
delimiter
+
4
)
print_dict
(
value
,
delimiter
+
4
)
else
:
else
:
logger
.
info
(
"{}{} : {}"
.
format
(
delimiter
*
" "
,
k
,
v
)
)
dk
.
append
(
k
)
dv
.
append
(
v
)
if
k
in
CONFIG_SECS
:
if
k
in
CONFIG_SECS
:
logger
.
info
(
"-"
*
60
)
logger
.
info
(
"-"
*
60
)
for
ki
,
vi
in
zip
(
dk
,
dv
):
logger
.
info
(
"{}{} : {}"
.
format
(
delimiter
*
" "
,
ki
,
vi
))
def
print_config
(
config
):
def
print_config
(
config
):
"""
"""
...
...
tools/eval.py
浏览文件 @
c32b8b15
...
@@ -71,8 +71,9 @@ def main(args):
...
@@ -71,8 +71,9 @@ def main(args):
valid_reader
=
Reader
(
config
,
'valid'
)()
valid_reader
=
Reader
(
config
,
'valid'
)()
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)
compiled_valid_prog
=
valid_prog
program
.
run
(
valid_dataloader
,
exe
,
compiled_valid_prog
,
valid_fetchs
,
0
,
program
.
run
(
valid_dataloader
,
exe
,
compiled_valid_prog
,
valid_fetchs
,
0
,
'valid'
)
'valid'
)
...
...
tools/eval.sh
0 → 100644
浏览文件 @
c32b8b15
export
PYTHONPATH
=
$PWD
:
$PYTHONPATH
python
-m
paddle.distributed.launch
\
--selected_gpus
=
"0"
\
tools/eval.py
\
-c
./configs/eval.yaml
tools/program.py
浏览文件 @
c32b8b15
...
@@ -389,3 +389,4 @@ def run(dataloader, exe, program, fetchs, epoch=0, mode='train'):
...
@@ -389,3 +389,4 @@ def run(dataloader, exe, program, fetchs, epoch=0, mode='train'):
fetchs_str
=
''
.
join
([
str
(
m
)
for
m
in
metric_list
]
+
[
str
(
batch_time
)])
fetchs_str
=
''
.
join
([
str
(
m
)
for
m
in
metric_list
]
+
[
str
(
batch_time
)])
logger
.
info
(
"[epoch:%3d][%s][step:%4d]%s"
%
logger
.
info
(
"[epoch:%3d][%s][step:%4d]%s"
%
(
epoch
,
mode
,
idx
,
fetchs_str
))
(
epoch
,
mode
,
idx
,
fetchs_str
))
logger
.
info
(
"END [epoch:%3d][%s]%s"
%
(
epoch
,
mode
,
fetchs_str
))
tools/run.sh
浏览文件 @
c32b8b15
...
@@ -4,6 +4,5 @@ export PYTHONPATH=$PWD:$PYTHONPATH
...
@@ -4,6 +4,5 @@ export PYTHONPATH=$PWD:$PYTHONPATH
python
-m
paddle.distributed.launch
\
python
-m
paddle.distributed.launch
\
--selected_gpus
=
"0,1,2,3"
\
--selected_gpus
=
"0,1,2,3"
\
--log_dir
=
log_ResNet50
\
tools/train.py
\
tools/train.py
\
-c
./configs/ResNet/ResNet50.yaml
-c
./configs/ResNet/ResNet50.yaml
tools/train.py
浏览文件 @
c32b8b15
...
@@ -87,8 +87,8 @@ def main(args):
...
@@ -87,8 +87,8 @@ def main(args):
if
config
.
validate
:
if
config
.
validate
:
valid_reader
=
Reader
(
config
,
'valid'
)()
valid_reader
=
Reader
(
config
,
'valid'
)()
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)
compiled_valid_prog
=
valid_prog
compiled_train_prog
=
fleet
.
main_program
compiled_train_prog
=
fleet
.
main_program
for
epoch_id
in
range
(
config
.
epochs
):
for
epoch_id
in
range
(
config
.
epochs
):
# 1. train with train dataset
# 1. train with train dataset
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录