未验证 提交 bfa2c478 编写于 作者: J Jason 提交者: GitHub

Update README.md

上级 78d6627b
...@@ -22,13 +22,29 @@ tensorflow2fluid支持将训练好的TensorFlow模型转换为PaddlePaddle模型 ...@@ -22,13 +22,29 @@ tensorflow2fluid支持将训练好的TensorFlow模型转换为PaddlePaddle模型
<a id="使用方法"> <a id="使用方法">
## 使用方法 ## 使用方法
### 转换模型
``` ```
python src/convert.py --pb_file tf_model.pb \ python src/convert.py --pb_file tf_model.pb \
--in_nodes inputs \ --in_nodes inputs \
--output_nodes outputs \ --output_nodes outputs \
--input_shape None,224,224,3 \ --input_shape None,224,224,3 \
--input_format NHWC \ --input_format NHWC \
--save_dir paddle_model --save_dir translated_paddle_model
```
### 加载模型并预测
``` python
# coding:utf-8
# 代码运行目录 X2Paddle/tensorflow2fluid
import sys
import tf2fluid.model_loader as ml
# 加载模型
model = ml.ModelLoader("translated_paddle_model", use_cuda=True)
# 注意
data = numpy.random.rand(5, 3, 224, 224)
import tf2fluid.model_loader as ml
import tf2fluid.model_loader as ml
``` ```
### 参数说明 ### 参数说明
|tf2fluid参数|说明| |tf2fluid参数|说明|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册