Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
15be4519
X
X2Paddle
项目概览
PaddlePaddle
/
X2Paddle
大约 1 年 前同步成功
通知
328
Star
698
Fork
167
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
26
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
X2Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
26
Issue
26
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
15be4519
编写于
1月 13, 2019
作者:
J
jiangjiajun
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/PaddlePaddle/X2Paddle
上级
27a6f795
b96f86a2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
6 deletion
+9
-6
TensorFlow2Paddle/README.md
TensorFlow2Paddle/README.md
+9
-6
未找到文件。
TensorFlow2Paddle/README.md
浏览文件 @
15be4519
### Warning: TensorFlow2Paddle is not stable yet. Only tested on vgg_16/resnet_v1_50/inception_v3 with is_training=False
### Warning: TensorFlow2Paddle is not stable yet. Only tested on vgg_16/resnet_v1_50/inception_v3 with is_training=False
Demo: How to change tensorflow resnet_v1_50 pretrained model to PaddlePaddle model for inference
####
Demo: How to change tensorflow resnet_v1_50 pretrained model to PaddlePaddle model for inference
1.
Get pretrained_model
#####
1. Get pretrained_model
```
```
git clone https://github.com/PaddlePaddle/X2Paddle.git
git clone https://github.com/PaddlePaddle/X2Paddle.git
...
@@ -10,20 +10,20 @@ wget http://download.tensorflow.org/models/resnet_v1_50_2016_08_28.tar.gz
...
@@ -10,20 +10,20 @@ wget http://download.tensorflow.org/models/resnet_v1_50_2016_08_28.tar.gz
tar xzvf resnet_v2_50_2017_04_14.tar.gz
tar xzvf resnet_v2_50_2017_04_14.tar.gz
```
```
2.
Change model to ckpt model with meta file
#####
2. Change model to ckpt model with meta file
```
```
python demo/save_resnet_ckpt_model.py resnet_v1_50.ckpt ./new_ckpt_model
python demo/save_resnet_ckpt_model.py resnet_v1_50.ckpt ./new_ckpt_model
```
```
3.
Export PaddlePaddle model
#####
3. Export PaddlePaddle model
```
```
python demo/export_resnet_to_paddle_model.py new_ckpt_model/resnet.meta new_ckpt_model fluid_model
python demo/export_resnet_to_paddle_model.py new_ckpt_model/resnet.meta new_ckpt_model fluid_model
```
```
4.
Test PaddlePaddle model
#####
4. Test PaddlePaddle model
```
python
```
python
from
fluid_model.mymodel
import
KitModel
from
fluid_model.mymodel
import
KitModel
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
...
@@ -39,7 +39,7 @@ for f in os.listdir('./fluid_model'):
...
@@ -39,7 +39,7 @@ for f in os.listdir('./fluid_model'):
f
=
f
.
split
(
'/fluid'
)[
-
1
]
f
=
f
.
split
(
'/fluid'
)[
-
1
]
if
f
.
startswith
(
"param_"
):
if
f
.
startswith
(
"param_"
):
var_list
.
append
(
fluid
.
default_main_program
().
global_block
().
var
(
f
))
var_list
.
append
(
fluid
.
default_main_program
().
global_block
().
var
(
f
))
fluid
.
io
.
load_vars
(
exe
,
'./fluid'
,
vars
=
var_list
)
fluid
.
io
.
load_vars
(
exe
,
'./fluid
_model
'
,
vars
=
var_list
)
test_data
=
numpy
.
random
.
rand
(
1
,
3
,
224
,
224
)
test_data
=
numpy
.
random
.
rand
(
1
,
3
,
224
,
224
)
test_data
=
numpy
.
array
(
test_data
,
dtype
=
'float32'
)
test_data
=
numpy
.
array
(
test_data
,
dtype
=
'float32'
)
...
@@ -48,3 +48,6 @@ result = exe.run(fluid.default_main_program(),
...
@@ -48,3 +48,6 @@ result = exe.run(fluid.default_main_program(),
fetch_list
=
[
result
])
fetch_list
=
[
result
])
print
(
result
)
print
(
result
)
```
```
### Link
[
MMdnn-Tensorflow
](
https://github.com/Microsoft/MMdnn/tree/master/mmdnn/conversion/tensorflow
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录