Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
AutoDL
提交
e3d910f4
A
AutoDL
项目概览
PaddlePaddle
/
AutoDL
通知
3
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
1
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AutoDL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e3d910f4
编写于
7月 30, 2019
作者:
J
jerrywgz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean code
上级
73d5f419
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
8 addition
and
22 deletion
+8
-22
LRC/learning_rate.py
LRC/learning_rate.py
+0
-1
LRC/model.py
LRC/model.py
+0
-1
LRC/reader_cifar.py
LRC/reader_cifar.py
+5
-8
LRC/train_mixup.py
LRC/train_mixup.py
+3
-8
LRC/utils.py
LRC/utils.py
+0
-4
未找到文件。
LRC/learning_rate.py
浏览文件 @
e3d910f4
...
...
@@ -76,4 +76,3 @@ def cosine_with_warmup_decay(learning_rate, lr_min, steps_one_epoch,
fluid
.
layers
.
assign
(
cosine_lr
,
lr
)
return
lr
LRC/model.py
浏览文件 @
e3d910f4
...
...
@@ -175,7 +175,6 @@ def StemConv(input, C_out, kernel_size, padding):
return
bn_a
class
NetworkCIFAR
(
object
):
def
__init__
(
self
,
C
,
class_num
,
layers
,
auxiliary
,
genotype
):
self
.
_layers
=
layers
...
...
LRC/reader_cifar.py
浏览文件 @
e3d910f4
...
...
@@ -52,6 +52,7 @@ half_length = 8
CIFAR_MEAN
=
[
0.49139968
,
0.48215827
,
0.44653124
]
CIFAR_STD
=
[
0.24703233
,
0.24348505
,
0.26158768
]
def
generate_reshape_label
(
label
,
batch_size
,
CIFAR_CLASSES
=
10
):
reshape_label
=
np
.
zeros
((
batch_size
,
1
),
dtype
=
'int32'
)
reshape_non_label
=
np
.
zeros
(
...
...
@@ -153,10 +154,6 @@ def reader_creator_filepath(filename, sub_name, is_training, args):
if
len
(
batch_data
)
==
args
.
batch_size
:
batch_data
=
np
.
array
(
batch_data
,
dtype
=
'float32'
)
batch_label
=
np
.
array
(
batch_label
,
dtype
=
'int64'
)
#
# batch_data = pickle.load(open('input.pkl'))
# batch_label = pickle.load(open('target.pkl')).reshape(-1,1)
#
if
is_training
:
flatten_label
,
flatten_non_label
=
\
generate_reshape_label
(
batch_label
,
args
.
batch_size
)
...
...
LRC/train_mixup.py
浏览文件 @
e3d910f4
...
...
@@ -70,6 +70,7 @@ dataset_train_size = 50000.
image_size
=
32
genotypes
.
DARTS
=
genotypes
.
MY_DARTS_list
[
args
.
model_id
]
def
main
():
image_shape
=
[
3
,
image_size
,
image_size
]
devices
=
os
.
getenv
(
"CUDA_VISIBLE_DEVICES"
)
or
""
...
...
@@ -79,7 +80,8 @@ def main():
model
=
Network
(
args
.
init_channels
,
CIFAR_CLASSES
,
args
.
layers
,
args
.
auxiliary
,
genotype
)
steps_one_epoch
=
math
.
ceil
(
dataset_train_size
/
(
devices_num
*
args
.
batch_size
))
steps_one_epoch
=
math
.
ceil
(
dataset_train_size
/
(
devices_num
*
args
.
batch_size
))
train
(
model
,
args
,
image_shape
,
steps_one_epoch
)
...
...
@@ -136,13 +138,6 @@ def train(model, args, im_shape, steps_one_epoch):
main_program
=
train_prog
,
predicate
=
if_exist
)
#if args.pretrained_model:
# def if_exist(var):
# return os.path.exists(os.path.join(args.pretrained_model, var.name))
# fluid.io.load_vars(exe, args.pretrained_model, main_program=train_prog, predicate=if_exist)
exec_strategy
=
fluid
.
ExecutionStrategy
()
exec_strategy
.
num_threads
=
1
build_strategy
=
fluid
.
BuildStrategy
()
...
...
LRC/utils.py
浏览文件 @
e3d910f4
...
...
@@ -34,10 +34,6 @@ def mixup_data(x, y, batch_size, alpha=1.0):
lam
=
1.
index
=
np
.
random
.
permutation
(
batch_size
)
#
#lam = 0.5
#index = np.arange(batch_size-1, -1, -1)
#
mixed_x
=
lam
*
x
+
(
1
-
lam
)
*
x
[
index
,
:]
y_a
,
y_b
=
y
,
y
[
index
]
return
mixed_x
.
astype
(
'float32'
),
y_a
.
astype
(
'int64'
),
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录