mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-04 16:22:57 +08:00
[Doc] Update Android SDK usage docs (#727)
* [Doc] Update Android Usage docs * [Doc] Update Android en build docs * fix typos
This commit is contained in:
54
README_CN.md
54
README_CN.md
@@ -41,29 +41,29 @@
|
|||||||
- 🔥 [**【三日部署直播课回放】**](https://aistudio.baidu.com/aistudio/course/introduce/27800)
|
- 🔥 [**【三日部署直播课回放】**](https://aistudio.baidu.com/aistudio/course/introduce/27800)
|
||||||
|
|
||||||
- **社区交流**
|
- **社区交流**
|
||||||
|
|
||||||
- **Slack**:Join our [Slack community](https://join.slack.com/t/fastdeployworkspace/shared_invite/zt-1hhvpb279-iw2pNPwrDaMBQ5OQhO3Siw) and chat with other community members about ideas
|
- **Slack**:Join our [Slack community](https://join.slack.com/t/fastdeployworkspace/shared_invite/zt-1hhvpb279-iw2pNPwrDaMBQ5OQhO3Siw) and chat with other community members about ideas
|
||||||
|
|
||||||
- **微信**:扫描二维码,填写问卷加入技术社区,与社区开发者探讨部署的痛点与方案
|
- **微信**:扫描二维码,填写问卷加入技术社区,与社区开发者探讨部署的痛点与方案
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<img src="https://user-images.githubusercontent.com/54695910/200145290-d5565d18-6707-4a0b-a9af-85fd36d35d13.jpg" width = "120" height = "120" />
|
<img src="https://user-images.githubusercontent.com/54695910/200145290-d5565d18-6707-4a0b-a9af-85fd36d35d13.jpg" width = "120" height = "120" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
- 🔥 **2022.11.23:Release FastDeploy [release v0.8.0](https://github.com/PaddlePaddle/FastDeploy/tree/release/0.8)**
|
- 🔥 **2022.11.23:Release FastDeploy [release v0.8.0](https://github.com/PaddlePaddle/FastDeploy/tree/release/0.8)**
|
||||||
|
|
||||||
- **🖥️ 服务端部署:支持更多的模型,推理性能进一步提升**
|
- **🖥️ 服务端部署:支持更多的模型,推理性能进一步提升**
|
||||||
|
|
||||||
- 新增 PIPNet、FaceLandmark1000 [人脸对齐模型](./examples/vision/facealign)的部署支持;
|
- 新增 PIPNet、FaceLandmark1000 [人脸对齐模型](./examples/vision/facealign)的部署支持;
|
||||||
- 新增[视频超分系列模型](./examples/vision/sr) PP-MSVSR、EDVR、BasicVSR 部署示例;
|
- 新增[视频超分系列模型](./examples/vision/sr) PP-MSVSR、EDVR、BasicVSR 部署示例;
|
||||||
- 升级[YOLOv7部署代码](https://github.com/PaddlePaddle/FastDeploy/pull/611),支持 predict 及 batch_predict;
|
- 升级[YOLOv7部署代码](https://github.com/PaddlePaddle/FastDeploy/pull/611),支持 predict 及 batch_predict;
|
||||||
- 新增 [UIE服务化部署](./examples/text/uie) 案例;
|
- 新增 [UIE服务化部署](./examples/text/uie) 案例;
|
||||||
- [测试功能] 新增OpenVINO后端Device设置,支持集显/独立显卡的调用;
|
- [测试功能] 新增OpenVINO后端Device设置,支持集显/独立显卡的调用;
|
||||||
|
|
||||||
- **📲 移动端和端侧部署:支持更多模型**
|
- **📲 移动端和端侧部署:支持更多模型**
|
||||||
|
|
||||||
- 新增Android图像分类、目标检测、语义分割、OCR、人脸检测 APK工程及示例.
|
- 新增Android图像分类、目标检测、语义分割、OCR、人脸检测 APK工程及示例.
|
||||||
|
|
||||||
| <font size=3>图像分类</font> | <font size=3>目标检测</font> | <font size=3>语义分割</font> | <font size=3>文字识别</font> | <font size=3>人脸检测</font> |
|
| <font size=3>图像分类</font> | <font size=3>目标检测</font> | <font size=3>语义分割</font> | <font size=3>文字识别</font> | <font size=3>人脸检测</font> |
|
||||||
|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||||
| <font size=2>[工程代码](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/classification)</font> | <font size=2>[工程代码](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection)</font> | <font size=2>[工程代码](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/segmentation) | <font size=2>[工程代码](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/ocr)</font> | <font size=2>[工程代码](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/facedet)</font> |
|
| <font size=2>[工程代码](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/classification)</font> | <font size=2>[工程代码](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection)</font> | <font size=2>[工程代码](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/segmentation) | <font size=2>[工程代码](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/ocr)</font> | <font size=2>[工程代码](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/facedet)</font> |
|
||||||
@@ -75,61 +75,61 @@
|
|||||||
## 目录
|
## 目录
|
||||||
|
|
||||||
* <details open> <summary><b>📖 文档教程(点击可收缩)</b></summary><div>
|
* <details open> <summary><b>📖 文档教程(点击可收缩)</b></summary><div>
|
||||||
|
|
||||||
- 安装文档
|
- 安装文档
|
||||||
|
|
||||||
- [预编译库下载安装](docs/cn/build_and_install/download_prebuilt_libraries.md)
|
- [预编译库下载安装](docs/cn/build_and_install/download_prebuilt_libraries.md)
|
||||||
- [GPU部署环境编译安装](docs/cn/build_and_install/gpu.md)
|
- [GPU部署环境编译安装](docs/cn/build_and_install/gpu.md)
|
||||||
- [CPU部署环境编译安装](docs/cn/build_and_install/cpu.md)
|
- [CPU部署环境编译安装](docs/cn/build_and_install/cpu.md)
|
||||||
- [IPU部署环境编译安装](docs/cn/build_and_install/ipu.md)
|
- [IPU部署环境编译安装](docs/cn/build_and_install/ipu.md)
|
||||||
- [Jetson部署环境编译安装](docs/cn/build_and_install/jetson.md)
|
- [Jetson部署环境编译安装](docs/cn/build_and_install/jetson.md)
|
||||||
- [Android平台部署环境编译安装](docs/cn/build_and_install/android.md)
|
- [Android平台部署环境编译安装](docs/cn/build_and_install/android.md)
|
||||||
|
|
||||||
- 快速使用
|
- 快速使用
|
||||||
|
|
||||||
- [Python部署示例](docs/cn/quick_start/models/python.md)
|
- [Python部署示例](docs/cn/quick_start/models/python.md)
|
||||||
- [C++部署示例](docs/cn/quick_start/models/cpp.md)
|
- [C++部署示例](docs/cn/quick_start/models/cpp.md)
|
||||||
- [Runtime Python使用示例](docs/cn/quick_start/runtime/python.md)
|
- [Runtime Python使用示例](docs/cn/quick_start/runtime/python.md)
|
||||||
- [Runtime C++使用示例](docs/cn/quick_start/runtime/cpp.md)
|
- [Runtime C++使用示例](docs/cn/quick_start/runtime/cpp.md)
|
||||||
|
|
||||||
- API文档(进行中)
|
- API文档(进行中)
|
||||||
|
|
||||||
- [Python API文档](https://www.paddlepaddle.org.cn/fastdeploy-api-doc/python/html/)
|
- [Python API文档](https://www.paddlepaddle.org.cn/fastdeploy-api-doc/python/html/)
|
||||||
- [C++ API文档](https://www.paddlepaddle.org.cn/fastdeploy-api-doc/cpp/html/)
|
- [C++ API文档](https://www.paddlepaddle.org.cn/fastdeploy-api-doc/cpp/html/)
|
||||||
|
|
||||||
- 性能调优
|
- 性能调优
|
||||||
|
|
||||||
- [量化加速](docs/cn/quantize.md)
|
- [量化加速](docs/cn/quantize.md)
|
||||||
|
|
||||||
- 常见问题
|
- 常见问题
|
||||||
|
|
||||||
- [1. 如何配置模型部署的推理后端](docs/cn/faq/how_to_change_backend.md)
|
- [1. 如何配置模型部署的推理后端](docs/cn/faq/how_to_change_backend.md)
|
||||||
- [2. Windows上C++ SDK如何使用](docs/cn/faq/use_sdk_on_windows.md)
|
- [2. Windows上C++ SDK如何使用](docs/cn/faq/use_sdk_on_windows.md)
|
||||||
- [3. Android上如何使用FastDeploy](docs/cn/faq/use_sdk_on_android.md)(进行中)
|
- [3. Android上如何使用FastDeploy](java/android/README.md)
|
||||||
- [4. TensorRT使用中的一些技巧](docs/cn/faq/tensorrt_tricks.md)
|
- [4. TensorRT使用中的一些技巧](docs/cn/faq/tensorrt_tricks.md)
|
||||||
- [5. 如何增加新的模型](docs/cn/faq/develop_a_new_model.md)(进行中)
|
- [5. 如何增加新的模型](docs/cn/faq/develop_a_new_model.md)(进行中)
|
||||||
|
|
||||||
- 更多FastDeploy部署模块
|
- 更多FastDeploy部署模块
|
||||||
|
|
||||||
- [服务化部署](./serving)
|
- [服务化部署](./serving)
|
||||||
|
|
||||||
- [Benchmark测试](./benchmark)
|
- [Benchmark测试](./benchmark)
|
||||||
|
|
||||||
</div></details>
|
</div></details>
|
||||||
|
|
||||||
* **🖥️ 服务器端部署**
|
* **🖥️ 服务器端部署**
|
||||||
|
|
||||||
* [Python SDK快速开始](#fastdeploy-quick-start-python)
|
* [Python SDK快速开始](#fastdeploy-quick-start-python)
|
||||||
* [C++ SDK快速开始](#fastdeploy-quick-start-cpp)
|
* [C++ SDK快速开始](#fastdeploy-quick-start-cpp)
|
||||||
* [服务端模型支持列表](#fastdeploy-server-models)
|
* [服务端模型支持列表](#fastdeploy-server-models)
|
||||||
|
|
||||||
* **📲 移动端和端侧部署**
|
* **📲 移动端和端侧部署**
|
||||||
|
|
||||||
* [Paddle Lite NPU部署](#fastdeploy-edge-sdk-npu)
|
* [Paddle Lite NPU部署](#fastdeploy-edge-sdk-npu)
|
||||||
* [端侧模型支持列表](#fastdeploy-edge-models)
|
* [端侧模型支持列表](#fastdeploy-edge-models)
|
||||||
|
|
||||||
* **🌐 Web和小程序部署**
|
* **🌐 Web和小程序部署**
|
||||||
|
|
||||||
* [Web端模型支持列表](#fastdeploy-web-models)
|
* [Web端模型支持列表](#fastdeploy-web-models)
|
||||||
|
|
||||||
* [**社区交流**](#fastdeploy-community)
|
* [**社区交流**](#fastdeploy-community)
|
||||||
@@ -180,7 +180,7 @@ wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/0000000
|
|||||||
```
|
```
|
||||||
|
|
||||||
* 测试推理结果
|
* 测试推理结果
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# GPU/TensorRT部署参考 examples/vision/detection/paddledetection/python
|
# GPU/TensorRT部署参考 examples/vision/detection/paddledetection/python
|
||||||
import cv2
|
import cv2
|
||||||
|
50
README_EN.md
50
README_EN.md
@@ -40,29 +40,29 @@ Including image classification, object detection, image segmentation, face detec
|
|||||||
## 📣 Recent Updates
|
## 📣 Recent Updates
|
||||||
|
|
||||||
- **Community**
|
- **Community**
|
||||||
|
|
||||||
- **Slack**:Join our [Slack community](https://join.slack.com/t/fastdeployworkspace/shared_invite/zt-1hhvpb279-iw2pNPwrDaMBQ5OQhO3Siw) and chat with other community members about ideas.
|
- **Slack**:Join our [Slack community](https://join.slack.com/t/fastdeployworkspace/shared_invite/zt-1hhvpb279-iw2pNPwrDaMBQ5OQhO3Siw) and chat with other community members about ideas.
|
||||||
|
|
||||||
- **WeChat**:Scan the QR code below using WeChat, follow the PaddlePaddle official account and fill out the questionnaire to join the WeChat group.
|
- **WeChat**:Scan the QR code below using WeChat, follow the PaddlePaddle official account and fill out the questionnaire to join the WeChat group.
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<img src="https://user-images.githubusercontent.com/54695910/200145290-d5565d18-6707-4a0b-a9af-85fd36d35d13.jpg" width = "100" height = "100" />
|
<img src="https://user-images.githubusercontent.com/54695910/200145290-d5565d18-6707-4a0b-a9af-85fd36d35d13.jpg" width = "100" height = "100" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
- 🔥 **2022.11.23:Release FastDeploy [release v0.8.0](https://github.com/PaddlePaddle/FastDeploy/tree/release/0.8.0)** <br>
|
- 🔥 **2022.11.23:Release FastDeploy [release v0.8.0](https://github.com/PaddlePaddle/FastDeploy/tree/release/0.8.0)** <br>
|
||||||
|
|
||||||
- **🖥️ Server-side and Cloud Deployment: Support more CV models, improve deployment performance**
|
- **🖥️ Server-side and Cloud Deployment: Support more CV models, improve deployment performance**
|
||||||
|
|
||||||
- Support [PIPNet](./examples/vision/facealign/pipnet), [FaceLandmark1000](./examples/vision/facealign/face_landmark_1000) face alignment models deployment;
|
- Support [PIPNet](./examples/vision/facealign/pipnet), [FaceLandmark1000](./examples/vision/facealign/face_landmark_1000) face alignment models deployment;
|
||||||
- Support [Video Super-Resolution](./examples/vision/sr) series model PP-MSVSR、EDVR、BasicVSR;
|
- Support [Video Super-Resolution](./examples/vision/sr) series model PP-MSVSR、EDVR、BasicVSR;
|
||||||
- Upgrade YOLOv7 deployment code to add `batch_predict` deployment;
|
- Upgrade YOLOv7 deployment code to add `batch_predict` deployment;
|
||||||
- Support [UIE service-based](./examples/text/uie) deployment;
|
- Support [UIE service-based](./examples/text/uie) deployment;
|
||||||
- Add Python API to_dlpack interface for FDTensor to support copyless transfer of FDTensor between frameworks.
|
- Add Python API to_dlpack interface for FDTensor to support copyless transfer of FDTensor between frameworks.
|
||||||
|
|
||||||
- **📱 Mobile and Edge Device Deployment: support more CV model**
|
- **📱 Mobile and Edge Device Deployment: support more CV model**
|
||||||
|
|
||||||
- Support Android image classification, target detection, semantic segmentation, OCR, face detection APK projects and examples.
|
- Support Android image classification, target detection, semantic segmentation, OCR, face detection APK projects and examples.
|
||||||
|
|
||||||
| <font size=3>Image Classification</font> | <font size=3>Object Detection</font> | <font size=3>Semantic Segmentation</font> | <font size=3>OCR</font> | <font size=3>Face Detection</font> |
|
| <font size=3>Image Classification</font> | <font size=3>Object Detection</font> | <font size=3>Semantic Segmentation</font> | <font size=3>OCR</font> | <font size=3>Face Detection</font> |
|
||||||
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||||
| <font size=2>[Project Code](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/classification)</font> | <font size=2>[Project Code](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection)</font> | <font size=2>[Project Code](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/segmentation) | <font size=2>[Project Code](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/ocr)</font> | <font size=2>[Project Code](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/facedet)</font> |
|
| <font size=2>[Project Code](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/classification)</font> | <font size=2>[Project Code](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection)</font> | <font size=2>[Project Code](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/segmentation) | <font size=2>[Project Code](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/ocr)</font> | <font size=2>[Project Code](https://github.com/PaddlePaddle/FastDeploy/tree/develop/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/facedet)</font> |
|
||||||
@@ -74,60 +74,60 @@ Including image classification, object detection, image segmentation, face detec
|
|||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
* <details open><summary><b>📖 Tutorials(click to fold)</b></summary><div>
|
* <details open><summary><b>📖 Tutorials(click to fold)</b></summary><div>
|
||||||
|
|
||||||
- Install
|
- Install
|
||||||
|
|
||||||
- [Install FastDeploy Prebuilt Libraries](docs/en/build_and_install/download_prebuilt_libraries.md)
|
- [Install FastDeploy Prebuilt Libraries](docs/en/build_and_install/download_prebuilt_libraries.md)
|
||||||
- [Build and Install FastDeploy Library on GPU Platform](docs/en/build_and_install/gpu.md)
|
- [Build and Install FastDeploy Library on GPU Platform](docs/en/build_and_install/gpu.md)
|
||||||
- [Build and Install FastDeploy Library on CPU Platform](docs/en/build_and_install/cpu.md)
|
- [Build and Install FastDeploy Library on CPU Platform](docs/en/build_and_install/cpu.md)
|
||||||
- [Build and Install FastDeploy Library on IPU Platform](docs/en/build_and_install/ipu.md)
|
- [Build and Install FastDeploy Library on IPU Platform](docs/en/build_and_install/ipu.md)
|
||||||
- [Build and Install FastDeploy Library on Nvidia Jetson Platform](docs/en/build_and_install/jetson.md)
|
- [Build and Install FastDeploy Library on Nvidia Jetson Platform](docs/en/build_and_install/jetson.md)
|
||||||
- [Build and Install FastDeploy Library on Android Platform](docs/en/build_and_install/android.md)
|
- [Build and Install FastDeploy Library on Android Platform](docs/en/build_and_install/android.md)
|
||||||
|
|
||||||
- A Quick Start - Demos
|
- A Quick Start - Demos
|
||||||
|
|
||||||
- [Python Deployment Demo](docs/en/quick_start/models/python.md)
|
- [Python Deployment Demo](docs/en/quick_start/models/python.md)
|
||||||
- [C++ Deployment Demo](docs/en/quick_start/models/cpp.md)
|
- [C++ Deployment Demo](docs/en/quick_start/models/cpp.md)
|
||||||
- [A Quick Start on Runtime Python](docs/en/quick_start/runtime/python.md)
|
- [A Quick Start on Runtime Python](docs/en/quick_start/runtime/python.md)
|
||||||
- [A Quick Start on Runtime C++](docs/en/quick_start/runtime/cpp.md)
|
- [A Quick Start on Runtime C++](docs/en/quick_start/runtime/cpp.md)
|
||||||
|
|
||||||
- API (To be continued)
|
- API (To be continued)
|
||||||
|
|
||||||
- [Python API](https://baidu-paddle.github.io/fastdeploy-api/python/html/)
|
- [Python API](https://baidu-paddle.github.io/fastdeploy-api/python/html/)
|
||||||
- [C++ API](https://baidu-paddle.github.io/fastdeploy-api/cpp/html/)
|
- [C++ API](https://baidu-paddle.github.io/fastdeploy-api/cpp/html/)
|
||||||
|
|
||||||
- Performance Optimization
|
- Performance Optimization
|
||||||
|
|
||||||
- [Quantization Acceleration](docs/en/quantize.md)
|
- [Quantization Acceleration](docs/en/quantize.md)
|
||||||
|
|
||||||
- Frequent Q&As
|
- Frequent Q&As
|
||||||
|
|
||||||
- [1. How to Change Inference Backends](docs/en/faq/how_to_change_backend.md)
|
- [1. How to Change Inference Backends](docs/en/faq/how_to_change_backend.md)
|
||||||
- [2. How to Use FastDeploy C++ SDK on Windows Platform](docs/en/faq/use_sdk_on_windows.md)
|
- [2. How to Use FastDeploy C++ SDK on Windows Platform](docs/en/faq/use_sdk_on_windows.md)
|
||||||
- [3. How to Use FastDeploy C++ SDK on Android Platform](docs/en/faq/use_sdk_on_android.md)(To be Continued)
|
- [3. How to Use FastDeploy C++ SDK on Android Platform](java/android/README_EN.md)(To be Continued)
|
||||||
- [4. Tricks of TensorRT](docs/en/faq/tensorrt_tricks.md)
|
- [4. Tricks of TensorRT](docs/en/faq/tensorrt_tricks.md)
|
||||||
- [5. How to Develop a New Model](docs/en/faq/develop_a_new_model.md)(To be Continued)
|
- [5. How to Develop a New Model](docs/en/faq/develop_a_new_model.md)(To be Continued)
|
||||||
|
|
||||||
- More FastDeploy Deployment Module
|
- More FastDeploy Deployment Module
|
||||||
|
|
||||||
- [deployment AI Model as a Service](./serving)
|
- [deployment AI Model as a Service](./serving)
|
||||||
|
|
||||||
- [Benchmark Testing](./benchmark)
|
- [Benchmark Testing](./benchmark)
|
||||||
|
|
||||||
</div></details>
|
</div></details>
|
||||||
|
|
||||||
* **🖥️ Server-side and Cloud Deployment**
|
* **🖥️ Server-side and Cloud Deployment**
|
||||||
|
|
||||||
* [A Quick Start for Python SDK](#fastdeploy-quick-start-python)
|
* [A Quick Start for Python SDK](#fastdeploy-quick-start-python)
|
||||||
* [A Quick Start for C++ SDK](#fastdeploy-quick-start-cpp)
|
* [A Quick Start for C++ SDK](#fastdeploy-quick-start-cpp)
|
||||||
* [Supported Server-side and Cloud Model List](#fastdeploy-server-models)
|
* [Supported Server-side and Cloud Model List](#fastdeploy-server-models)
|
||||||
|
|
||||||
* **📱 Mobile and Edge Device Deployment**
|
* **📱 Mobile and Edge Device Deployment**
|
||||||
|
|
||||||
* [Supported Mobile and Edge Model List](#fastdeploy-edge-models)
|
* [Supported Mobile and Edge Model List](#fastdeploy-edge-models)
|
||||||
|
|
||||||
* **🌐 Browser and Mini Program Deployment**
|
* **🌐 Browser and Mini Program Deployment**
|
||||||
|
|
||||||
* [Supported Web and Mini Program Model List](#fastdeploy-web-models)
|
* [Supported Web and Mini Program Model List](#fastdeploy-web-models)
|
||||||
|
|
||||||
* [**Community**](#fastdeploy-community)
|
* [**Community**](#fastdeploy-community)
|
||||||
|
@@ -44,9 +44,9 @@ public class PicoDet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
这些被标记为native的接口是需要通过JNI的方式实现,并在Java层供PicoDet类调用。完整的PicoDet Java代码请参考 [PicoDet.java](../../../examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/detection/PicoDet.java) 。各个函数说明如下:
|
这些被标记为native的接口是需要通过JNI的方式实现,并在Java层供PicoDet类调用。完整的PicoDet Java代码请参考 [PicoDet.java](../../../java/android/fastdeploy/src/main/java/com/baidu/paddle/fastdeploy/vision/detection/PicoDet.java) 。各个函数说明如下:
|
||||||
- `bindNative`: C++层初始化模型资源,如果成功初始化,则返回指向该模型的指针(long类型),否则返回0指针
|
- `bindNative`: C++层初始化模型资源,如果成功初始化,则返回指向该模型的指针(long类型),否则返回0指针
|
||||||
- `predictNative`: 通过已经初始化好的模型指针,在C++层执行预测代码,如果预测成功则返回指向预测结果的指针,否则返回0指针。注意,该结果指针在当次预测使用完之后需要释放,具体操作请参考 [PicoDet.java](../../../examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/detection/PicoDet.java) 中的predict函数。
|
- `predictNative`: 通过已经初始化好的模型指针,在C++层执行预测代码,如果预测成功则返回指向预测结果的指针,否则返回0指针。注意,该结果指针在当次预测使用完之后需要释放,具体操作请参考 [PicoDet.java](../../../java/android/fastdeploy/src/main/java/com/baidu/paddle/fastdeploy/vision/detection/PicoDet.java) 中的predict函数。
|
||||||
- `releaseNative`: 根据传入的模型指针,在C++层释放模型资源。
|
- `releaseNative`: 根据传入的模型指针,在C++层释放模型资源。
|
||||||
|
|
||||||
## Android Studio 生成JNI函数定义
|
## Android Studio 生成JNI函数定义
|
||||||
@@ -70,89 +70,96 @@ Android Studio 生成 JNI 函数定义: 鼠标停留在Java中定义的native函
|
|||||||
|
|
||||||
以下为PicoDet JNI层实现的示例,相关的辅助函数不在此处赘述,完整的C++代码请参考 [android/app/src/main/cpp](../../../examples/vision/detection/paddledetection/android/app/src/main/cpp/).
|
以下为PicoDet JNI层实现的示例,相关的辅助函数不在此处赘述,完整的C++代码请参考 [android/app/src/main/cpp](../../../examples/vision/detection/paddledetection/android/app/src/main/cpp/).
|
||||||
```C++
|
```C++
|
||||||
|
// Copyright (c) 2022 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.
|
||||||
|
|
||||||
#include <jni.h> // NOLINT
|
#include <jni.h> // NOLINT
|
||||||
#include "fastdeploy_jni.h" // NOLINT
|
#include "fastdeploy_jni/convert_jni.h" // NOLINT
|
||||||
|
#include "fastdeploy_jni/assets_loader_jni.h" // NOLINT
|
||||||
|
#include "fastdeploy_jni/runtime_option_jni.h" // NOLINT
|
||||||
|
#include "fastdeploy_jni/vision/results_jni.h" // NOLINT
|
||||||
|
#include "fastdeploy_jni/vision/detection/detection_utils_jni.h" // NOLINT
|
||||||
|
|
||||||
|
namespace fni = fastdeploy::jni;
|
||||||
|
namespace vision = fastdeploy::vision;
|
||||||
|
namespace detection = fastdeploy::vision::detection;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 绑定C++层的模型
|
|
||||||
JNIEXPORT jlong JNICALL
|
JNIEXPORT jlong JNICALL
|
||||||
Java_com_baidu_paddle_fastdeploy_vision_detection_PicoDet_bindNative(
|
Java_com_baidu_paddle_fastdeploy_vision_detection_PicoDet_bindNative(
|
||||||
JNIEnv *env, jclass clazz, jstring model_file, jstring params_file,
|
JNIEnv *env, jobject thiz, jstring model_file, jstring params_file,
|
||||||
jstring config_file, jint cpu_num_thread, jboolean enable_lite_fp16,
|
jstring config_file, jobject runtime_option, jstring label_file) {
|
||||||
jint lite_power_mode, jstring lite_optimized_model_dir,
|
auto c_model_file = fni::ConvertTo<std::string>(env, model_file);
|
||||||
jboolean enable_record_time_of_runtime, jstring label_file) {
|
auto c_params_file = fni::ConvertTo<std::string>(env, params_file);
|
||||||
std::string c_model_file = fastdeploy::jni::ConvertTo<std::string>(env, model_file);
|
auto c_config_file = fni::ConvertTo<std::string>(env, config_file);
|
||||||
std::string c_params_file = fastdeploy::jni::ConvertTo<std::string>(env, params_file);
|
auto c_label_file = fni::ConvertTo<std::string>(env, label_file);
|
||||||
std::string c_config_file = astdeploy::jni::ConvertTo<std::string>(env, config_file);
|
auto c_runtime_option = fni::NewCxxRuntimeOption(env, runtime_option);
|
||||||
std::string c_label_file = fastdeploy::jni::ConvertTo<std::string>(env, label_file);
|
auto c_model_ptr = new detection::PicoDet(
|
||||||
std::string c_lite_optimized_model_dir = fastdeploy::jni::ConvertTo<std::string>(env, lite_optimized_model_dir);
|
c_model_file, c_params_file, c_config_file, c_runtime_option);
|
||||||
auto c_cpu_num_thread = static_cast<int>(cpu_num_thread);
|
INITIALIZED_OR_RETURN(c_model_ptr)
|
||||||
auto c_enable_lite_fp16 = static_cast<bool>(enable_lite_fp16);
|
|
||||||
auto c_lite_power_mode = static_cast<fastdeploy::LitePowerMode>(lite_power_mode);
|
#ifdef ENABLE_RUNTIME_PERF
|
||||||
fastdeploy::RuntimeOption c_option;
|
c_model_ptr->EnableRecordTimeOfRuntime();
|
||||||
c_option.UseCpu();
|
#endif
|
||||||
c_option.UseLiteBackend();
|
if (!c_label_file.empty()) {
|
||||||
c_option.SetCpuThreadNum(c_cpu_num_thread);
|
fni::AssetsLoader::LoadDetectionLabels(c_label_file);
|
||||||
c_option.SetLitePowerMode(c_lite_power_mode);
|
|
||||||
c_option.SetLiteOptimizedModelDir(c_lite_optimized_model_dir);
|
|
||||||
if (c_enable_lite_fp16) {
|
|
||||||
c_option.EnableLiteFP16();
|
|
||||||
}
|
}
|
||||||
// 如果您实现的是其他模型,比如PPYOLOE,请注意修改此处绑定的C++类型
|
vision::EnableFlyCV();
|
||||||
auto c_model_ptr = new fastdeploy::vision::detection::PicoDet(
|
return reinterpret_cast<jlong>(c_model_ptr);
|
||||||
c_model_file, c_params_file, c_config_file, c_option);
|
|
||||||
// Enable record Runtime time costs.
|
|
||||||
if (enable_record_time_of_runtime) {
|
|
||||||
c_model_ptr->EnableRecordTimeOfRuntime();
|
|
||||||
}
|
|
||||||
// Load detection labels if label path is not empty.
|
|
||||||
if ((!fastdeploy::jni::AssetsLoaderUtils::IsDetectionLabelsLoaded()) &&
|
|
||||||
(!c_label_file.empty())) {
|
|
||||||
fastdeploy::jni::AssetsLoaderUtils::LoadDetectionLabels(c_label_file);
|
|
||||||
}
|
|
||||||
// WARN: need to release manually in Java !
|
|
||||||
return reinterpret_cast<jlong>(c_model_ptr); // native model context
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通过传入的模型指针在C++层进行预测
|
JNIEXPORT jobject JNICALL
|
||||||
JNIEXPORT jlong JNICALL
|
|
||||||
Java_com_baidu_paddle_fastdeploy_vision_detection_PicoDet_predictNative(
|
Java_com_baidu_paddle_fastdeploy_vision_detection_PicoDet_predictNative(
|
||||||
JNIEnv *env, jclass clazz, jlong native_model_context,
|
JNIEnv *env, jobject thiz, jlong cxx_context, jobject argb8888_bitmap,
|
||||||
jobject argb8888_bitmap, jboolean saved, jstring saved_image_path,
|
jboolean save_image, jstring save_path, jboolean rendering,
|
||||||
jfloat score_threshold, jboolean rendering) {
|
jfloat score_threshold) {
|
||||||
if (native_model_context == 0) {
|
if (cxx_context == 0) {
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
cv::Mat c_bgr;
|
cv::Mat c_bgr;
|
||||||
if (!fastdeploy::jni::ARGB888Bitmap2BGR(env, argb8888_bitmap, &c_bgr)) {
|
if (!fni::ARGB888Bitmap2BGR(env, argb8888_bitmap, &c_bgr)) {
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
auto c_model_ptr = reinterpret_cast<fastdeploy::vision::detection::PicoDet *>(
|
auto c_model_ptr = reinterpret_cast<detection::PicoDet *>(cxx_context);
|
||||||
native_model_context);
|
vision::DetectionResult c_result;
|
||||||
auto c_result_ptr = new fastdeploy::vision::DetectionResult();
|
auto t = fni::GetCurrentTime();
|
||||||
t = fastdeploy::jni::GetCurrentTime();
|
c_model_ptr->Predict(&c_bgr, &c_result);
|
||||||
if (!c_model_ptr->Predict(&c_bgr, c_result_ptr)) {
|
PERF_TIME_OF_RUNTIME(c_model_ptr, t)
|
||||||
delete c_result_ptr;
|
|
||||||
return 0;
|
if (rendering) {
|
||||||
|
fni::RenderingDetection(env, c_bgr, c_result, argb8888_bitmap, save_image,
|
||||||
|
score_threshold, save_path);
|
||||||
}
|
}
|
||||||
// ...
|
|
||||||
return reinterpret_cast<jlong>(c_result_ptr); // native result context
|
return fni::NewJavaResultFromCxx(env, reinterpret_cast<void *>(&c_result),
|
||||||
|
vision::ResultType::DETECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在C++层释放模型资源
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_com_baidu_paddle_fastdeploy_vision_detection_PicoDet_releaseNative(
|
Java_com_baidu_paddle_fastdeploy_vision_detection_PicoDet_releaseNative(
|
||||||
JNIEnv *env, jclass clazz, jlong native_model_context) {
|
JNIEnv *env, jobject thiz, jlong cxx_context) {
|
||||||
if (native_model_context == 0) {
|
if (cxx_context == 0) {
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
auto c_model_ptr = reinterpret_cast<fastdeploy::vision::detection::PicoDet *>(
|
auto c_model_ptr = reinterpret_cast<detection::PicoDet *>(cxx_context);
|
||||||
native_model_context);
|
PERF_TIME_OF_RUNTIME(c_model_ptr, -1)
|
||||||
// ...
|
|
||||||
delete c_model_ptr;
|
delete c_model_ptr;
|
||||||
|
LOGD("[End] Release PicoDet in native !");
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,6 +191,11 @@ android {
|
|||||||
version '3.10.2'
|
version '3.10.2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
jniLibs.srcDirs = ['libs']
|
||||||
|
}
|
||||||
|
}
|
||||||
ndkVersion '20.1.5948944'
|
ndkVersion '20.1.5948944'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -192,7 +204,8 @@ android {
|
|||||||
cmake_minimum_required(VERSION 3.10.2)
|
cmake_minimum_required(VERSION 3.10.2)
|
||||||
project("fastdeploy_jni")
|
project("fastdeploy_jni")
|
||||||
|
|
||||||
set(FastDeploy_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/fastdeploy-android-0.4.0-shared")
|
# 其中 xxx 表示对应C++ SDK的版本号
|
||||||
|
set(FastDeploy_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/fastdeploy-android-xxx-shared")
|
||||||
|
|
||||||
find_package(FastDeploy REQUIRED)
|
find_package(FastDeploy REQUIRED)
|
||||||
|
|
||||||
@@ -221,7 +234,7 @@ target_link_libraries(
|
|||||||
${log-lib}
|
${log-lib}
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
完整的工程示例,请参考 [android/app/src/main/cpp/CMakelists.txt](../../../examples/vision/detection/paddledetection/android/app/src/main/cpp/) 以及 [android/app/build.gradle](../../../examples/vision/detection/paddledetection/android/app/build.gradle).
|
完整的工程示例,请参考 [CMakelists.txt](../../../java/android/fastdeploy/src/main/cpp/CMakeLists.txt) 以及 [build.gradle](../../../java/android/fastdeploy/build.gradle).
|
||||||
|
|
||||||
## 更多FastDeploy Android 使用案例
|
## 更多FastDeploy Android 使用案例
|
||||||
<div id="Examples"></div>
|
<div id="Examples"></div>
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
## 在 Android 中使用 FastDeploy Java SDK
|
|
||||||
- TODO
|
|
@@ -1,3 +0,0 @@
|
|||||||
# Android平台使用FastDeploy部署
|
|
||||||
|
|
||||||
进行中...
|
|
@@ -1,3 +1,97 @@
|
|||||||
# How to Build Android Deployment Library
|
# How to Build FastDeploy Android C++ SDK
|
||||||
|
|
||||||
coming soon...
|
FastDeploy supports Paddle-Lite backend on Android. It supports both armeabi-v7a and arm64-v8a cpu architectures, and supports fp16 precision inference on the armv8.2 architecture. The relevant compilation options are described as follows:
|
||||||
|
|
||||||
|
|Option|Default|Description|Remark|
|
||||||
|
|:---|:---|:---|:---|
|
||||||
|
|ENABLE_LITE_BACKEND|OFF|It needs to be set to ON when compiling the Android library| - |
|
||||||
|
|WITH_OPENCV_STATIC|OFF|Whether to use the OpenCV static library| - |
|
||||||
|
|WITH_LITE_STATIC|OFF|Whether to use the Paddle-Lite static library| NOT Support now |
|
||||||
|
|
||||||
|
Please reference [FastDeploy Compile Options](./README.md) for more details.
|
||||||
|
|
||||||
|
## Build Android C++ SDK
|
||||||
|
|
||||||
|
Prerequisite for Compiling on Android:
|
||||||
|
|
||||||
|
- Android SDK API >= 21
|
||||||
|
- Android NDK >= 20 (Only support clang toolchain now)
|
||||||
|
- cmake >= 3.10.0
|
||||||
|
|
||||||
|
Please check if the Android SDK and NDK is ready or not before building:
|
||||||
|
```bash
|
||||||
|
➜ echo $ANDROID_SDK
|
||||||
|
/Users/xxx/Library/Android/sdk
|
||||||
|
➜ echo $ANDROID_NDK
|
||||||
|
/Users/xxx/Library/Android/sdk/ndk/25.1.8937393
|
||||||
|
```
|
||||||
|
It is recommended to use NDK>=20 for cross compilation, the compilation command is as follows:
|
||||||
|
```bash
|
||||||
|
# Download the latest source code
|
||||||
|
git clone https://github.com/PaddlePaddle/FastDeploy.git
|
||||||
|
cd FastDeploy
|
||||||
|
|
||||||
|
# Setting up Android toolchanin
|
||||||
|
ANDROID_ABI=arm64-v8a # 'arm64-v8a', 'armeabi-v7a'
|
||||||
|
ANDROID_PLATFORM="android-21" # API >= 21
|
||||||
|
ANDROID_STL=c++_shared # 'c++_shared', 'c++_static'
|
||||||
|
ANDROID_TOOLCHAIN=clang # 'clang' only
|
||||||
|
TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
||||||
|
|
||||||
|
# Create build directory
|
||||||
|
BUILD_ROOT=build/Android
|
||||||
|
BUILD_DIR=${BUILD_ROOT}/${ANDROID_ABI}-api-21
|
||||||
|
FASDEPLOY_INSTALL_DIR="${BUILD_DIR}/install"
|
||||||
|
mkdir build && mkdir ${BUILD_ROOT} && mkdir ${BUILD_DIR}
|
||||||
|
cd ${BUILD_DIR}
|
||||||
|
|
||||||
|
# CMake configuration with Android toolchain
|
||||||
|
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
|
||||||
|
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||||
|
-DANDROID_ABI=${ANDROID_ABI} \
|
||||||
|
-DANDROID_NDK=${ANDROID_NDK} \
|
||||||
|
-DANDROID_PLATFORM=${ANDROID_PLATFORM} \
|
||||||
|
-DANDROID_STL=${ANDROID_STL} \
|
||||||
|
-DANDROID_TOOLCHAIN=${ANDROID_TOOLCHAIN} \
|
||||||
|
-DENABLE_LITE_BACKEND=ON \
|
||||||
|
-DENABLE_VISION=ON \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${FASDEPLOY_INSTALL_DIR} \
|
||||||
|
-Wno-dev ../../..
|
||||||
|
|
||||||
|
# Build FastDeploy Android C++ SDK
|
||||||
|
make -j8
|
||||||
|
make install
|
||||||
|
```
|
||||||
|
After the compilation is complete, the Android C++ SDK is saved in the `build/Android/arm64-v8a-api-21/install` directory, the directory structure is as follows:
|
||||||
|
```bash
|
||||||
|
➜ tree . -d -L 3
|
||||||
|
.
|
||||||
|
├── examples
|
||||||
|
├── include
|
||||||
|
│ └── fastdeploy # FastDeploy headers
|
||||||
|
├── lib
|
||||||
|
│ └── arm64-v8a # FastDeploy Android libs
|
||||||
|
└── third_libs # Third parties libs
|
||||||
|
└── install
|
||||||
|
├── opencv
|
||||||
|
├── flycv
|
||||||
|
└── paddlelite
|
||||||
|
```
|
||||||
|
You can check the Android C++ SDK use cases in the examples/vision directory:
|
||||||
|
```bash
|
||||||
|
.
|
||||||
|
├── classification
|
||||||
|
│ ├── paddleclas
|
||||||
|
│ │ ├── android # classification demo for Android
|
||||||
|
│ │ ├── cpp
|
||||||
|
...
|
||||||
|
├── detection
|
||||||
|
│ ├── paddledetection
|
||||||
|
│ │ ├── android # object detection demo for Android
|
||||||
|
│ │ ├── cpp
|
||||||
|
...
|
||||||
|
```
|
||||||
|
About How to use FastDeploy Android C++ SDK, Please refer to the use case documentation:
|
||||||
|
- [Image Classification Android Documentation](../../../examples/vision/classification/paddleclas/android/README.md)
|
||||||
|
- [Object Detection Android Documentation](../../../examples/vision/detection/paddledetection/android/README.md)
|
||||||
|
- [Using FastDeploy C++ SDK in Android via JNI](../../en/faq/use_cpp_sdk_on_android.md)
|
||||||
|
1
java/android/README_EN.md
Normal file
1
java/android/README_EN.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
- TODO
|
Reference in New Issue
Block a user