diff --git a/docs/advanced_user_guides/index.rst b/docs/advanced_user_guides/index.rst deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/docs/advanced_user_guides/test_tools.md b/docs/advanced_user_guides/test_tools.md deleted file mode 100644 index 694918b88868bb25058b81dc5b418fa52a60444c..0000000000000000000000000000000000000000 --- a/docs/advanced_user_guides/test_tools.md +++ /dev/null @@ -1,32 +0,0 @@ -# 测试工具 - -Basic profiler 用于 CPU 上kernel 耗时的统计。 - -## 开启方法: - -参照 [编译安装](../installation/source_compile) 中的**full_publish**部分进行环境配置,在 cmake 时添加 `-DLITE_WITH_PROFILE=ON` ,就可以开启相应支持。 - -## 使用示例: - -在模型执行完毕后,会自动打印类似如下 profiler 的日志 - -``` - kernel average min max count - feed/def/1/4/2 0 0 0 1 - conv2d/def/4/1/1 1175 1175 1175 1 - conv2d/def/4/1/1 1253 1253 1253 1 - depthwise_conv2d/def/4/1/1 519 519 519 1 - conv2d/def/4/1/1 721 721 721 1 - elementwise_add/def/4/1/1 18 18 18 1 - conv2d/def/4/1/1 2174 2174 2174 1 - depthwise_conv2d/def/4/1/1 380 380 380 1 - conv2d/def/4/1/1 773 773 773 1 - elementwise_add/def/4/1/1 2 2 2 1 - conv2d/def/4/1/1 1248 1248 1248 1 - depthwise_conv2d/def/4/1/1 492 492 492 1 - conv2d/def/4/1/1 1150 1150 1150 1 - elementwise_add/def/4/1/1 33 33 33 1 - elementwise_add/def/4/1/1 3 3 3 1 - conv2d/def/4/1/1 1254 1254 1254 1 - depthwise_conv2d/def/4/1/1 126 126 126 1 -``` diff --git a/docs/advanced_user_guides/x2paddle_models_doc.md b/docs/advanced_user_guides/x2paddle_models_doc.md deleted file mode 100644 index 54b5f316cdb7da4233070e4d900e0c66963430ec..0000000000000000000000000000000000000000 --- a/docs/advanced_user_guides/x2paddle_models_doc.md +++ /dev/null @@ -1,22 +0,0 @@ -# X2Paddle 支持模型列表 - -## 多框架支持 - -|模型 | caffe | tensorflow | onnx | -|---|---|---|---| -|mobilenetv1 | Y | Y | | -|mobilenetv2 | Y | Y | Y | -|resnet18 | Y | Y | | -|resnet50 | Y | Y | Y | -|mnasnet | Y | Y | | -|efficientnet | Y | Y | Y | -|squeezenetv1.1 | Y | Y | Y | -|shufflenet | Y | Y | | -|mobilenet_ssd | Y | Y | | -|mobilenet_yolov3 | | Y | | -|inceptionv4 | | | | -|mtcnn | Y | Y | | -|facedetection | Y | | | -|unet | Y | Y | | -|ocr_attention | | | | -|vgg16 | | | | diff --git a/docs/advanced_user_guides/cv.md b/docs/api_reference/cv.md similarity index 97% rename from docs/advanced_user_guides/cv.md rename to docs/api_reference/cv.md index 76cf607d5ac624f4c1c4ea129845ef8dc4cb7432..5110e40c423c39e33feb084fa0d09c89ddd13d16 100644 --- a/docs/advanced_user_guides/cv.md +++ b/docs/api_reference/cv.md @@ -1,6 +1,6 @@ -# CV图像预处理库 +# CV图像预处理API -请把编译脚本`Paddle-Lite/lite/too/build.sh`中`BUILD_CV`变量设置为`ON`, 其他编译参数设置请参考[源码编译](../source_compile), 以确保 Lite 可以正确编译。这样`CV`图像的加速库就会编译进去,且会生成`paddle_image_preprocess.h`的API文件 +请把编译脚本`Paddle-Lite/lite/too/build.sh`中`BUILD_CV`变量设置为`ON`, 其他编译参数设置请参考[源码编译](../user_guides/source_compile), 以确保 Lite 可以正确编译。这样`CV`图像的加速库就会编译进去,且会生成`paddle_image_preprocess.h`的API文件 - 硬件平台: `ARM` - 操作系统:`MAC` 和 `LINUX` diff --git a/docs/api_reference/cxx_api_doc.md b/docs/api_reference/cxx_api_doc.md index 3530dadf5d9781e02d490aa263017b8d25622476..0b0f1f3d9b321959ef1f6210010da69fc0ffc7b8 100644 --- a/docs/api_reference/cxx_api_doc.md +++ b/docs/api_reference/cxx_api_doc.md @@ -1,5 +1,5 @@ -# C++ API文档 +# C++ API ## CreatePaddlePredictor @@ -260,7 +260,7 @@ class MobileConfig; `MobileConfig`用来配置构建轻量级PaddlePredictor的配置信息,如NaiveBuffer格式的模型地址、模型的内存地址(从内存加载模型时使用)、能耗模式、工作线程数等等。 -*注意:输入的模型需要使用[Model Optimize Tool](../model_optimize_tool)转化为NaiveBuffer格式的优化模型。* +*注意:输入的模型需要使用[Model Optimize Tool](../user_guides/model_optimize_tool)转化为NaiveBuffer格式的优化模型。* 示例: @@ -589,7 +589,7 @@ for (int i = 0; i < ShapeProduction(output_tensor->shape()); i += 100) { 根据名称获取输出Tensor的指针。 -**注意**:`GetTensor`接口是为开发者设计的调试接口,可以输出[转化](../model_optimize_tool)后模型中的任一节点。如果出现`GetTensor(InputName)`返回值为空`Tensor`,可能原因是以该`InputName`命名的Tensor在模型转化的**子图融合**过程被融合替换了。 +**注意**:`GetTensor`接口是为开发者设计的调试接口,可以输出[转化](../user_guides/model_optimize_tool)后模型中的任一节点。如果出现`GetTensor(InputName)`返回值为空`Tensor`,可能原因是以该`InputName`命名的Tensor在模型转化的**子图融合**过程被融合替换了。 参数: diff --git a/docs/api_reference/java_api_doc.md b/docs/api_reference/java_api_doc.md index 8bb23a7a8d7df8c616d7fbfe08b7094deec42a03..71c7362cb19eccf9cd1ea9164ba9a3ad7434f181 100644 --- a/docs/api_reference/java_api_doc.md +++ b/docs/api_reference/java_api_doc.md @@ -1,4 +1,4 @@ -# Java API 文档 +# Java API ## MobileConfig diff --git a/docs/api_reference/python_api_doc.md b/docs/api_reference/python_api_doc.md index 0340b517911dc063b4dae5dd4b1ce9e6415c499d..b4c9e1715ccae9d194aa29fea30f41b3496ec0ae 100755 --- a/docs/api_reference/python_api_doc.md +++ b/docs/api_reference/python_api_doc.md @@ -1,4 +1,4 @@ -# Python API文档 +# Python API ## create_paddle_predictor diff --git a/docs/benchmark/benchmark.md b/docs/benchmark/benchmark.md index f4a17c6f91a4a9c8543bb8e5b91974883c1627f6..2868d0e7e573d83a0fa804732c80744e566e78d3 100644 --- a/docs/benchmark/benchmark.md +++ b/docs/benchmark/benchmark.md @@ -1,4 +1,4 @@ -# Benchmark 数据 +# 性能数据 可以参考[benchmark_tools](benchmark_tools),推荐**一键benchmark**。 diff --git a/docs/benchmark/benchmark_tools.md b/docs/benchmark/benchmark_tools.md index f68301262bcfe1d54cfb5c00c4b73ec40bdc9e4a..36bf8831f142b1bd6c988b0ece7192437643fcbf 100644 --- a/docs/benchmark/benchmark_tools.md +++ b/docs/benchmark/benchmark_tools.md @@ -1,4 +1,4 @@ -# Benchmark 测试方法 +# 测试方法 本文将会介绍,在**Ubuntu:16.04交叉编译环境**下,用安卓手机在终端测试Paddle-Lite的性能,并介绍两种Benchmark方法: @@ -57,7 +57,7 @@ wget -c https://paddle-inference-dist.bj.bcebos.com/PaddleLite/benchmark_0/bench #### 方式二:由源码编译benchmark_bin文件 -根据[源码编译](../installation/source_compile)准备编译环境,拉取PaddleLite最新release发布版代码,并在仓库根目录下,执行: +根据[源码编译](../user_guides/source_compile)准备编译环境,拉取PaddleLite最新release发布版代码,并在仓库根目录下,执行: ```shell ########################################### diff --git a/docs/user_guides/android_app_demo.md b/docs/demo_guides/android_app_demo.md similarity index 99% rename from docs/user_guides/android_app_demo.md rename to docs/demo_guides/android_app_demo.md index 5b3d4b1d44741eb54bfb2e2c724478bd8fc384e1..0fd1deb272e7deb0139f9f9849294cfc3e3a854a 100644 --- a/docs/user_guides/android_app_demo.md +++ b/docs/demo_guides/android_app_demo.md @@ -1,4 +1,4 @@ -# Android demo +# Android Demo ## 多种应用场景 diff --git a/docs/user_guides/cpp_demo.md b/docs/demo_guides/cpp_demo.md similarity index 98% rename from docs/user_guides/cpp_demo.md rename to docs/demo_guides/cpp_demo.md index 434d2866a92398385ccb69e15c3b1afba2390e0a..55abd3a70fe23dd0e8798d6a772ee216140c2875 100644 --- a/docs/user_guides/cpp_demo.md +++ b/docs/demo_guides/cpp_demo.md @@ -2,7 +2,7 @@ ## 1. 下载最新版本预测库 -预测库下载界面位于[Paddle-Lite官方预编译库](../installation/release_lib),可根据需求选择合适版本。 +预测库下载界面位于[Paddle-Lite官方预编译库](../user_guides/release_lib),可根据需求选择合适版本。 以**Android-ARMv8架构**为例,可以下载以下版本: diff --git a/docs/advanced_user_guides/cuda.md b/docs/demo_guides/cuda.md similarity index 98% rename from docs/advanced_user_guides/cuda.md rename to docs/demo_guides/cuda.md index 45597057bb18c44b60234459f9a49a59b54135f6..47d4e19160af83ee82fac49512ec4451b86cb34c 100644 --- a/docs/advanced_user_guides/cuda.md +++ b/docs/demo_guides/cuda.md @@ -1,4 +1,4 @@ -# Lite基于CUDA的模型预测 +# PaddleLite使用CUDA预测部署 Lite支持在x86_64,arm64架构上(如:TX2)进行CUDA的编译运行。 diff --git a/docs/advanced_user_guides/fpga.md b/docs/demo_guides/fpga.md similarity index 97% rename from docs/advanced_user_guides/fpga.md rename to docs/demo_guides/fpga.md index a7c398af2036cab7d914a692ce4f8fdbae13d45c..f7885fd3b7f6600fe890332d2805a386008659e5 100644 --- a/docs/advanced_user_guides/fpga.md +++ b/docs/demo_guides/fpga.md @@ -1,4 +1,4 @@ -# Lite基于FPGA的模型预测 +# PaddleLite使用FPGA预测部署 Paddle Lite支持基于arm的FPGA zu3/zu5/zu9的模型预测,提供armv8的交叉编译 @@ -22,7 +22,7 @@ CMAKE编译选项: - 设置`LITE_WITH_FPGA=ON`和`LITE_WITH_ARM=ON` -其他编译选项与ARM编译相同,可以参考[“Paddle Lite在Docker下的ARM编译”](../source_compile)。 +其他编译选项与ARM编译相同,可以参考[“Paddle Lite在Docker下的ARM编译”](../user_guides/source_compile)。 示例如下: ```shell cmake .. \ diff --git a/docs/user_guides/ios_app_demo.md b/docs/demo_guides/ios_app_demo.md similarity index 99% rename from docs/user_guides/ios_app_demo.md rename to docs/demo_guides/ios_app_demo.md index 52886f91d431afe7b9f2481fd0c59da330cf8547..2d9bbcbf83e1703a116d65c7ce8379638bd13cfe 100644 --- a/docs/user_guides/ios_app_demo.md +++ b/docs/demo_guides/ios_app_demo.md @@ -1,4 +1,4 @@ -# iOS demo +# iOS Demo ## 多种应用场景 diff --git a/docs/user_guides/java_demo.md b/docs/demo_guides/java_demo.md similarity index 96% rename from docs/user_guides/java_demo.md rename to docs/demo_guides/java_demo.md index 9deb4382a5621e4af619fb57cd2585f5d5a480f3..ad37e7b95dbd439ccc7393af27140a404e16cf07 100644 --- a/docs/user_guides/java_demo.md +++ b/docs/demo_guides/java_demo.md @@ -9,7 +9,7 @@ ## 编译 -首先在PaddleLite的开发 [Docker镜像](../installation/source_compile) 中,拉取最新PaddleLite代码,编译对应你手机架构的预测库, +首先在PaddleLite的开发 [Docker镜像](../user_guides/source_compile) 中,拉取最新PaddleLite代码,编译对应你手机架构的预测库, 下面我们以arm8 架构举例。进入paddlelite 目录,运行以下命令: ```shell diff --git a/docs/advanced_user_guides/npu.md b/docs/demo_guides/npu.md similarity index 90% rename from docs/advanced_user_guides/npu.md rename to docs/demo_guides/npu.md index a01f5271322587f46d10c1db3c01da82235c8c1a..9722ff6aabda87cb02adc111dd1b29e9bdcf3f55 100644 --- a/docs/advanced_user_guides/npu.md +++ b/docs/demo_guides/npu.md @@ -1,4 +1,4 @@ -# Lite基于华为NPU的模型预测 +# PaddleLite使用NPU(华为)预测部署 Paddle Lite是首款支持华为自研达芬奇架构NPU(Kirin 810/990 SoC搭载的NPU)的预测框架。 原理是在线分析Paddle模型,将Paddle算子转成HiAI IR后,调用HiAI IR/Builder/Runtime APIs生成并执行HiAI模型。 @@ -91,7 +91,7 @@ $ ./lite/tools/build_npu.sh --arm_os=android --arm_abi=armv7 --arm_lang=gcc --an $ ./lite/tools/build_npu.sh --arm_os=android --arm_abi=armv7 --arm_lang=gcc --android_stl=c++_shared tiny_publish ``` -注意:为了保证编译环境一致,建议参考[源码编译](../installation/source_compile)中的Docker开发环境进行配置,然后再执行上述命令。 +注意:为了保证编译环境一致,建议参考[源码编译](../user_guides/source_compile)中的Docker开发环境进行配置,然后再执行上述命令。 ## 优化生成NPU模型 @@ -111,13 +111,13 @@ $ ./lite/tools/build_npu.sh --arm_os=android --arm_abi=armv7 --arm_lang=gcc --an ## 通过JAVA接口加载并执行NPU模型 -- 使用方法和[Java实例](../user_guides/java_demo)一致,无需额外设置任何参数,只需将模型换成NPU模型即可。[Paddle-Lite-Demo](https://github.com/PaddlePaddle/Paddle-Lite-Demo)中的Image Classification Demo for Android是同时支持CPU和NPU两种模型的图像分类Demo。 +- 使用方法和[Java实例](java_demo)一致,无需额外设置任何参数,只需将模型换成NPU模型即可。[Paddle-Lite-Demo](https://github.com/PaddlePaddle/Paddle-Lite-Demo)中的Image Classification Demo for Android是同时支持CPU和NPU两种模型的图像分类Demo。 注意:在拷贝libpaddle_lite_jni.so的时候,由于依赖HiAI DDK so和libc++_shared.so库,需要将HiAI DDK中ai_ddk_lib/lib或ai_ddk_lib/lib64目录下的所有so和libc++_shared.so,拷到libpaddle_lite_jni.so同级目录下。 ## 通过C++接口加载并执行NPU模型 -- 使用方法和[C++实例](../user_guides/cpp_demo)一致,同样无需额外设置任何参数,只需将模型换成NPU模型即可。 +- 使用方法和[C++实例](cpp_demo)一致,同样无需额外设置任何参数,只需将模型换成NPU模型即可。 注意:1)不能使用安卓模拟器,需要使用真实设备,且必须是支持NPU的华为手机。2)在使用adb push命令向手机推送目标程序时,需要将HiAI DDK中ai_ddk_lib/lib或ai_ddk_lib/lib64目录下的所有so和libc++_shared.so,推送到目标程序同级目录下。 diff --git a/docs/advanced_user_guides/opencl.md b/docs/demo_guides/opencl.md similarity index 99% rename from docs/advanced_user_guides/opencl.md rename to docs/demo_guides/opencl.md index 05c94a9f230037f92e1848084a42cb2af942926e..325a772df31ce3873941f74e8a4ed1069e0b3da2 100644 --- a/docs/advanced_user_guides/opencl.md +++ b/docs/demo_guides/opencl.md @@ -1,4 +1,4 @@ -# Lite基于OpenCL的模型预测 +# PaddleLite使用OpenCL预测部署 Lite支持在Android系统上运行基于OpenCL的程序,目前支持Ubuntu环境下armv8、armv7的交叉编译。 diff --git a/docs/advanced_user_guides/x86.md b/docs/demo_guides/x86.md similarity index 97% rename from docs/advanced_user_guides/x86.md rename to docs/demo_guides/x86.md index add821f2333f4100fb9766e2fb1d34e912bb5997..c65ca99006b924488ceee50489e3d5654bae990c 100644 --- a/docs/advanced_user_guides/x86.md +++ b/docs/demo_guides/x86.md @@ -1,6 +1,6 @@ -# 使用X86预测库 +# PaddleLite使用X86预测部署 -Paddle-Lite 支持在Docker或Linux环境编译x86预测库。环境搭建参考[环境准备](../installation/source_compile)。 +Paddle-Lite 支持在Docker或Linux环境编译x86预测库。环境搭建参考[环境准备](../user_guides/source_compile)。 (注意:非docker Linux环境需要是Ubuntu16.04) diff --git a/docs/advanced_user_guides/add_layout.md b/docs/develop_guides/add_layout.md similarity index 99% rename from docs/advanced_user_guides/add_layout.md rename to docs/develop_guides/add_layout.md index 11e504f93c2b1bcaefaa06c0a5f51aea0995884e..26b7a07cc5788ee6e7fa36206c2432f5fc3def1c 100644 --- a/docs/advanced_user_guides/add_layout.md +++ b/docs/develop_guides/add_layout.md @@ -1,4 +1,4 @@ -# 如何增加Layout +# 新增Layout Paddle-Lite中Place包含了Target、Layout、Precision信息,用来注册和选择模型中的具体Kernel。下面以增加Place中的layout:`ImageDefault`、`ImageFolder`、`ImageNW`为例,讲解如何增加新Layout。 diff --git a/docs/advanced_user_guides/add_new_pass.md b/docs/develop_guides/add_new_pass.md similarity index 99% rename from docs/advanced_user_guides/add_new_pass.md rename to docs/develop_guides/add_new_pass.md index 7e4d1da4e9ea906807a213929564d8aa84ecbc28..5740b7978f18cfad5754c0f77a8208bece565893 100644 --- a/docs/advanced_user_guides/add_new_pass.md +++ b/docs/develop_guides/add_new_pass.md @@ -1,5 +1,4 @@ - -# 如何增加Pass +# 新增Pass 本文从三个方面介绍了`Lite`中的`Pass`结构:**Pass是什么**、**Pass的实现与接口**、**Pass的一般注册流程**。最后以`Fc_fuse_pass`为例介绍了`fusion_pass`的作用与注册方法。 diff --git a/docs/advanced_user_guides/add_operation.md b/docs/develop_guides/add_operation.md similarity index 99% rename from docs/advanced_user_guides/add_operation.md rename to docs/develop_guides/add_operation.md index 22f60b9ba4728f0e59fde8b39ccb9c2616d8a0fe..1aa955fa6a1b260fd3a17401e658e33b2b862fd9 100644 --- a/docs/advanced_user_guides/add_operation.md +++ b/docs/develop_guides/add_operation.md @@ -1,4 +1,4 @@ -# 如何增加OP +# 新增OP 以下以添加argmax为例,详细说明新增op的方法。 diff --git a/docs/index.rst b/docs/index.rst index 2bed5b08ae4bf8a1025e56a7f59547f10d2cab70..5e8cb6b2148af4a7f68faf602bdb617743e48e1b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,11 +14,11 @@ Welcome to Paddle-Lite's documentation! introduction/tech_highlights introduction/architecture introduction/support_hardware - introduction/roadmap + introduction/support_operation_list .. toctree:: :maxdepth: 1 - :caption: Benchmark数据和方法 + :caption: Benchmark :name: sec-benchmark benchmark/benchmark @@ -26,61 +26,60 @@ Welcome to Paddle-Lite's documentation! .. toctree:: :maxdepth: 1 - :caption: 安装 - :name: sec-install - - installation/release_lib - installation/source_compile - -.. toctree:: - :maxdepth: 1 - :caption: 使用指南 + :caption: 使用方法 :name: sec-user-guides user_guides/tutorial + user_guides/release_lib + user_guides/source_compile + user_guides/x2paddle user_guides/model_optimize_tool - user_guides/cpp_demo - user_guides/java_demo - user_guides/android_app_demo - user_guides/ios_app_demo + user_guides/post_quant_with_data + user_guides/post_quant_no_data + user_guides/model_quantization + user_guides/debug user_guides/library_tailoring .. toctree:: :maxdepth: 1 - :caption: 进阶使用指南 - - advanced_user_guides/x2paddle - advanced_user_guides/x2paddle_models_doc - advanced_user_guides/post_quant_with_data - advanced_user_guides/post_quant_no_data - advanced_user_guides/model_quantization - advanced_user_guides/support_operation_list - advanced_user_guides/add_operation - advanced_user_guides/add_layout - advanced_user_guides/add_new_pass - advanced_user_guides/test_tools - advanced_user_guides/debug_tools - advanced_user_guides/npu - advanced_user_guides/opencl - advanced_user_guides/fpga - advanced_user_guides/cuda - advanced_user_guides/x86 - advanced_user_guides/cv + :caption: 部署示例 + :name: sec-demo_guides + + demo_guides/cpp_demo + demo_guides/java_demo + demo_guides/android_app_demo + demo_guides/ios_app_demo + demo_guides/x86 + demo_guides/cuda + demo_guides/opencl + demo_guides/fpga + demo_guides/npu .. toctree:: :maxdepth: 1 - :caption: 开发者文档 + :caption: API文档 + + api_reference/cxx_api_doc + api_reference/java_api_doc + api_reference/python_api_doc + api_reference/cv + +.. toctree:: + :maxdepth: 1 + :caption: 开发者贡献 develop_guides/for-developer develop_guides/architecture-intro + develop_guides/add_operation + develop_guides/add_layout + develop_guides/add_new_pass .. toctree:: :maxdepth: 1 - :caption: API文档 + :caption: Roadmap + :name: sec-roadmap - api_reference/cxx_api_doc - api_reference/java_api_doc - api_reference/python_api_doc + introduction/roadmap .. toctree:: :maxdepth: 1 diff --git a/docs/introduction/faq.md b/docs/introduction/faq.md index 121a214674a7b4e8675a0e3c9abbf7857d95c78d..768b92a31b42934d454bfa3afbee6f8dba1ef462 100644 --- a/docs/introduction/faq.md +++ b/docs/introduction/faq.md @@ -1,7 +1,8 @@ -# FAQ -## 问题或建议可以发Issue,为加快问题解决效率,可先检索是否有类似问题,我们也会及时解答! -## 欢迎加入Paddle-Lite百度官方QQ群:696965088 +# FAQ 常见问题 -## 1. 在Host端采用交叉编译方式编译PaddleLite,将编译后的libpaddle_light_api_shared.so和可执行程序放到板卡上运行,出现了如下图所示的错误,怎么解决? +问题或建议可以发Issue,为加快问题解决效率,可先检索是否有类似问题,我们也会及时解答! +欢迎加入Paddle-Lite百度官方QQ群:696965088 + +1. 在Host端采用交叉编译方式编译PaddleLite,将编译后的libpaddle_light_api_shared.so和可执行程序放到板卡上运行,出现了如下图所示的错误,怎么解决? ![host_target_compiling_env_miss_matched](https://user-images.githubusercontent.com/9973393/75761527-31b8b700-5d74-11ea-8a9a-0bc0253ee003.png) -- 原因是Host端的交叉编译环境与Target端板卡的运行环境不一致,导致libpaddle_light_api_shared.so链接的GLIBC库高于板卡环境的GLIBC库。目前有四种解决办法(为了保证编译环境与官方一致,推荐第一种方式):1)在Host端,参考[源码编译](../installation/source_compile)中的Docker方式重新编译libpaddle_light_api_shared.so;2)在Host端,使用与Target端版本一致的ARM GCC和GLIBC库重新编译libpaddle_light_api_shared.so;3)在Target端板卡上,参考[源码编译](../installation/source_compile)中的ARM Linux本地编译方式重新编译libpaddle_light_api_shared.so;4)在Target端板卡上,将GLIBC库升级到和Host端一致的版本,即GLIBC2.27。 +- 原因是Host端的交叉编译环境与Target端板卡的运行环境不一致,导致libpaddle_light_api_shared.so链接的GLIBC库高于板卡环境的GLIBC库。目前有四种解决办法(为了保证编译环境与官方一致,推荐第一种方式):1)在Host端,参考[源码编译](../user_guides/source_compile)中的Docker方式重新编译libpaddle_light_api_shared.so;2)在Host端,使用与Target端版本一致的ARM GCC和GLIBC库重新编译libpaddle_light_api_shared.so;3)在Target端板卡上,参考[源码编译](../user_guides/source_compile)中的ARM Linux本地编译方式重新编译libpaddle_light_api_shared.so;4)在Target端板卡上,将GLIBC库升级到和Host端一致的版本,即GLIBC2.27。 diff --git a/docs/introduction/support_hardware.md b/docs/introduction/support_hardware.md index d60edc3dd494044f002a47d8291a983f927e5408..b1a6823d26d4fe8838afee00732707608b836599 100644 --- a/docs/introduction/support_hardware.md +++ b/docs/introduction/support_hardware.md @@ -1,5 +1,5 @@ -# 支持硬件列表 +# 支持硬件 ## ARM CPU diff --git a/docs/advanced_user_guides/support_operation_list.md b/docs/introduction/support_operation_list.md similarity index 99% rename from docs/advanced_user_guides/support_operation_list.md rename to docs/introduction/support_operation_list.md index c12c8d6e55019a4ff739175e13417545d33b5e07..7a60cf46e424dfe610a0541c9e364cf6e5d98531 100644 --- a/docs/advanced_user_guides/support_operation_list.md +++ b/docs/introduction/support_operation_list.md @@ -1,4 +1,4 @@ -# 支持OP列表 +# 支持OP ## Ops (共计158个算子) diff --git a/docs/advanced_user_guides/debug_tools.md b/docs/user_guides/debug.md similarity index 74% rename from docs/advanced_user_guides/debug_tools.md rename to docs/user_guides/debug.md index 06e8e2542c82f94877e32e4ee8a336a100ff4964..93395b25fae772954f83a1128cdb7e86c9eee994 100644 --- a/docs/advanced_user_guides/debug_tools.md +++ b/docs/user_guides/debug.md @@ -1,25 +1,60 @@ -# 调试方法 +# 调试 + +## Profiler工具 + +Basic profiler 用于 CPU 上kernel 耗时的统计。 + +### 开启方法: + +参照 [编译安装](../user_guides/source_compile) 中的**full_publish**部分进行环境配置,在 cmake 时添加 `-DLITE_WITH_PROFILE=ON` ,就可以开启相应支持。 + +### 使用示例: + +在模型执行完毕后,会自动打印类似如下 profiler 的日志 + +``` + kernel average min max count + feed/def/1/4/2 0 0 0 1 + conv2d/def/4/1/1 1175 1175 1175 1 + conv2d/def/4/1/1 1253 1253 1253 1 + depthwise_conv2d/def/4/1/1 519 519 519 1 + conv2d/def/4/1/1 721 721 721 1 + elementwise_add/def/4/1/1 18 18 18 1 + conv2d/def/4/1/1 2174 2174 2174 1 + depthwise_conv2d/def/4/1/1 380 380 380 1 + conv2d/def/4/1/1 773 773 773 1 + elementwise_add/def/4/1/1 2 2 2 1 + conv2d/def/4/1/1 1248 1248 1248 1 + depthwise_conv2d/def/4/1/1 492 492 492 1 + conv2d/def/4/1/1 1150 1150 1150 1 + elementwise_add/def/4/1/1 33 33 33 1 + elementwise_add/def/4/1/1 3 3 3 1 + conv2d/def/4/1/1 1254 1254 1254 1 + depthwise_conv2d/def/4/1/1 126 126 126 1 +``` + +## Debug工具 **Lite Model Debug Tool** 是用来检查Paddle-Lite框架与Paddle-Fluid框架运行时tensor(包括variable与weight)之间diff信息的基础工具。 -## 编译方法: +### 编译方法: -1. 参照 [编译安装](../installation/source_compile) 中的**full_publish**部分进行环境配置和编译。 +1. 参照 [编译安装](../user_guides/source_compile) 中的**full_publish**部分进行环境配置和编译。 2. 在生成的`build`目录下,执行`make lite_model_debug_tool`,`lite_model_debug_tool`产出在编译目录的`lite/tools/debug`目录下。 -## 工作流程: +### 工作流程: 1. 运行 `/bin/bash check_model.sh --model_dir= --build_root_dir= debug_cpp_stage` 获得模型在Paddle-Lite框架下的运行拓扑信息、varibles信息和weights信息。运行后拓扑信息将会存储在默认名为 `topo_file.txt` 的文件中,variables和weights信息将会存储在默认名为 `tensor_cpp.txt` 的文件中。 2. 运行 `/bin/bash check_model.sh --model_dir= --build_root_dir= debug_py_stage`执行fluid框架预测以获取相同模型在fluid框架下的variable与weight信息(注意:我们使用fluid的python api运行fluid模型,因此您在运行此步之前应确保已正确安装fluid的python api)。然后debug tool将会自动比较Paddle-Lite框架输出的信息和Paddle-Fluid框架输出的信息来检查是否存在运行时diff。 执行Paddle-Fluid框架,输出的信息将会存储在默认名为 `tensor_py.txt` 的文件中,相应的diff信息将会存储在默认名为 `diff.txt`的文件中(默认情况下,只会输出执行拓扑序中第一个有diff的variable相关的信息)。 -## 注意事项: +### 注意事项: 1. 输出的结果是在**执行完一次预测后**输出的相应变量/权重的最终值,因此如果您在预测过程进行过诸如变量复用/子图融合等优化方法,则相应的输出可能会出现偏差。 2. 默认情况下debug tools将以全1作为输入进行比对。 3. 默认情况下,为了保证与Paddle-Fluid框架的结果可比对,debug tool将会禁用掉所有的Paddle-Lite的优化策略。 4. Paddle-Lite框架的执行环境由与您的编译选项有关,比如您开启了LITE_WITH_ARM编译选项,那debug tool的`debug_cpp_stage`也需要在ARM平台下运行。 -## Diff信息输出: +### Diff信息输出: 如果debug tool检测到diff信息,那么在`diff.txt`中将会输出类似以下结构信息 @@ -37,7 +72,7 @@ dropout_0.tmp_0 {1,1536,1,1} 0.599913 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.01202671 其中第二行为op相关信息,标明了执行哪个op出现了diff及其对应的输入输出变量名。Tensor File info为Paddle-Lite框架的输出信息,而Fluid Tensor info为Paddle-Fluid框架的相应输出信息。 示例中的`dropout_0.tmp_1`没有相应的tensor信息是因为工具检测到其在预测的后序流程中未被使用,因此不会对预测结果造成影响,从而将其自动屏蔽掉以保证输出尽量简洁。 -## 其他选项: +### 其他选项: | Option | Description | | --------------------------- | ------------------------------------------------------------ | diff --git a/docs/installation/library.md b/docs/user_guides/library.md similarity index 100% rename from docs/installation/library.md rename to docs/user_guides/library.md diff --git a/docs/user_guides/library_tailoring.md b/docs/user_guides/library_tailoring.md index 5ba12cf819945ab2f182f672a2c96123bc12e070..e32500bd5851ddad0de3784fb47a7b6326aff6f4 100644 --- a/docs/user_guides/library_tailoring.md +++ b/docs/user_guides/library_tailoring.md @@ -1,5 +1,5 @@ -# 裁剪预测库方法 +# 裁剪预测库 Paddle-Lite支持**根据模型裁剪预测库**功能。Paddle-Lite的一般编译会将所有已注册的operator打包到预测库中,造成库文件体积膨胀;**裁剪预测库**能针对具体的模型,只打包优化后该模型需要的operator,有效降低预测库文件大小。 diff --git a/docs/user_guides/model_optimize_tool.md b/docs/user_guides/model_optimize_tool.md index 7e3902375278f940d4bace705d37208d1d245a1d..47ea6b37494762a876cd70ae6ba01968af96be16 100644 --- a/docs/user_guides/model_optimize_tool.md +++ b/docs/user_guides/model_optimize_tool.md @@ -1,5 +1,5 @@ -# 模型转化方法 +# 模型优化工具 opt Paddle-Lite 提供了多种策略来自动优化原始的训练模型,其中包括量化、子图融合、混合调度、Kernel优选等等方法。为了使优化过程更加方便易用,我们提供了**opt** 工具来自动完成优化步骤,输出一个轻量的、最优的可执行模型。 @@ -25,7 +25,7 @@ git checkout ./lite/tools/build.sh build_optimize_tool ``` 编译结果位于`Paddle-Lite/build.opt/lite/api/opt` -**注意**:从源码编译opt前需要先[安装Paddle-Lite的开发环境](../installation/source_compile)。 +**注意**:从源码编译opt前需要先[安装Paddle-Lite的开发环境](source_compile)。 ## 使用opt diff --git a/docs/advanced_user_guides/model_quantization.md b/docs/user_guides/model_quantization.md similarity index 95% rename from docs/advanced_user_guides/model_quantization.md rename to docs/user_guides/model_quantization.md index cf3f333714d49dcbd97b87f5ae350d27b5cd1ddb..d90fa4bae34cccbcf809bdb2cd102eaf8c468b01 100644 --- a/docs/advanced_user_guides/model_quantization.md +++ b/docs/user_guides/model_quantization.md @@ -237,7 +237,7 @@ python compress.py \ 接下来,使用原始的量化模型生成适合在移动端直接部署的模型。 -参考[源码编译](../source_compile)配置编译环境,确保可以编译成功。参考[模型转化方法](../model_optimize_tool),首先编译model_optimize_tool工具,然后执行下面命令对量化训练的模型进行优化(注意,需要自行修改model_file、param_file和optimize_out)。 +参考[源码编译](source_compile)配置编译环境,确保可以编译成功。参考[模型转化方法](model_optimize_tool),首先编译model_optimize_tool工具,然后执行下面命令对量化训练的模型进行优化(注意,需要自行修改model_file、param_file和optimize_out)。 ```bash ./model_optimize_tool \ --model_file=mobilenet_v1_quant/float/model \ @@ -260,7 +260,7 @@ adb push mobilenet_v1_quant_opt /data/local/tmp ### 使用mobilenetv1\_light\_api运行优化后的量化模型 -参考[源码编译](../source_compile)配置编译环境后,在Paddle-Lite执行如下命令获取轻量级API的demo: +参考[源码编译](source_compile)配置编译环境后,在Paddle-Lite执行如下命令获取轻量级API的demo: ```bash cd /Paddle-Lite/build.lite.android.armv8.gcc/inference_lite_lib.android.armv8/demo/cxx/mobile_light @@ -288,7 +288,7 @@ Output[700]: 0.002509 Output[800]: 0.000538 Output[900]: 0.000969 ``` -在C++中使用Paddle-Lite API的方法请猛戳[此处](../cpp_demo),用户也可参考[mobilenetv1_light_api.cc](https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/lite/demo/cxx/mobile_light/mobilenetv1_light_api.cc)的代码示例。 +在C++中使用Paddle-Lite API的方法请猛戳[此处](../demo_guides/cpp_demo),用户也可参考[mobilenetv1_light_api.cc](https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/lite/demo/cxx/mobile_light/mobilenetv1_light_api.cc)的代码示例。 ## FAQ diff --git a/docs/advanced_user_guides/post_quant_no_data.md b/docs/user_guides/post_quant_no_data.md similarity index 96% rename from docs/advanced_user_guides/post_quant_no_data.md rename to docs/user_guides/post_quant_no_data.md index 6bf7d272b56268e16c482d30fdf7be107a54731b..510dd1da402ff9e536b7d0eaac9731264025ba7a 100644 --- a/docs/advanced_user_guides/post_quant_no_data.md +++ b/docs/user_guides/post_quant_no_data.md @@ -91,4 +91,4 @@ WeightQuantization.quantize_weight_to_int(save_model_dir, ### 3.2 量化模型预测 -和FP32模型一样,转换后的量化模型可以在Android/IOS APP中加载预测,建议参考[C++ Demo](../user_guides/cpp_demo)、[Java Demo](../user_guides/java_demo)、[Android/IOS Demo](../user_guides/android_ios_app_demo)。 +和FP32模型一样,转换后的量化模型可以在Android/IOS APP中加载预测,建议参考[C++ Demo](../demo_guides/cpp_demo)、[Java Demo](../demo_guides/java_demo)、[Android/IOS Demo](../demo_guides/android_app_demo)。 diff --git a/docs/advanced_user_guides/post_quant_with_data.md b/docs/user_guides/post_quant_with_data.md similarity index 98% rename from docs/advanced_user_guides/post_quant_with_data.md rename to docs/user_guides/post_quant_with_data.md index f9bf6fb2b4ba4503e7d007b030dfdb2159b3052a..6d19845d2aa26be9269a18f87ba4f64b835a429a 100644 --- a/docs/advanced_user_guides/post_quant_with_data.md +++ b/docs/user_guides/post_quant_with_data.md @@ -158,7 +158,7 @@ with fluid.name_scope('skip_quant'): ### 3.2 量化模型预测 -和FP32模型一样,转换后的量化模型可以在Android/IOS APP中加载预测,建议参考[C++ Demo](../user_guides/cpp_demo)、[Java Demo](../user_guides/java_demo)、[Android/IOS Demo](../user_guides/android_ios_app_demo)。 +和FP32模型一样,转换后的量化模型可以在Android/IOS APP中加载预测,建议参考[C++ Demo](../demo_guides/cpp_demo)、[Java Demo](../demo_guides/java_demo)、[Android/IOS Demo](../demo_guides/android_app_demo)。 ## 4 使用示例 diff --git a/docs/installation/release_lib.md b/docs/user_guides/release_lib.md similarity index 95% rename from docs/installation/release_lib.md rename to docs/user_guides/release_lib.md index 255c48c2809821eeae42377a97bc87b970975f7f..c1ea4e0f457829dee7542798c117a719cc5de6c6 100644 --- a/docs/installation/release_lib.md +++ b/docs/user_guides/release_lib.md @@ -1,5 +1,5 @@ -# 官方 release 预编译库 +# 预编译库 ## 编译版本介绍 @@ -11,7 +11,7 @@ - arm_stl=`c++_static/c++_shared` Lite预测库链接STL库的方式,支持静态或动态链接 -- build_extra=`ON/OFF` 是否编译全量OP,OFF时只编译CV相关基础OP,[参数详情](./library.html) +- build_extra=`ON/OFF` 是否编译全量OP,OFF时只编译CV相关基础OP,[参数详情](library) - `tiny_publish/full_publish` 编译模式,`tiny_publish`编译移动端部署库、`full_publish`编译部署库的同时编译第三方依赖库 @@ -63,7 +63,7 @@ - [Android源码编译](./source_compile.html#paddlelite) - [iOS源码编译](./source_compile.html#paddlelite) - [ArmLinux源码编译](./source_compile.html#paddlelite) -- [x86源码编译](../advanced_user_guides/x86) -- [opencl源码编译](../advanced_user_guides/opencl) -- [CUDA源码编译](../advanced_user_guides/cuda) -- [FPGA源码编译](../advanced_user_guides/fpga) +- [x86源码编译](../demo_guides/x86) +- [opencl源码编译](../demo_guides/opencl) +- [CUDA源码编译](../demo_guides/cuda) +- [FPGA源码编译](../demo_guides/fpga) diff --git a/docs/installation/source_compile.md b/docs/user_guides/source_compile.md similarity index 98% rename from docs/installation/source_compile.md rename to docs/user_guides/source_compile.md index 741f4b606704f9bc4ad9cc60a41eb5d308df6eee..8717e579c9398b621ebc6d9a71d3226ee504d7ed 100644 --- a/docs/installation/source_compile.md +++ b/docs/user_guides/source_compile.md @@ -1,7 +1,9 @@ -# 源码编译 +# 预测库编译 -Paddle-Lite 提供了移动端的一键源码编译脚本 `lite/tools/build.sh`,编译流程如下: +PaddleLite已经提供官方Release预测库下载,请参考[文档](release_lib)。 + +PaddleLite 提供了移动端的一键源码编译脚本 `lite/tools/build.sh`,编译流程如下: 1. 环境准备(选择其一):Docker交叉编译环境、Linux交叉编译环境 2. 编译:调用`build.sh`脚本一键编译 diff --git a/docs/user_guides/tutorial.md b/docs/user_guides/tutorial.md index aa88d6e874df959d826dac50f60d24317abee333..6bb71938cab16a92e1c33e3d8276872fbcea580a 100644 --- a/docs/user_guides/tutorial.md +++ b/docs/user_guides/tutorial.md @@ -48,8 +48,8 @@ $ ./opt \ ## 四. Lite API -为了方便您的使用,我们提供了C++、Java、Python三种API,并且提供了相应的api的完整使用示例:[C++完整示例](cpp_demo)、[Java完整示例](java_demo)、[Python完整示例](../advanced_user_guides/cuda),您可以参考示例中的说明快速了解C++/Java/Python的API使用方法,并集成到您自己的项目中去。需要说明的是,为了减少第三方库的依赖、提高Lite预测框架的通用性,在移动端使用Lite API您需要准备Naive Buffer存储格式的模型,具体方法可参考第2节`模型优化`。 +为了方便您的使用,我们提供了C++、Java、Python三种API,并且提供了相应的api的完整使用示例:[C++完整示例](../demo_guides/cpp_demo)、[Java完整示例](../demo_guides/java_demo)、[Python完整示例](../demo_guides/cuda),您可以参考示例中的说明快速了解C++/Java/Python的API使用方法,并集成到您自己的项目中去。需要说明的是,为了减少第三方库的依赖、提高Lite预测框架的通用性,在移动端使用Lite API您需要准备Naive Buffer存储格式的模型,具体方法可参考第2节`模型优化`。 ## 五. 测试工具 -为了使您更好的了解并使用Lite框架,我们向有进一步使用需求的用户开放了 [Lite Model Debug Tool](../advanced_user_guides/debug_tools) 和 [Profile Monitor Tool](../advanced_user_guides/test_tools)。Lite Model Debug Tool可以用来查找Lite框架与PaddlePaddle框架在执行预测时模型中的对应变量值是否有差异,进一步快速定位问题Op,方便复现与排查问题。Profile Monitor Tool可以帮助您了解每个Op的执行时间消耗,其会自动统计Op执行的次数,最长、最短、平均执行时间等等信息,为性能调优做一个基础参考。您可以通过 [相关专题](../advanced_user_guides/debug_tools) 了解更多内容。 +为了使您更好的了解并使用Lite框架,我们向有进一步使用需求的用户开放了 [Debug工具](debug#debug) 和 [Profile工具](debug#profiler)。Lite Model Debug Tool可以用来查找Lite框架与PaddlePaddle框架在执行预测时模型中的对应变量值是否有差异,进一步快速定位问题Op,方便复现与排查问题。Profile Monitor Tool可以帮助您了解每个Op的执行时间消耗,其会自动统计Op执行的次数,最长、最短、平均执行时间等等信息,为性能调优做一个基础参考。您可以通过 [相关专题](debug) 了解更多内容。 diff --git a/docs/advanced_user_guides/x2paddle.md b/docs/user_guides/x2paddle.md similarity index 64% rename from docs/advanced_user_guides/x2paddle.md rename to docs/user_guides/x2paddle.md index 0dfd65010d1792aaf738d54b74f83e5cd5863c53..7e44ba980cc6836189d3f1a03bbbf29c8d7bd5c1 100644 --- a/docs/advanced_user_guides/x2paddle.md +++ b/docs/user_guides/x2paddle.md @@ -1,7 +1,32 @@ -# 通过 X2Paddle 转换模型 +# 模型转换工具 X2Paddle + +X2Paddle可以将caffe、tensorflow、onnx模型转换成Paddle支持的模型。 [X2Paddle](https://github.com/PaddlePaddle/X2Paddle)支持将Caffe/TensorFlow模型转换为PaddlePaddle模型。目前X2Paddle支持的模型参考[x2paddle_model_zoo](https://github.com/PaddlePaddle/X2Paddle/blob/develop/x2paddle_model_zoo.md)。 + +## 多框架支持 + +|模型 | caffe | tensorflow | onnx | +|---|---|---|---| +|mobilenetv1 | Y | Y | | +|mobilenetv2 | Y | Y | Y | +|resnet18 | Y | Y | | +|resnet50 | Y | Y | Y | +|mnasnet | Y | Y | | +|efficientnet | Y | Y | Y | +|squeezenetv1.1 | Y | Y | Y | +|shufflenet | Y | Y | | +|mobilenet_ssd | Y | Y | | +|mobilenet_yolov3 | | Y | | +|inceptionv4 | | | | +|mtcnn | Y | Y | | +|facedetection | Y | | | +|unet | Y | Y | | +|ocr_attention | | | | +|vgg16 | | | | + + ## 安装 ```