提交 248fb5a4 编写于 作者: C Channingss

fix doc

上级 b6581a26
......@@ -35,6 +35,6 @@
- id: cpplint-cpp-source
name: cpplint
description: Check C++ code style using cpplint.py.
entry: bash cpplint_pre_commit.hook
entry: bash ./tools/codestyle/cpplint_pre_commit.hook
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx)$
......@@ -63,9 +63,10 @@ class SegResult : public BaseResult {
public:
Mask<int64_t> label_map;
Mask<float> score_map;
std::string type = "seg";
void clear() {
label_map.clear();
score_map.clear();
}
};
} // namespce of PaddleX
} // namespace PaddleX
......@@ -19,30 +19,30 @@ import argparse
def export_lite():
opt = lite.Opt()
model_file = os.path.join(FLAGS.model_path, '__model__')
params_file = os.path.join(FLAGS.model_path, '__params__')
opt.run_optimize("", model_file, params_file, FLAGS.place, FLAGS.save_dir)
model_file = os.path.join(FLAGS.model_dir, '__model__')
params_file = os.path.join(FLAGS.model_dir, '__params__')
opt.run_optimize("", model_file, params_file, FLAGS.place, FLAGS.save_file)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--model_path",
"--model_dir",
type=str,
default="",
help="model path.",
help="path of '__model__' and '__params__'.",
required=True)
parser.add_argument(
"--place",
type=str,
default="arm",
help="preprocess config path.",
help="run place: 'arm|opencl|x86|npu|xpu|rknpu|apu'.",
required=True)
parser.add_argument(
"--save_dir",
"--save_file",
type=str,
default="paddlex.onnx",
help="Directory for storing the output visualization files.",
help="file name for storing the output files.",
required=True)
FLAGS = parser.parse_args()
export_lite()
# 移动端部署
PaddleX的移动端部署由PaddleLite实现,部署的流程如下,首先将训练好的模型导出为inference model,然后使用PaddleLite的python接口对模型进行优化,最后使用PaddleLite的预测库进行部署,
PaddleLite的详细介绍和使用可参考:[PaddleLite文档](https://paddle-lite.readthedocs.io/zh/latest/)
> PaddleX --> Inference Model --> PaddleLite Opt --> PaddleLite Inference
以下介绍如何将PaddleX导出为inference model,然后使用PaddleLite的OPT模块对模型进行优化:
step 1: 安装PaddleLite
```
......@@ -9,15 +16,21 @@ pip install paddlelite
step 2: 将PaddleX模型导出为inference模型
参考[导出inference模型](deploy_server/deploy_python.html#inference)将模型导出为inference格式模型。
**注意:由于PaddleX代码的持续更新,版本低于1.0.0的模型暂时无法直接用于预测部署,参考[模型版本升级](../upgrade_version.md)对模型版本进行升级。**
**注意:由于PaddleX代码的持续更新,版本低于1.0.0的模型暂时无法直接用于预测部署,参考[模型版本升级](./upgrade_version.md)对模型版本进行升级。**
step 3: 将inference模型转换成PaddleLite模型
```
python /path/to/PaddleX/deploy/lite/export_lite.py --model_path /path/to/inference_model --save_dir /path/to/onnx_model
python /path/to/PaddleX/deploy/lite/export_lite.py --model_dir /path/to/inference_model --save_file /path/to/onnx_model --place place/to/run
```
`--model_path`用于指定inference模型的路径,`--save_dir`用于指定Lite模型的保存路径。
| 参数 | 说明 |
| ---- | ---- |
| model_dir | 预测模型所在路径,包含"__model__", "__params__"文件 |
| save_file | 模型输出的名称,默认为"paddlex.nb" |
| place | 运行的平台,可选:arm|opencl|x86|npu|xpu|rknpu|apu |
step 4: 预测
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册