Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
b06bd21e
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看板
提交
b06bd21e
编写于
7月 20, 2020
作者:
W
wqz960
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify eval and vgg
上级
a68d90c5
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
15 addition
and
30 deletion
+15
-30
ppcls/modeling/architectures/vgg.py
ppcls/modeling/architectures/vgg.py
+1
-1
tools/eval.py
tools/eval.py
+14
-29
未找到文件。
ppcls/modeling/architectures/vgg.py
浏览文件 @
b06bd21e
...
@@ -106,7 +106,7 @@ class VGGNet(fluid.dygraph.Layer):
...
@@ -106,7 +106,7 @@ class VGGNet(fluid.dygraph.Layer):
x
=
self
.
_conv_block_4
(
x
)
x
=
self
.
_conv_block_4
(
x
)
x
=
self
.
_conv_block_5
(
x
)
x
=
self
.
_conv_block_5
(
x
)
x
=
fluid
.
layers
.
flatten
(
x
,
axis
=
0
)
x
=
fluid
.
layers
.
reshape
(
x
,
[
0
,
-
1
]
)
x
=
self
.
_fc1
(
x
)
x
=
self
.
_fc1
(
x
)
x
=
self
.
_drop
(
x
)
x
=
self
.
_drop
(
x
)
x
=
self
.
_fc2
(
x
)
x
=
self
.
_fc2
(
x
)
...
...
tools/eval.py
浏览文件 @
b06bd21e
...
@@ -19,13 +19,10 @@ from __future__ import print_function
...
@@ -19,13 +19,10 @@ from __future__ import print_function
import
os
import
os
import
argparse
import
argparse
import
paddle.fluid
as
fluid
import
program
from
ppcls.data
import
Reader
from
ppcls.data
import
Reader
from
ppcls.utils.config
import
get_config
from
ppcls.utils.config
import
get_config
from
ppcls.utils.save_load
import
init_model
from
ppcls.utils.save_load
import
init_model
from
ppcls.utils
import
logger
from
paddle.fluid.incubate.fleet.collective
import
fleet
from
paddle.fluid.incubate.fleet.collective
import
fleet
from
paddle.fluid.incubate.fleet.base
import
role_maker
from
paddle.fluid.incubate.fleet.base
import
role_maker
...
@@ -45,37 +42,25 @@ def parse_args():
...
@@ -45,37 +42,25 @@ def parse_args():
action
=
'append'
,
action
=
'append'
,
default
=
[],
default
=
[],
help
=
'config options to be overridden'
)
help
=
'config options to be overridden'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
def
main
(
args
):
def
main
(
args
):
role
=
role_maker
.
PaddleCloudRoleMaker
(
is_collective
=
True
)
# assign the place
fleet
.
init
(
role
)
gpu_id
=
fluid
.
dygraph
.
parallel
.
Env
().
dev_id
config
=
get_config
(
args
.
config
,
overrides
=
args
.
override
,
show
=
True
)
gpu_id
=
int
(
os
.
environ
.
get
(
'FLAGS_selected_gpus'
,
0
))
place
=
fluid
.
CUDAPlace
(
gpu_id
)
place
=
fluid
.
CUDAPlace
(
gpu_id
)
with
fluid
.
dygraph
.
guard
(
place
):
startup_prog
=
fluid
.
Program
()
pre_weights_dict
=
fluid
.
dygraph
.
load_dygraph
(
config
.
pretrained_model
)[
0
]
valid_prog
=
fluid
.
Program
()
strategy
=
fluid
.
dygraph
.
parallel
.
prepare_context
()
valid_dataloader
,
valid_fetchs
=
program
.
build
(
net
=
program
.
create_model
(
config
.
ARCHITECTURE
,
config
.
classes_num
)
config
,
valid_prog
,
startup_prog
,
is_train
=
False
)
net
=
fluid
.
dygraph
.
parallel
.
DataParallel
(
net
,
strategy
)
valid_prog
=
valid_prog
.
clone
(
for_test
=
True
)
net
.
set_dict
(
pre_weights_dict
)
valid_dataloader
=
program
.
create_dataloader
()
exe
=
fluid
.
Executor
(
place
)
exe
.
run
(
startup_prog
)
init_model
(
config
,
valid_prog
,
exe
)
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
)
net
.
eval
()
compiled_valid_prog
=
program
.
compile
(
config
,
valid_prog
)
top1_acc
=
program
.
run
(
valid_dataloader
,
config
,
net
,
None
,
0
,
'valid'
)
program
.
run
(
valid_dataloader
,
exe
,
compiled_valid_prog
,
valid_fetchs
,
-
1
,
'eval'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
args
=
parse_args
()
args
=
parse_args
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录