未验证 提交 13de98c4 编写于 作者: Q Qi Li 提交者: GitHub

[DOC][cherry-pick] Update readme2.0 and document fixes (#4228)

* [DOC] add license, test=develop, test=document_fix (#4167)
* [DOC] Fix doc issues (#4202)
* [DOC] Update Readme 2.0 (#4209)
* [DOC] Add compile options and supported models (#4225)
上级 0ae3aea0
Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
[中文版](./README_cn.md)
# Paddle Lite # Paddle Lite
<!--[![Build Status](https://travis-ci.org/PaddlePaddle/Paddle-Lite.svg?branch=develop&longCache=true&style=flat-square)](https://travis-ci.org/PaddlePaddle/Paddle-Lite)--> [English](README_en.md) | 简体中文
[![Documentation Status](https://img.shields.io/badge/中文文档-最新-brightgreen.svg)](https://paddle-lite.readthedocs.io/zh/latest/)
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE) [![Build Status](https://travis-ci.org/PaddlePaddle/Paddle-Lite.svg?branch=develop&longCache=true&style=flat-square)](https://travis-ci.org/PaddlePaddle/Paddle-Lite) [![Documentation Status](https://img.shields.io/badge/中文文档-最新-brightgreen.svg)](https://paddle-lite.readthedocs.io/zh/latest/) [![Release](https://img.shields.io/github/release/PaddlePaddle/Paddle-Lite.svg)](https://github.com/PaddlePaddle/Paddle-Lite/releases) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)
<!-- [![Release](https://img.shields.io/github/release/PaddlePaddle/Paddle-Mobile.svg)](https://github.com/PaddlePaddle/Paddle-Mobile/releases) -->
Paddle Lite是一个高性能、轻量级、灵活性强且易于扩展的深度学习推理框架,定位支持包括移动端、嵌入式以及服务器端在内的多硬件平台。
Paddle Lite is an updated version of Paddle-Mobile, an open-open source deep learning framework designed to make it easy to perform inference on mobile, embeded, and IoT devices. It is compatible with PaddlePaddle and pre-trained models from other sources. 当前Paddle Lite不仅在百度内部业务中得到全面应用,也成功支持了众多外部用户和企业的生产任务。
For tutorials, please see [PaddleLite Document](https://paddle-lite.readthedocs.io/zh/latest/). ## 快速入门
## Key Features 使用Paddle Lite,只需几个简单的步骤,就可以把模型部署到多种终端设备中,运行高性能的推理任务,使用流程如下所示:
### Light Weight **一. 准备模型**
On mobile devices, execution module can be deployed without third-party libraries, because our excecution module and analysis module are decoupled. Paddle Lite框架直接支持模型结构为[PaddlePaddle](https://github.com/PaddlePaddle/Paddle)深度学习框架产出的模型格式。目前PaddlePaddle用于推理的模型是通过[save_inference_model](https://www.paddlepaddle.org.cn/documentation/docs/zh/api_cn/io_cn/save_inference_model_cn.html#save-inference-model)这个API保存下来的。
如果您手中的模型是由诸如Caffe、Tensorflow、PyTorch等框架产出的,那么您可以使用 [X2Paddle](https://github.com/PaddlePaddle/X2Paddle) 工具将模型转换为PadddlePaddle格式。
On ARM V7, only 800KB are taken up, while on ARM V8, 1.3MB are taken up with the 80 operators and 85 kernels in the dynamic libraries provided by Paddle Lite. **二. 模型优化**
Paddle Lite enables immediate inference without extra optimization. Paddle Lite框架拥有优秀的加速、优化策略及实现,包含量化、子图融合、Kernel优选等优化手段。优化后的模型更轻量级,耗费资源更少,并且执行速度也更快。
这些优化通过Paddle Lite提供的opt工具实现。opt工具还可以统计并打印出模型中的算子信息,并判断不同硬件平台下Paddle Lite的支持情况。您获取PaddlePaddle格式的模型之后,一般需要通该opt工具做模型优化。opt工具的下载和使用,请参考 [模型优化方法](https://paddle-lite.readthedocs.io/zh/latest/user_guides/model_optimize_tool.html)
### High Performance **三. 下载或编译**
Paddle Lite enables device-optimized kernels, maximizing ARM CPU performance. Paddle Lite提供了Android/iOS/X86平台的官方Release预测库下载,我们优先推荐您直接下载 [Paddle Lite预编译库](https://paddle-lite.readthedocs.io/zh/latest/user_guides/release_lib.html)
您也可以根据目标平台选择对应的[源码编译方法](https://paddle-lite.readthedocs.io/zh/latest/user_guides/source_compile.html)。Paddle Lite 提供了源码编译脚本,位于 `lite/tools/`文件夹下,只需要 [准备环境](https://paddle-lite.readthedocs.io/zh/latest/user_guides/source_compile.html#id2)[调用编译脚本](https://paddle-lite.readthedocs.io/zh/latest/user_guides/source_compile.html#paddlelite) 两个步骤即可一键编译得到目标平台的Paddle Lite预测库。
It also supports INT8 quantizations with [PaddleSlim model compression tools](https://github.com/PaddlePaddle/models/tree/v1.5/PaddleSlim), reducing the size of models and increasing the performance of models. **四. 预测示例**
On Huawei NPU and FPGA, the performance is also boosted. Paddle Lite提供了C++、Java、Python三种API,并且提供了相应API的完整使用示例:
The latest benchmark is located at [benchmark](https://paddlepaddle.github.io/Paddle-Lite/develop/benchmark/) - [C++完整示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/cpp_demo.html)
- [Java完整示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/java_demo.html)
- [Python完整示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/python_demo.html)
### High Compatibility 您可以参考示例中的说明快速了解使用方法,并集成到您自己的项目中去。
Hardware compatibility: Paddle Lite supports a diversity of hardwares — ARM CPU, Mali GPU, Adreno GPU, Huawei NPU and FPGA. In the near future, we will also support AI microchips from Cambricon and Bitmain. 针对不同的硬件平台,Paddle Lite提供了各个平台的完整示例:
Model compatibility: The Op of Paddle Lite is fully compatible to that of PaddlePaddle. The accuracy and performance of 18 models (mostly CV models and OCR models) and 85 operators have been validated. In the future, we will also support other models. - [Android示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/android_app_demo.html) [[图像分类]](https://paddlelite-demo.bj.bcebos.com/apps/android/mobilenet_classification_demo.apk) [[目标检测]](https://paddlelite-demo.bj.bcebos.com/apps/android/yolo_detection_demo.apk) [[口罩检测]](https://paddlelite-demo.bj.bcebos.com/apps/android/mask_detection_demo.apk) [[人脸关键点]](https://paddlelite-demo.bj.bcebos.com/apps/android/face_keypoints_detection_demo.apk) [[人像分割]](https://paddlelite-demo.bj.bcebos.com/apps/android/human_segmentation_demo.apk)
- [iOS示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/ios_app_demo.html)
- [ARMLinux示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/linux_arm_demo.html)
- [X86示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/x86.html)
- [CUDA示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/cuda.html)
- [OpenCL示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/opencl.html)
- [FPGA示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/fpga.html)
- [Huawei NPU示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/npu.html)
- [Baidu XPU示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/baidu_xpu.html)
- [RKNPU示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/rockchip_npu.html)
- [MTK APU示例](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/mediatek_apu.html)
Framework compatibility: In addition to models trained on PaddlePaddle, those trained on Caffe and TensorFlow can also be converted to be used on Paddle Lite, via [X2Paddle](https://github.com/PaddlePaddle/X2Paddle). In the future to come, we will also support models of ONNX format.
## Architecture
Paddle Lite is designed to support a wide range of hardwares and devices, and it enables mixed execution of a single model on multiple devices, optimization on various phases, and leight-weighted applications on devices. ## 主要特性
![img](https://user-images.githubusercontent.com/45189361/70908123-6ce4fd00-2045-11ea-97e1-ad08446c5c86.png) - **多硬件支持:**
- Paddle Lite架构已经验证和完整支持从 Mobile 到 Server [多种硬件平台](https://paddle-lite.readthedocs.io/zh/latest/introduction/support_hardware.html),包括 ARM CPU、Mali GPU、Adreno GPU、华为 NPU,以及 FPGA 等,且正在不断增加更多新硬件支持。
- 各个硬件平台的 Kernel 在代码层和执行层互不干扰,用户不仅可以自由插拔任何硬件,还支持任意系统可见硬件之间的[混合调度](https://paddle-lite.readthedocs.io/zh/latest/introduction/tech_highlights.html#id7)
- **轻量级部署**
- Paddle Lite在设计上对图优化模块和执行引擎实现了良好的解耦拆分,移动端可以直接部署执行阶段,无任何第三方依赖。
- 包含完整的80个 op+85个 Kernel 的动态库,对于ARMV7只有800K,ARMV8下为1.3M,并可以通过[裁剪预测](https://paddle-lite.readthedocs.io/zh/latest/user_guides/library_tailoring.html)库进一步减小预测库文件大小。
- **高性能:**
- 极致的 ARM CPU 性能优化:针对不同微架构特点实现kernel的定制,最大发挥计算性能,在主流模型上展现出领先的速度优势。
- 支持 [PaddleSlim模型压缩工具](https://github.com/PaddlePaddle/PaddleSlim):支持量化训练、离线量化等多种量化方式,最优可在不损失精度的前提下进一步提升模型推理性能。性能数据请参考 [benchmark](https://paddlepaddle.github.io/Paddle-Lite/develop/benchmark/)
- **多模型多算子**
- Paddle Lite和PaddlePaddle训练框架的OP对齐,提供广泛的模型支持能力。
- 目前已严格验证24个模型200个OP的精度和性能,对视觉类模型做到了较为充分的支持,覆盖分类、检测和定位,包含了特色的OCR模型的支持,并在不断丰富中。具体请参考[支持OP](https://paddle-lite.readthedocs.io/zh/latest/introduction/support_operation_list.html)
- **强大的图分析和优化能力**
- 不同于常规的移动端预测引擎基于 Python 脚本工具转化模型, Lite 架构上有完整基于 C++ 开发的 IR 及相应 Pass 集合,以支持操作熔合,计算剪枝,存储优化,量化计算等多类计算图优化。更多的优化策略可以简单通过 [新增 Pass](https://paddle-lite.readthedocs.io/zh/latest/develop_guides/add_new_pass.html) 的方式模块化支持。
As is shown in the figure above, analysis phase includes Machine IR module, and it enables optimizations like Op fusion and redundant computation pruning. Besides, excecution phase only involves Kernal exevution, so it can be deployed on its own to ensure maximized light-weighted deployment. ## 持续集成
## Key Info about the Update | System | X86 Linux | ARM Linux | Android (GCC/Clang) | iOS |
|:-:|:-:|:-:|:-:|:-:|
| CPU(32bit) | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) |
| CPU(64bit) | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) |
| OpenCL | - | - | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | - |
| CUDA | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | - | - |
| FPGA | - | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | - | - |
| 华为NPU | - | - | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | - |
| 百度 XPU | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | - | - |
| RK NPU | - | - | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | - |
| MTK APU | - | - | ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) | - |
The earlier Paddle-Mobile was designed to be compatible with PaddlePaddle and multiple hardwares, including ARM CPU, Mali GPU, Adreno GPU, FPGA, ARM-Linux and Apple's GPU Metal. Within Baidu, inc, many product lines have been using Paddle-Mobile. For more details, please see: [mobile/README](https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/mobile/README.md).
As an update of Paddle-Mobile, Paddle Lite has incorporated many older capabilities into the [new architecture](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite). For the time being, the code of Paddle-mobile will be kept under the directory `mobile/`, before complete transfer to Paddle Lite. ## 架构设计
For demands of Apple's GPU Metal and web front end inference, please see `./metal` and `./web` . These two modules will be further developed and maintained. Paddle Lite 的架构设计着重考虑了对多硬件和平台的支持,并且强化了多个硬件在一个模型中混合执行的能力,多个层面的性能优化处理,以及对端侧应用的轻量化设计。
## Special Thanks <p align="center"><img width="500" src="https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/docs/images/architecture.png"/></p>
Paddle Lite has referenced the following open-source projects: 其中,Analysis Phase 包括了 MIR(Machine IR) 相关模块,能够对原有的模型的计算图针对具体的硬件列表进行算子融合、计算裁剪 在内的多种优化。Execution Phase 只涉及到Kernel 的执行,且可以单独部署,以支持极致的轻量级部署。
<<<<<<< HEAD
- [ARM compute library](http://agroup.baidu.com/paddle-infer/md/article/%28https://github.com/ARM-software/ComputeLibrary%29) - [ARM compute library](http://agroup.baidu.com/paddle-infer/md/article/%28https://github.com/ARM-software/ComputeLibrary%29)
- [Anakin](https://github.com/PaddlePaddle/Anakin). The optimizations under Anakin has been incorporated into Paddle Lite, and so there will not be any future updates of Anakin. As another high-performance inference project under PaddlePaddle, Anakin has been forward-looking and helpful to the making of Paddle Lite. - [Anakin](https://github.com/PaddlePaddle/Anakin). The optimizations under Anakin has been incorporated into Paddle Lite, and so there will not be any future updates of Anakin. As another high-performance inference project under PaddlePaddle, Anakin has been forward-looking and helpful to the making of Paddle Lite.
=======
## 进一步了解Paddle Lite
>>>>>>> fc8c0852... [DOC] Update Readme 2.0 (#4209)
## Feedback and Community Support
如果您想要进一步了解Paddle Lite,下面是进一步学习和使用Paddle-Lite的相关内容:
- Questions, reports, and suggestions are welcome through Github Issues! ### 文档和示例
- Forum: Opinions and questions are welcome at our [PaddlePaddle Forum](https://ai.baidu.com/forum/topic/list/168) - 完整文档: [Paddle Lite 文档](https://paddle-lite.readthedocs.io/zh/latest/)
- WeChat Official Account: PaddlePaddle - API文档:
- QQ Group Chat: 696965088 - [C++ API文档](https://paddle-lite.readthedocs.io/zh/latest/api_reference/cxx_api_doc.html)
<p align="center"><img width="200" height="200" src="https://user-images.githubusercontent.com/45189361/64117959-1969de80-cdc9-11e9-84f7-e1c2849a004c.jpeg"/>&#8194;&#8194;&#8194;&#8194;&#8194;<img width="200" height="200" margin="500" src="https://user-images.githubusercontent.com/45189361/64117844-cb54db00-cdc8-11e9-8c08-24bbe594608e.jpeg"/></p> - [Java API文档](https://paddle-lite.readthedocs.io/zh/latest/api_reference/java_api_doc.html)
<p align="center">&#8194; WeChat Official Account&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;QQ Group Chat&#8194;&#8194;&#8194;&#8194;&#8194;</p> - [Python API文档](https://paddle-lite.readthedocs.io/zh/latest/api_reference/python_api_doc.html)
- [CV图像处理API文档](https://paddle-lite.readthedocs.io/zh/latest/api_reference/cv.html)
- Paddle Lite工程示例: [Paddle-Lite-Demo](https://github.com/PaddlePaddle/Paddle-Lite-Demo)
### 关键技术
- 模型量化:
- [静态离线量化](https://paddle-lite.readthedocs.io/zh/latest/user_guides/post_quant_with_data.html)
- [动态离线量化](https://paddle-lite.readthedocs.io/zh/latest/user_guides/post_quant_no_data.html)
- [量化训练](https://paddle-lite.readthedocs.io/zh/latest/user_guides/model_quantization.html)
- 调试分析:[调试和性能分析工具](https://paddle-lite.readthedocs.io/zh/latest/user_guides/debug.html)
- 移动端模型训练:点击[了解一下](https://paddle-lite.readthedocs.io/zh/latest/demo_guides/cpp_train_demo.html)
- 飞桨预训练模型库:试试在[PaddleHub](https://www.paddlepaddle.org.cn/hublist?filter=hot&value=1)浏览和下载Paddle的预训练模型
### FAQ
- FAQ:常见问题,可以访问[FAQ](https://paddle-lite.readthedocs.io/zh/latest/introduction/faq.html)、搜索Issues、或者通过页面底部的联系方式联系我们
###贡献代码
- 贡献代码:如果您想一起参与Paddle Lite的开发,贡献代码,请访问[开发者共享文档](https://paddle-lite.readthedocs.io/zh/latest/develop_guides/for-developer.html)
## 交流与反馈
* 欢迎您通过[Github Issues](https://github.com/PaddlePaddle/Paddle-Lite/issues)来提交问题、报告与建议
* 技术交流QQ群: 一群696965088(已满) ;二群,959308808
<p align="center"><img width="200" height="200" src="https://user-images.githubusercontent.com/45189361/64117959-1969de80-cdc9-11e9-84f7-e1c2849a004c.jpeg"/>&#8194;&#8194;&#8194;&#8194;&#8194;<img width="200" height="200" margin="500" src="https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/docs/images/qq-group-chat.png"/></p>
<p align="center"> &#8194;&#8194;&#8194;微信公众号&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;官方技术交流QQ群</p>
## 版权和许可证
Paddle-Lite由[Apache-2.0 license](LICENSE)提供
# Paddle Lite
<!--[![Build Status](https://travis-ci.org/PaddlePaddle/Paddle-Lite.svg?branch=develop&longCache=true&style=flat-square)](https://travis-ci.org/PaddlePaddle/Paddle-Lite)-->
[![Documentation Status](https://img.shields.io/badge/中文文档-最新-brightgreen.svg)](https://paddle-lite.readthedocs.io/zh/latest/)
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)
<!-- [![Release](https://img.shields.io/github/release/PaddlePaddle/Paddle-Mobile.svg)](https://github.com/PaddlePaddle/Paddle-Mobile/releases) -->
Paddle Lite为Paddle-Mobile的升级版,定位支持包括手机移动端在内更多场景的轻量化高效预测,支持更广泛的硬件和平台,是一个高性能、轻量级的深度学习预测引擎。在保持和PaddlePaddle无缝对接外,也兼容支持其他训练框架产出的模型。
完整使用文档位于 [PaddleLite 文档](https://paddle-lite.readthedocs.io/zh/latest/)
## 特性
### 轻量级
执行阶段和计算优化阶段实现良好解耦拆分,移动端可以直接部署执行阶段,无任何第三方依赖。
包含完整的80个 Op+85个 Kernel 的动态库,对于ARMV7只有800K,ARMV8下为1.3M,并可以裁剪到更低。
在应用部署时,载入模型即可直接预测,无需额外分析优化。
### 高性能
极致的 ARM CPU 性能优化,针对不同微架构特点实现kernel的定制,最大发挥计算性能,在主流模型上展现出领先的速度优势。
支持INT8量化计算,结合 [PaddleSlim 模型压缩工具](https://github.com/PaddlePaddle/models/tree/v1.5/PaddleSlim) 中 INT8量化训练功能,可以提供高精度高性能的预测能力。
在Huawei NPU, FPGA上也具有有很好的性能表现。
最新 Benchmark 位于 [benchmark](https://paddlepaddle.github.io/Paddle-Lite/develop/benchmark/)
### 通用性
硬件方面,Paddle Lite 的架构设计为多硬件兼容支持做了良好设计。除了支持ARM CPU、Mali GPU、Adreno GPU,还特别支持了华为 NPU,以及 FPGA 等边缘设备广泛使用的硬件。即将支持支持包括寒武纪、比特大陆等AI芯片,未来会增加对更多硬件的支持。
模型支持方面,Paddle Lite和PaddlePaddle训练框架的Op对齐,提供更广泛的模型支持能力。目前已严格验证18个模型85个OP的精度和性能,对视觉类模型做到了较为充分的支持,覆盖分类、检测和定位,包含了特色的OCR模型的支持。未来会持续增加更多模型的支持验证。
框架兼容方面:除了PaddlePaddle外,对其他训练框架也提供兼容支持。当前,支持Caffe 和 TensorFlow 训练出来的模型,通过X2Paddle (https://github.com/PaddlePaddle/X2Paddle) 转换工具实现。接下来将会对ONNX等格式模型提供兼容支持。
## 架构
PaddleLite 的架构设计着重考虑了对多硬件和平台的支持,并且强化了多个硬件在一个模型中混合执行的能力,多个层面的性能优化处理,以及对端侧应用的轻量化设计。
![](https://user-images.githubusercontent.com/45189361/70908123-6ce4fd00-2045-11ea-97e1-ad08446c5c86.png)
其中,Analysis Phase 包括了 MIR(Machine IR) 相关模块,能够对原有的模型的计算图针对具体的硬件列表进行算子融合、计算裁剪 在内的多种优化。Execution Phase 只涉及到Kernel 的执行,且可以单独部署,以支持极致的轻量级部署。
## Paddle-Mobile升级为Paddle Lite的说明
原Paddle-Mobile作为一个致力于嵌入式平台的PaddlePaddle预测引擎,已支持多种硬件平台,包括ARM CPU、 Mali GPU、Adreno GPU,以及支持苹果设备的GPU Metal实现、ZU5、ZU9等FPGA开发板、树莓派等arm-linux开发板。在百度内已经过广泛业务场景应用验证。对应设计文档可参考: [mobile/README](https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/mobile/README.md)
Paddle-Mobile 整体升级重构并更名为Paddle Lite后,原paddle-mobile 的底层能力大部分已集成到[新架构 ](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite)下。作为过渡,暂时保留原Paddle-mobile代码。 主体代码位于 `mobile/` 目录中,后续一段时间会继续维护,并完成全部迁移。新功能会统一到[新架构 ](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite)下开发。
metal, web的模块相对独立,会继续在 `./metal``./web` 目录下开发和维护。对苹果设备的GPU Metal实现的需求及web前端预测需求,可以直接进入这两个目录。
## 致谢:
Paddle Lite 借鉴了以下开源项目:
- [ARM compute library]((https://github.com/ARM-software/ComputeLibrary))
- [Anakin](https://github.com/PaddlePaddle/Anakin) ,Anakin对应底层的一些优化实现已被集成到Paddle Lite。Anakin作为PaddlePaddle组织下的一个高性能预测项目,极具前瞻性,对Paddle Lite有重要贡献。Anakin已和本项目实现整合。之后,Anakin不再升级。
## 交流与反馈
* 欢迎您通过Github Issues来提交问题、报告与建议
* 微信公众号:飞桨PaddlePaddle
* QQ群: 696965088
<p align="center"><img width="200" height="200" src="https://user-images.githubusercontent.com/45189361/64117959-1969de80-cdc9-11e9-84f7-e1c2849a004c.jpeg"/>&#8194;&#8194;&#8194;&#8194;&#8194;<img width="200" height="200" margin="500" src="https://user-images.githubusercontent.com/45189361/64117844-cb54db00-cdc8-11e9-8c08-24bbe594608e.jpeg"/></p>
<p align="center"> &#8194;&#8194;&#8194;微信公众号&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;官方技术交流QQ群</p>
* 论坛: 欢迎大家在[PaddlePaddle论坛](https://ai.baidu.com/forum/topic/list/168)分享在使用PaddlePaddle中遇到的问题和经验, 营造良好的论坛氛围
# Paddle Lite
[简体中文](README.md) | English
[![Build Status](https://travis-ci.org/PaddlePaddle/Paddle-Lite.svg?branch=develop&longCache=true&style=flat-square)](https://travis-ci.org/PaddlePaddle/Paddle-Lite) [![Documentation Status](https://img.shields.io/badge/中文文档-最新-brightgreen.svg)](https://paddle-lite.readthedocs.io/zh/latest/) [![Release](https://img.shields.io/github/release/PaddlePaddle/Paddle-Lite.svg)](https://github.com/PaddlePaddle/Paddle-Lite/releases) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)
Paddle Lite is an updated version of Paddle-Mobile, an open-open source deep learning framework designed to make it easy to perform inference on mobile, embeded, and IoT devices. It is compatible with PaddlePaddle and pre-trained models from other sources.
For tutorials, please see [PaddleLite Document](https://paddle-lite.readthedocs.io/zh/latest/).
## Key Features
### Light Weight
On mobile devices, execution module can be deployed without third-party libraries, because our excecution module and analysis module are decoupled.
On ARM V7, only 800KB are taken up, while on ARM V8, 1.3MB are taken up with the 80 operators and 85 kernels in the dynamic libraries provided by Paddle Lite.
Paddle Lite enables immediate inference without extra optimization.
### High Performance
Paddle Lite enables device-optimized kernels, maximizing ARM CPU performance.
It also supports INT8 quantizations with [PaddleSlim model compression tools](https://github.com/PaddlePaddle/models/tree/v1.5/PaddleSlim), reducing the size of models and increasing the performance of models.
On Huawei NPU and FPGA, the performance is also boosted.
The latest benchmark is located at [benchmark](https://paddlepaddle.github.io/Paddle-Lite/develop/benchmark/)
### High Compatibility
Hardware compatibility: Paddle Lite supports a diversity of hardwares — ARM CPU, Mali GPU, Adreno GPU, Huawei NPU and FPGA. In the near future, we will also support AI microchips from Cambricon and Bitmain.
Model compatibility: The Op of Paddle Lite is fully compatible to that of PaddlePaddle. The accuracy and performance of 18 models (mostly CV models and OCR models) and 85 operators have been validated. In the future, we will also support other models.
Framework compatibility: In addition to models trained on PaddlePaddle, those trained on Caffe and TensorFlow can also be converted to be used on Paddle Lite, via [X2Paddle](https://github.com/PaddlePaddle/X2Paddle). In the future to come, we will also support models of ONNX format.
## Architecture
Paddle Lite is designed to support a wide range of hardwares and devices, and it enables mixed execution of a single model on multiple devices, optimization on various phases, and leight-weighted applications on devices.
![img](https://user-images.githubusercontent.com/45189361/70908123-6ce4fd00-2045-11ea-97e1-ad08446c5c86.png)
As is shown in the figure above, analysis phase includes Machine IR module, and it enables optimizations like Op fusion and redundant computation pruning. Besides, excecution phase only involves Kernal exevution, so it can be deployed on its own to ensure maximized light-weighted deployment.
## Key Info about the Update
The earlier Paddle-Mobile was designed to be compatible with PaddlePaddle and multiple hardwares, including ARM CPU, Mali GPU, Adreno GPU, FPGA, ARM-Linux and Apple's GPU Metal. Within Baidu, inc, many product lines have been using Paddle-Mobile. For more details, please see: [mobile/README](https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/mobile/README.md).
As an update of Paddle-Mobile, Paddle Lite has incorporated many older capabilities into the [new architecture](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite). For the time being, the code of Paddle-mobile will be kept under the directory `mobile/`, before complete transfer to Paddle Lite.
For demands of Apple's GPU Metal and web front end inference, please see `./metal` and `./web` . These two modules will be further developed and maintained.
## Special Thanks
Paddle Lite has referenced the following open-source projects:
- [ARM compute library](https://github.com/ARM-software/ComputeLibrary%29)
- [Anakin](https://github.com/PaddlePaddle/Anakin). The optimizations under Anakin has been incorporated into Paddle Lite, and so there will not be any future updates of Anakin. As another high-performance inference project under PaddlePaddle, Anakin has been forward-looking and helpful to the making of Paddle Lite.
## Feedback and Community Support
- Questions, reports, and suggestions are welcome through Github Issues!
- Forum: Opinions and questions are welcome at our [PaddlePaddle Forum](https://ai.baidu.com/forum/topic/list/168)
- WeChat Official Account: PaddlePaddle
- QQ Group Chat: 696965088
<p align="center"><img width="200" height="200" src="https://user-images.githubusercontent.com/45189361/64117959-1969de80-cdc9-11e9-84f7-e1c2849a004c.jpeg"/>&#8194;&#8194;&#8194;&#8194;&#8194;<img width="200" height="200" margin="500" src="https://user-images.githubusercontent.com/45189361/64117844-cb54db00-cdc8-11e9-8c08-24bbe594608e.jpeg"/></p>
<p align="center">&#8194; WeChat Official Account&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;&#8194;QQ Group Chat&#8194;&#8194;&#8194;&#8194;&#8194;</p>
...@@ -61,7 +61,9 @@ opt.run() ...@@ -61,7 +61,9 @@ opt.run()
### `set_model_type(type)` ### `set_model_type(type)`
设置模型的输出类型,当前支持`naive_buffer``protobuf`两种格式,移动端预测需要转化为`naive_buffer` 设置模型的输出类型,当前支持`naive_buffer``protobuf`两种格式,移动端预测需要转化为`naive_buffer`
`naive_buffer`的优化后模型为以`.nb`名称结尾的单个文件。`protobuf`的优化后模型为文件夹下的`model``params`两个文件。将`model`重命名为`__model__`[Netron](https://lutzroeder.github.io/netron/)打开,即可查看优化后的模型结构。
参数: 参数:
......
...@@ -26,6 +26,7 @@ git checkout release/v2.6.0 ...@@ -26,6 +26,7 @@ git checkout release/v2.6.0
```bash ```bash
cd Paddle-Lite cd Paddle-Lite
# 请在Paddle-Lite当前目录下执行脚本
./lite/tools/build.sh --build_python=ON x86 ./lite/tools/build.sh --build_python=ON x86
# 其他可选择编译选项 # 其他可选择编译选项
......
docs/images/architecture.png

199.9 KB | W: | H:

docs/images/architecture.png

149.8 KB | W: | H:

docs/images/architecture.png
docs/images/architecture.png
docs/images/architecture.png
docs/images/architecture.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -15,6 +15,7 @@ Welcome to Paddle-Lite's documentation! ...@@ -15,6 +15,7 @@ Welcome to Paddle-Lite's documentation!
introduction/architecture introduction/architecture
introduction/support_hardware introduction/support_hardware
introduction/support_operation_list introduction/support_operation_list
introduction/support_model_list
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
......
# 支持模型
目前已严格验证24个模型的精度和性能,对视觉类模型做到了较为充分的支持,覆盖分类、检测和定位,包含了特色的OCR模型的支持,并在不断丰富中。
| 类别 | 类别细分 | 模型 | 支持Int8 | 支持平台 |
|-|-|:-:|:-:|-:|
| CV | 分类 | mobilenetv1 | Y | ARM,X86,NPU,RKNPU,APU |
| CV | 分类 | mobilenetv2 | Y | ARM,X86,NPU |
| CV | 分类 | resnet18 | Y | ARM,NPU |
| CV | 分类 | resnet50 | Y | ARM,X86,NPU,XPU |
| CV | 分类 | mnasnet | | ARM,NPU |
| CV | 分类 | efficientnet | | ARM |
| CV | 分类 | squeezenetv1.1 | | ARM,NPU |
| CV | 分类 | ShufflenetV2 | Y | ARM |
| CV | 分类 | shufflenet | Y | ARM |
| CV | 分类 | inceptionv4 | Y | ARM,X86,NPU |
| CV | 分类 | vgg16 | Y | ARM |
| CV | 分类 | googlenet | Y | ARM,X86 |
| CV | 检测 | mobilenet_ssd | Y | ARM,NPU* |
| CV | 检测 | mobilenet_yolov3 | Y | ARM,NPU* |
| CV | 检测 | Faster RCNN | | ARM |
| CV | 检测 | Mask RCNN | | ARM |
| CV | 分割 | Deeplabv3 | Y | ARM |
| CV | 分割 | unet | | ARM |
| CV | 人脸 | facedetection | | ARM |
| CV | 人脸 | facebox | | ARM |
| CV | 人脸 | blazeface | Y | ARM |
| CV | 人脸 | mtcnn | | ARM |
| CV | OCR | ocr_attention | | ARM |
| NLP | 机器翻译 | transformer | | ARM,NPU* |
> **注意:** NPU* 代表ARM+NPU异构计算
# 编译选项说明
| 编译选项 | 说明 | 默认值 |
| :-- | :-- |--: |
| LITE_WITH_LOG | 是否输出日志信息 | ON |
| LITE_WITH_EXCEPTION | 是否在错误发生时,抛出异常 | OFF |
| LITE_WITH_TRAIN | 打开[模型训练功能](../../demo_guides/cpp_train_demo.html),支持移动端模型训练 | OFF |
| LITE_BUILD_EXTRA | 编译[全量预测库](library.html),包含更多算子和模型支持 | OFF |
| LITE_BUILD_TAILOR | 编译时[根据模型裁剪预测库](../library_tailoring.html),缩小预测库大小 | OFF |
| WITH_SYSTEM_BLAS | 编译时强制使用reference BLAS | OFF |
### 轻量级编译选项
适用于移动端编译,或者对预测库大小有要求的运行环境:
| 编译选项 | 说明 | 默认值 |
| :-- | :-- | --: |
| LITE_WITH_LIGHT_WEIGHT_FRAMEWORK | 编译移动端轻量级预测框架 | OFF |
| LITE_ON_TINY_PUBLISH | 编译移动端部署库,无第三方库依赖 | OFF |
### 全功能编译选项
适用于服务端编译,或者对预测库大小没有要求的运行环境:
| 编译选项 | 说明 | 默认值 |
| :-- | :-- | --: |
| LITE_WITH_PROFILE | 编译[Profiler工具](../debug.html),用于CPU上kernel耗时统计 | OFF |
| LITE_WITH_PRECISION_PROFILE | 开启Profiler工具的模型精度分析功能 | OFF |
| WITH_TESTING | 编译Lite单测模块 | OFF |
## 平台相关编译选项
| 编译选项 | 说明 | 适用平台 | 默认值 |
| :-- | :-- | --: | --: |
| LITE_WITH_ARM | 编译支持Andriod或ARMLinux平台预测库 | Andriod / ARMLinux | OFF |
| LITE_WITH_JAVA | 编译支持[Java API](../../api_reference/java_api_doc.html)的预测库 | Andriod / ARMLinux | OFF |
| LITE_WITH_ARM_CLANG | 使用clang编译ARM平台预测库 | Andriod / ARMLinux |OFF |
| WITH_ARM_DOTPROD | 编译ARM点积指令优化的预测库 | Andriod / ARMLinux |ON |
| LITE_WITH_CV | 编译[CV图像加速库](../../api_reference/cv.html) | Andirod / ARMLinux |OFF |
| LITE_WITH_OPENMP | 编译时打开OpenMP | ARMLinux / X86 | ON |
| LITE_WITH_X86 | 编译[X86平台](../../demo_guides/x86.html)预测库 | X86 | ON |
| WITH_AVX | 编译有AVX指令优化的预测库 | X86 |ON IF ${AVX_FOUND} |
| WITH_MKL | 编译有Intel MKL支持的预测库 | X86 |ON IF ${AVX_FOUND} |
| LITE_ON_MODEL_OPTIMIZE_TOOL | 编译[模型优化工具opt](../model_optimize_tool.html) | X86 |OFF|
| LITE_WITH_CUDA | 编译[CUDA平台](../../demo_guides/cuda.html)预测库 | CUDA | OFF |
| WITH_DSO | 编译动态CUDA库 | CUDA | ON |
| LITE_WITH_STATIC_CUDA | 编译静态CUDA库 | CUDA |OFF |
| LITE_WITH_NVTX | 是否打开NVIDIA Tools Extension (NVTX) | CUDA |OFF |
| CUDA_WITH_FP16 | 编译CUDA FP16支持| CUDA |OFF |
| LITE_WITH_PYTHON | 编译支持[Python API](../../api_reference/python_api_doc.html)的预测库 | X86 / CUDA |OFF |
| LITE_WITH_OPENCL | 编译[OpenCL平台](../../demo_guides/opencl.html)预测库 | OpenCL | OFF |
| LITE_WITH_FPGA | 编译[FPGA平台](../../demo_guides/fpga.html)预测库 | FPGA | OFF |
| LITE_WITH_NPU | 编译[华为NPU平台](../../demo_guides/npu.html)预测库 | NPU | OFF |
| LITE_WITH_RKNPU | 编译[RK NPU平台](../../demo_guides/rockchip_npu.html)预测库 | RKNPU | OFF |
| LITE_WITH_XPU | 编译[百度XPU平台](../../demo_guides/baidu_xpu.html)预测库 | XPU |OFF |
| LITE_WITH_XTCL | 通过XTCL方式支持百度XPU,默认Kernel方式 | XPU |OFF IF LITE_WITH_XPU |
| LITE_WITH_APU | 编译[MTK APU平台](../../demo_guides/mediatek_apu.html)预测库 | APU |OFF |
...@@ -5,12 +5,12 @@ Lite预测库分为**基础预测库**和**全量预测库(with_extra)**:基 ...@@ -5,12 +5,12 @@ Lite预测库分为**基础预测库**和**全量预测库(with_extra)**:基
编译时由编译选项 `build_extra`(默认为OFF)控制,`--build_extra=OFF`时编译**基础预测库**`--build_extra=ON`时编译**全量预测库** 编译时由编译选项 `build_extra`(默认为OFF)控制,`--build_extra=OFF`时编译**基础预测库**`--build_extra=ON`时编译**全量预测库**
## 基础预测库( [基础OP列表](../advanced_user_guides/support_operation_list.html#basic-operators) ) ## 基础预测库( [基础OP列表](../../introduction/support_operation_list.html#basic-operators) )
### 支持功能 ### 支持功能
(1)87个[基础OP](../advanced_user_guides/support_operation_list.html#basic-operators) (2)9个基础模型 (3)3个in8量化模型 (1)87个[基础OP](../../introduction/support_operation_list.html#basic-operators) (2)9个基础模型 (3)3个in8量化模型
### 支持的模型 ### 支持的模型
...@@ -39,12 +39,12 @@ mobilenet_v1 mobilenet_v2 resnet50 ...@@ -39,12 +39,12 @@ mobilenet_v1 mobilenet_v2 resnet50
``` ```
## 全量预测库( [OP列表](../advanced_user_guides/support_operation_list.html#op) ) ## 全量预测库( [OP列表](../../introduction/support_operation_list.html#op) )
### 支持功能 ### 支持功能
Paddle-Lite中的全量算子( [基础OP](../advanced_user_guides/support_operation_list.html#basic-operators) + [Extra OP](../advanced_user_guides/support_operation_list.html#extra-operators-build-extra-on) Paddle-Lite中的全量算子( [基础OP](../../introduction/support_operation_list.html#basic-operators) + [Extra OP](../../introduction/support_operation_list.html#extra-operators-build-extra-on)
### 特点 ### 特点
包含更多算子、支持更多模型,但体量更大。 包含更多算子、支持更多模型,但体量更大。
......
...@@ -70,7 +70,8 @@ paddle_lite_opt \ ...@@ -70,7 +70,8 @@ paddle_lite_opt \
* 如果待优化的fluid模型是非combined形式,请设置`--model_dir`,忽略`--model_file``--param_file` * 如果待优化的fluid模型是非combined形式,请设置`--model_dir`,忽略`--model_file``--param_file`
* 如果待优化的fluid模型是combined形式,请设置`--model_file``--param_file`,忽略`--model_dir` * 如果待优化的fluid模型是combined形式,请设置`--model_file``--param_file`,忽略`--model_dir`
* 优化后的模型为以`.nb`名称结尾的单个文件。 * `naive_buffer`的优化后模型为以`.nb`名称结尾的单个文件。
* `protobuf`的优化后模型为文件夹下的`model``params`两个文件。将`model`重命名为`__model__`[Netron](https://lutzroeder.github.io/netron/)打开,即可查看优化后的模型结构。
* 删除`prefer_int8_kernel`的输入参数,`opt`自动判别是否是量化模型,进行相应的优化操作。 * 删除`prefer_int8_kernel`的输入参数,`opt`自动判别是否是量化模型,进行相应的优化操作。
### 功能二:统计模型算子信息、判断是否支持 ### 功能二:统计模型算子信息、判断是否支持
......
...@@ -73,7 +73,8 @@ paddle_lite_opt \ ...@@ -73,7 +73,8 @@ paddle_lite_opt \
* 如果待优化的fluid模型是非combined形式,请设置`--model_dir`,忽略`--model_file``--param_file` * 如果待优化的fluid模型是非combined形式,请设置`--model_dir`,忽略`--model_file``--param_file`
* 如果待优化的fluid模型是combined形式,请设置`--model_file``--param_file`,忽略`--model_dir` * 如果待优化的fluid模型是combined形式,请设置`--model_file``--param_file`,忽略`--model_dir`
* 优化后的模型为以`.nb`名称结尾的单个文件。 * `naive_buffer`的优化后模型为以`.nb`名称结尾的单个文件。
* `protobuf`的优化后模型为文件夹下的`model``params`两个文件。将`model`重命名为`__model__`[Netron](https://lutzroeder.github.io/netron/)打开,即可查看优化后的模型结构。
* 删除`prefer_int8_kernel`的输入参数,`opt`自动判别是否是量化模型,进行相应的优化操作。 * 删除`prefer_int8_kernel`的输入参数,`opt`自动判别是否是量化模型,进行相应的优化操作。
### 功能二:统计模型算子信息、判断是否支持 ### 功能二:统计模型算子信息、判断是否支持
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
**使用方法** **使用方法**
(1)打印帮助帮助信息:` sh ./auto_transform.sh` (1)打印帮助帮助信息:`sh ./auto_transform.sh`,Ubuntu下请执行 `bash ./auto_transform.sh`
(2)转化模型方法 (2)转化模型方法
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
- arm_os=`android\ios\armlinux` 安装平台,支持的arm端移动平台包括 `ios``armlinux``android` - arm_os=`android\ios\armlinux` 安装平台,支持的arm端移动平台包括 `ios``armlinux``android`
- toolchain=`gcc/clang` 源码编译时的编译器,默认为`gcc`编译器 - toolchain=`gcc/clang` 源码编译时的编译器,默认为`gcc`编译器
- android_stl=`c++_static/c++_shared` Lite预测库链接STL库的方式,支持静态或动态链接 - android_stl=`c++_static/c++_shared` Lite预测库链接STL库的方式,支持静态或动态链接
- with_extra=`ON/OFF` 是否编译全量OP,OFF时只编译CV相关基础OP,[参数详情](library) - with_extra=`ON/OFF` 是否编译全量OP,OFF时只编译CV相关基础OP,[参数详情](./Compile/library)
- with_cv=`ON/OFF` 是否编译编译Paddle-Lite CV 相关API - with_cv=`ON/OFF` 是否编译编译Paddle-Lite CV 相关API
......
...@@ -278,3 +278,7 @@ rm -rf third-party ...@@ -278,3 +278,7 @@ rm -rf third-party
``` ```
之后再根据本文档,进行后续编译时,便会忽略第三方依赖对应的`submodule`,改为直接下载第三方压缩包。 之后再根据本文档,进行后续编译时,便会忽略第三方依赖对应的`submodule`,改为直接下载第三方压缩包。
### 源码编译选项说明
源码编译中涉及的编译选项,请参考[编译选项说明](./Compile/compile_options.md)
# 模型转换工具 X2Paddle # 模型转换工具 X2Paddle
X2Paddle可以将caffe、tensorflow、onnx模型转换成Paddle支持的模型。目前支持版本为caffe 1.0;tensorflow 1.x,推荐1.4.0;ONNX 1.6.0,OpSet支持 9, 10, 11版本。 X2Paddle可以将caffe、tensorflow、onnx模型转换成Paddle支持的模型。目前支持版本为caffe 1.0;tensorflow 1.x,推荐1.4.0;ONNX 1.6.0,OpSet支持 9, 10, 11版本。如果您使用的是PyTorch框架,请先转换为ONNX模型之后再使用X2Paddle工具转化为Paddle模型。
[X2Paddle](https://github.com/PaddlePaddle/X2Paddle)支持将Caffe/TensorFlow模型转换为PaddlePaddle模型。 [X2Paddle](https://github.com/PaddlePaddle/X2Paddle)支持将Caffe/TensorFlow/ONNX模型转换为PaddlePaddle模型。
支持的模型可参考**X2Paddle模型测试库:** 支持的模型可参考[X2Paddle模型测试库](https://github.com/PaddlePaddle/X2Paddle/blob/develop/x2paddle_model_zoo.md)
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 | | | |
## 安装 ## 安装
...@@ -46,18 +24,26 @@ pip install git+https://github.com/PaddlePaddle/X2Paddle.git@develop ...@@ -46,18 +24,26 @@ pip install git+https://github.com/PaddlePaddle/X2Paddle.git@develop
### Caffe ### Caffe
``` ```
x2paddle --framework caffe \ x2paddle --framework=caffe \
--prototxt model.proto \ --prototxt=deploy.prototxt \
--weight model.caffemodel \ --weight=deploy.caffemodel \
--save_dir paddle_model --save_dir=pd_model
``` ```
### TensorFlow ### TensorFlow
``` ```
x2paddle --framework tensorflow \ x2paddle --framework=tensorflow \
--model model.pb \ --model=tf_model.pb \
--save_dir paddle_model --save_dir=pd_model
```
### ONNX
```
x2paddle --framework=onnx \
--model=onnx_model.onnx \
--save_dir=pd_model
``` ```
## 转换结果说明 ## 转换结果说明
...@@ -68,4 +54,4 @@ x2paddle --framework tensorflow \ ...@@ -68,4 +54,4 @@ x2paddle --framework tensorflow \
## 问题反馈 ## 问题反馈
X2Paddle使用时存在问题时,欢迎您将问题或Bug报告以[Github Issues](https://github.com/PaddlePaddle/X2Paddle/issues)的形式提交给我们,我们会实时跟进。 受限于不同框架的差异,部分模型可能会存在目前无法转换的情况,如TensorFlow中包含控制流的模型,NLP模型等。对于CV常见的模型,如若您发现无法转换或转换失败,存在较大差异等问题,欢迎您将问题或Bug报告以[Github Issues](https://github.com/PaddlePaddle/X2Paddle/issues)的形式提交给我们,我们会实时跟进。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册