Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
f07e2124
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
1 年多 前同步成功
通知
51
Star
1434
Fork
344
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
16
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSlim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
16
合并请求
16
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
f07e2124
编写于
1月 07, 2021
作者:
C
ceci3
提交者:
GitHub
1月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix dataloader (#592)
上级
197abda0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
13 deletion
+32
-13
demo/nas/block_sa_nas_mobilenetv2.py
demo/nas/block_sa_nas_mobilenetv2.py
+6
-2
demo/nas/parl_nas_mobilenetv2.py
demo/nas/parl_nas_mobilenetv2.py
+6
-2
demo/nas/rl_nas_mobilenetv2.py
demo/nas/rl_nas_mobilenetv2.py
+6
-2
demo/nas/sa_nas_mobilenetv2.py
demo/nas/sa_nas_mobilenetv2.py
+11
-4
docs/zh_cn/quick_start/nas_tutorial.md
docs/zh_cn/quick_start/nas_tutorial.md
+3
-3
未找到文件。
demo/nas/block_sa_nas_mobilenetv2.py
浏览文件 @
f07e2124
...
...
@@ -8,6 +8,7 @@ import time
import
paddle
import
paddle.nn
as
nn
import
paddle.nn.functional
as
F
import
paddle.vision.transforms
as
T
import
paddle.static
as
static
from
paddle
import
ParamAttr
from
paddleslim.analysis
import
flops
...
...
@@ -51,9 +52,12 @@ def conv_bn_layer(input,
def
search_mobilenetv2_block
(
config
,
args
,
image_size
):
image_shape
=
[
3
,
image_size
,
image_size
]
transform
=
T
.
Compose
([
T
.
Transpose
(),
T
.
Normalize
([
127.5
],
[
127.5
])])
if
args
.
data
==
'cifar10'
:
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'train'
)
val_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'test'
)
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'train'
,
transform
=
transform
,
backend
=
'cv2'
)
val_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'test'
,
transform
=
transform
,
backend
=
'cv2'
)
elif
args
.
data
==
'imagenet'
:
train_dataset
=
imagenet_reader
.
ImageNetDataset
(
mode
=
'train'
)
...
...
demo/nas/parl_nas_mobilenetv2.py
浏览文件 @
f07e2124
...
...
@@ -11,6 +11,7 @@ import paddle
import
paddle.nn
as
nn
import
paddle.static
as
static
import
paddle.nn.functional
as
F
import
paddle.vision.transforms
as
T
from
paddleslim.nas
import
RLNAS
from
paddleslim.common
import
get_logger
from
optimizer
import
create_optimizer
...
...
@@ -94,8 +95,11 @@ def search_mobilenetv2(config, args, image_size, is_server=True):
image_shape
=
[
3
,
image_size
,
image_size
]
if
args
.
data
==
'cifar10'
:
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'train'
)
val_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'test'
)
transform
=
T
.
Compose
([
T
.
Transpose
(),
T
.
Normalize
([
127.5
],
[
127.5
])])
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'train'
,
transform
=
transform
,
backend
=
'cv2'
)
val_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'test'
,
transform
=
transform
,
backend
=
'cv2'
)
elif
args
.
data
==
'imagenet'
:
train_dataset
=
imagenet_reader
.
ImageNetDataset
(
mode
=
'train'
)
...
...
demo/nas/rl_nas_mobilenetv2.py
浏览文件 @
f07e2124
...
...
@@ -11,6 +11,7 @@ import paddle
import
paddle.nn
as
nn
import
paddle.static
as
static
import
paddle.nn.functional
as
F
import
paddle.vision.transforms
as
T
from
paddleslim.nas
import
RLNAS
from
paddleslim.common
import
get_logger
from
optimizer
import
create_optimizer
...
...
@@ -104,8 +105,11 @@ def search_mobilenetv2(config, args, image_size, is_server=True):
image_shape
=
[
3
,
image_size
,
image_size
]
if
args
.
data
==
'cifar10'
:
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'train'
)
val_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'test'
)
transform
=
T
.
Compose
([
T
.
Transpose
(),
T
.
Normalize
([
127.5
],
[
127.5
])])
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'train'
,
transform
=
transform
,
backend
=
'cv2'
)
val_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'test'
,
transform
=
transform
,
backend
=
'cv2'
)
elif
args
.
data
==
'imagenet'
:
train_dataset
=
imagenet_reader
.
ImageNetDataset
(
mode
=
'train'
)
...
...
demo/nas/sa_nas_mobilenetv2.py
浏览文件 @
f07e2124
...
...
@@ -11,6 +11,7 @@ import paddle
import
paddle.nn
as
nn
import
paddle.static
as
static
import
paddle.nn.functional
as
F
import
paddle.vision.transforms
as
T
from
paddle
import
ParamAttr
from
paddleslim.analysis
import
flops
from
paddleslim.nas
import
SANAS
...
...
@@ -76,8 +77,11 @@ def build_program(main_program,
def
search_mobilenetv2
(
config
,
args
,
image_size
,
is_server
=
True
):
image_shape
=
[
3
,
image_size
,
image_size
]
if
args
.
data
==
'cifar10'
:
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'train'
)
val_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'test'
)
transform
=
T
.
Compose
([
T
.
Transpose
(),
T
.
Normalize
([
127.5
],
[
127.5
])])
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'train'
,
transform
=
transform
,
backend
=
'cv2'
)
val_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'test'
,
transform
=
transform
,
backend
=
'cv2'
)
elif
args
.
data
==
'imagenet'
:
train_dataset
=
imagenet_reader
.
ImageNetDataset
(
mode
=
'train'
)
...
...
@@ -182,8 +186,11 @@ def test_search_result(tokens, image_size, args, config):
image_shape
=
[
3
,
image_size
,
image_size
]
if
args
.
data
==
'cifar10'
:
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'train'
)
val_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'test'
)
transform
=
T
.
Compose
([
T
.
Transpose
(),
T
.
Normalize
([
127.5
],
[
127.5
])])
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'train'
,
transform
=
transform
,
backend
=
'cv2'
)
val_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
'test'
,
transform
=
transform
,
backend
=
'cv2'
)
elif
args
.
data
==
'imagenet'
:
train_dataset
=
imagenet_reader
.
ImageNetDataset
(
mode
=
'train'
)
...
...
docs/zh_cn/quick_start/nas_tutorial.md
浏览文件 @
f07e2124
...
...
@@ -74,8 +74,8 @@ def build_program(archs):
import
paddle.vision.transforms
as
T
def
input_data
(
image
,
label
):
transform
=
T
.
Compose
([
T
.
Normalize
([
127.5
],
[
127.5
])])
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
"train"
,
transform
=
transform
)
transform
=
T
.
Compose
([
T
.
Transpose
(),
T
.
Normalize
([
127.5
],
[
127.5
])])
train_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
"train"
,
transform
=
transform
,
backend
=
'cv2'
)
train_loader
=
paddle
.
io
.
DataLoader
(
train_dataset
,
places
=
paddle
.
CPUPlace
(),
feed_list
=
[
image
,
label
],
...
...
@@ -83,7 +83,7 @@ def input_data(image, label):
batch_size
=
64
,
return_list
=
False
,
shuffle
=
True
)
eval_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
"test"
,
transform
=
transform
)
eval_dataset
=
paddle
.
vision
.
datasets
.
Cifar10
(
mode
=
"test"
,
transform
=
transform
,
backend
=
'cv2'
)
eval_loader
=
paddle
.
io
.
DataLoader
(
eval_dataset
,
places
=
paddle
.
CPUPlace
(),
feed_list
=
[
image
,
label
],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录