Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
1bbcd81f
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1bbcd81f
编写于
10月 25, 2018
作者:
T
typhoonzero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
8c4b45c7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
8 addition
and
19 deletion
+8
-19
fluid/image_classification/dist_train/dist_train.py
fluid/image_classification/dist_train/dist_train.py
+4
-2
fluid/image_classification/models/__init__.py
fluid/image_classification/models/__init__.py
+2
-0
fluid/image_classification/models/resnet_dist.py
fluid/image_classification/models/resnet_dist.py
+2
-17
未找到文件。
fluid/image_classification/dist_train/dist_train.py
浏览文件 @
1bbcd81f
...
...
@@ -33,10 +33,12 @@ def parse_args():
parser
.
add_argument
(
'--model'
,
type
=
str
,
default
=
'
resnet_dis
t'
,
default
=
'
DistResNe
t'
,
help
=
'The model to run.'
)
parser
.
add_argument
(
'--batch_size'
,
type
=
int
,
default
=
32
,
help
=
'The minibatch size per device.'
)
parser
.
add_argument
(
'--multi_batch_repeat'
,
type
=
int
,
default
=
1
,
help
=
'Batch merge repeats.'
)
parser
.
add_argument
(
'--learning_rate'
,
type
=
float
,
default
=
0.1
,
help
=
'The learning rate.'
)
parser
.
add_argument
(
...
...
@@ -124,7 +126,7 @@ def get_model(args, is_train, main_prog, startup_prog):
name
=
"train_reader"
if
is_train
else
"test_reader"
,
use_double_buffer
=
True
)
input
,
label
=
fluid
.
layers
.
read_file
(
pyreader
)
model_def
=
models
.
__dict__
[
args
.
model
](
is_train
)
model_def
=
models
.
__dict__
[
args
.
model
](
layers
=
50
,
is_train
=
is_train
)
predict
=
model_def
.
net
(
input
,
class_dim
=
class_dim
)
cost
=
fluid
.
layers
.
cross_entropy
(
input
=
predict
,
label
=
label
)
...
...
fluid/image_classification/models/__init__.py
浏览文件 @
1bbcd81f
...
...
@@ -3,6 +3,8 @@ from .mobilenet import MobileNet
from
.googlenet
import
GoogleNet
from
.vgg
import
VGG11
,
VGG13
,
VGG16
,
VGG19
from
.resnet
import
ResNet50
,
ResNet101
,
ResNet152
from
.resnet_dist
import
DistResNet
from
.inception_v4
import
InceptionV4
from
.se_resnext
import
SE_ResNeXt50_32x4d
,
SE_ResNeXt101_32x4d
,
SE_ResNeXt152_32x4d
from
.dpn
import
DPN68
,
DPN92
,
DPN98
,
DPN107
,
DPN131
import
learning_rate
fluid/image_classification/models/resnet_dist.py
浏览文件 @
1bbcd81f
...
...
@@ -5,7 +5,7 @@ import paddle
import
paddle.fluid
as
fluid
import
math
__all__
=
[
"
ResNet"
,
"ResNet50"
,
"ResNet101"
,
"ResNet152
"
]
__all__
=
[
"
DistResNet
"
]
train_parameters
=
{
"input_size"
:
[
3
,
224
,
224
],
...
...
@@ -20,7 +20,7 @@ train_parameters = {
}
class
ResNet
():
class
Dist
ResNet
():
def
__init__
(
self
,
layers
=
50
,
is_train
=
True
):
self
.
params
=
train_parameters
self
.
layers
=
layers
...
...
@@ -119,18 +119,3 @@ class ResNet():
short
=
self
.
shortcut
(
input
,
num_filters
*
4
,
stride
)
return
fluid
.
layers
.
elementwise_add
(
x
=
short
,
y
=
conv2
,
act
=
'relu'
)
def
ResNet50
():
model
=
ResNet
(
layers
=
50
)
return
model
def
ResNet101
():
model
=
ResNet
(
layers
=
101
)
return
model
def
ResNet152
():
model
=
ResNet
(
layers
=
152
)
return
model
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录