Skip to content

Commit

Permalink
Move the snapshots to baidu cloud and refine README.md (PaddlePaddle#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
hong19860320 authored Jan 7, 2020
1 parent c1470c9 commit 448ff84
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 37 deletions.
10 changes: 5 additions & 5 deletions PaddleLite-armlinux-demo/enable-camera-on-raspberry-pi.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

将树莓派断电后,将摄像头如下图安装在树莓派上。

![](../doc/enable_camera_on_raspberry_pi_step0.png)
![](https://paddlelite-demo.bj.bcebos.com/doc/enable_camera_on_raspberry_pi_step0.png)

## 3、配置

Expand All @@ -21,19 +21,19 @@ sudo raspi-config

1. 选择 `Interfacing Options`

![](../doc/enable_camera_on_raspberry_pi_step1.png)
![](https://paddlelite-demo.bj.bcebos.com/doc/enable_camera_on_raspberry_pi_step1.png)

2. 选择 `Camera`

![](../doc/enable_camera_on_raspberry_pi_step2.png)
![](https://paddlelite-demo.bj.bcebos.com/doc/enable_camera_on_raspberry_pi_step2.png)

3. 点击 `Yes`

![](../doc/enable_camera_on_raspberry_pi_step3.png)
![](https://paddlelite-demo.bj.bcebos.com/doc/enable_camera_on_raspberry_pi_step3.png)

4. 点击 `Ok`

![](../doc/enable_camera_on_raspberry_pi_step4.png)
![](https://paddlelite-demo.bj.bcebos.com/doc/enable_camera_on_raspberry_pi_step4.png)

5. 之后重启树莓派

Expand Down
76 changes: 44 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

## 功能
* iOS示例:
* 静态图像目标分类和视频流目标分类
* 静态图像目标检测、相机拍照目标检测、相机视频流目标检测;
* 基于MobileNetV1的图像分类(支持视频流)
* 基于MobileNetV1-SSD的目标检测(支持视频流);
* Android示例:
* 基于MobileNetV1的图像分类;
* 基于MobileNetV1-SSD的目标检测;
* 基于Ultra-Light-Fast-Generic-Face-Detector-1MB的人脸检测;
* 基于DeeplabV3+MobilNetV2的人像分割;
* ARMLinux示例:
* 基于MobileNetV1的图像分类;
* 基于MobileNetV1-SSD的目标检测;
Expand All @@ -20,7 +22,7 @@

* Android
* Android Studio 3.4
* Android手机或开发版,NPU功能暂时只在麒麟810和990芯片的华为手机(如Nova5系列)进行了测试,使用前请将EMUI更新到最新版本
* Android手机或开发版,NPU的功能暂时只在nova5、mate30和mate30 5G上进行了测试,用户可自行尝试其它搭载了麒麟810和990芯片的华为手机(如nova5i pro、mate30 pro、荣耀v30,mate40或p40,且需要将系统更新到最新版)

* ARMLinux
* RK3399([Ubuntu 18.04](http://www.t-firefly.com/doc/download/page/id/3.html)) 或 树莓派3B([Raspbian Buster with desktop](https://www.raspberrypi.org/downloads/raspbian/)),暂时验证了这两个软、硬件环境,其它平台用户可自行尝试;
Expand Down Expand Up @@ -57,7 +59,7 @@ $ git clone https://github.com/PaddlePaddle/Paddle-Lite-Demo
* 通过USB连接Android手机或开发板;
* 载入工程后,点击菜单栏的Run->Run 'App'按钮,在弹出的"Select Deployment Target"窗口选择已经连接的Android设备,然后点击"OK"按钮;
* 由于Demo所用到的库和模型均通过app/build.gradle脚本在线下载,因此,第一次编译耗时较长(取决于网络下载速度),请耐心等待;
* 如果库和模型下载失败,建议手动下载并拷贝到相应目录下:1) [paddle_lite_libs.tar.gz](https://paddlelite-demo.bj.bcebos.com/libs/android/paddle_lite_libs_v2_1_0.tar.gz):解压后将java/PaddlePredictor.jar拷贝至Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/libs,将java/libs/armeabi-v7a/libpaddle_lite_jni.so拷贝至Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/jniLibs/armeabi-v7a/libpaddle_lite_jni.so,将java/libs/armeabi-v8a/libpaddle_lite_jni.so拷贝至Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/jniLibs/arm64-v8a/libpaddle_lite_jni.so 2)[mobilenet_v1_for_cpu.tar.gz](https://paddlelite-demo.bj.bcebos.com/models/mobilenet_v1_fp32_224_for_cpu_v2_1_0.tar.gz):解压至Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/assets/models/mobilenet_v1_for_cpu 3)[mobilenet_v1_for_npu.tar.gz](https://paddlelite-demo.bj.bcebos.com/models/mobilenet_v1_fp32_224_for_npu_v2_1_0.tar.gz):解压至Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/assets/models/mobilenet_v1_for_npu 4)[ssd_mobilenet_v1_pascalvoc_for_cpu.tar.gz](https://paddlelite-demo.bj.bcebos.com/models/ssd_mobilenet_v1_pascalvoc_fp32_300_for_cpu_v2_1_0.tar.gz):解压至Paddle-Lite-Demo/PaddleLite-android-demo/object_detection_demo/app/src/main/assets/models/ssd_mobilenet_v1_pascalvoc_for_cpu ;
* 对于图像分类Demo,如果库和模型下载失败,建议手动下载并拷贝到相应目录下:1) [paddle_lite_libs.tar.gz](https://paddlelite-demo.bj.bcebos.com/libs/android/paddle_lite_libs_v2_1_0.tar.gz):解压后将java/PaddlePredictor.jar拷贝至Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/libs,将java/libs/armeabi-v7a/libpaddle_lite_jni.so拷贝至Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/jniLibs/armeabi-v7a/libpaddle_lite_jni.so,将java/libs/armeabi-v8a/libpaddle_lite_jni.so拷贝至Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/jniLibs/arm64-v8a/libpaddle_lite_jni.so 2)[mobilenet_v1_for_cpu.tar.gz](https://paddlelite-demo.bj.bcebos.com/models/mobilenet_v1_fp32_224_for_cpu_v2_1_0.tar.gz):解压至Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/assets/models/mobilenet_v1_for_cpu 3)[mobilenet_v1_for_npu.tar.gz](https://paddlelite-demo.bj.bcebos.com/models/mobilenet_v1_fp32_224_for_npu_v2_1_0.tar.gz):解压至Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/assets/models/mobilenet_v1_for_npu
* 在图像分类Demo中,默认会载入一张猫的图像,并会在图像下方给出CPU的预测结果,如果你使用的是麒麟810或990芯片的华为手机(如Nova5系列),可以在右上角的上下文菜单选择"Settings..."打开设置窗口切换NPU模型进行预测;
* 在图像分类Demo中,你还可以通过上方的"Gallery""Take Photo"按钮从相册或相机中加载测试图像;

Expand All @@ -84,67 +86,77 @@ $ git clone https://github.com/PaddlePaddle/Paddle-Lite-Demo

## 更新到最新的预测库
* Paddle-Lite项目:https://github.com/PaddlePaddle/Paddle-Lite
* 参考 [Paddle-Lite文档](https://github.com/PaddlePaddle/Paddle-Lite/wiki),编译IOS预测库或者Android预测库
* 参考 [Paddle-Lite文档](https://github.com/PaddlePaddle/Paddle-Lite/wiki),编译IOS预测库、Android和ARMLinux预测库
* 编译最终产物位于 `build.lite.xxx.xxx.xxx` 下的 `inference_lite_lib.xxx.xxx`
### IOS更新预测库
* 替换库文件:产出的`lib`目录替换`Paddle-Lite-Demo/PaddleLite-ios-demo/ios-classification_demo/classification_demo/lib`目录
* 替换头文件:产出的`include`目录下的文件替换`Paddle-Lite-Demo/PaddleLite-ios-demo/ios-classification_demo/classification_demo/paddle_lite`目录下的文件

### Android更新预测库
* 仅支持CPU
* 替换jar文件:将PaddleLite编译生成的build.lite.android.xxx.gcc/inference_lite_lib.android.xxx/java/jar/PaddlePredictor.jar替换demo中的Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/libs/PaddlePredictor.jar
* 替换arm64-v8a jni库文件:将Paddle-Lite编译生成build.lite.android.armv8.gcc/inference_lite_lib.android.armv8/java/so/libpaddle_lite_jni.so库替换demo中的Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/jniLibs/arm64-v8a/libpaddle_lite_jni.so
* 替换armeabi-v7a jni库文件:将Paddle-Lite编译生成的build.lite.android.armv7.gcc/inference_lite_lib.android.armv7/java/so/libpaddle_lite_jni.so库替换demo中的Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/jniLibs/armeabi-v7a/libpaddle_lite_jni.so.

* 支持CPU和NPU
* 替换jar文件:将PaddleLite编译生成的build.lite.npu.android.xxx.gcc.cxx_shared.tiny_publish/inference_lite_lib.android.xxx.npu/java/jar/PaddlePredictor.jar替换demo中的Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/libs/PaddlePredictor.jar
* 替换arm64-v8a jni库文件:将Paddle-Lite编译生成build.lite.npu.android.armv8.gcc.cxx_shared.tiny_publish/inference_lite_lib.android.armv8.npu/java/so/libpaddle_lite_jni.so库替换demo中的Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/jniLibs/arm64-v8a/libpaddle_lite_jni.so
* 替换armeabi-v7a jni库文件:将Paddle-Lite编译生成的build.lite.npu.android.armv7.gcc.cxx_shared.tiny_publish/inference_lite_lib.android.armv7.npu/java/so/libpaddle_lite_jni.so库替换demo中的Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/jniLibs/armeabi-v7a/libpaddle_lite_jni.so.

编译支持NPU的jni库,需要在Paddle-Lite源码下使用$ ./lite/tools/build_npu.sh --arm_abi=armv8 tiny_publish命令编译生成armv64-v8a的libpaddle_lite_jni.so,armeabi-v7a的libpaddle_lite_jni.so请将编译命令中的--arm_abi=armv8改为--arm_abi=armv7,但由于华为最新的DDK库并没有发布,可能无法完成相关编译工作,因此,如果想使用NPU功能,强烈建议使用demo中自带的libpaddle_lite_jni.so和HIAI DDK库;

### ARMLinux
* 替换jar文件:将生成的build.lite.android.xxx.gcc/inference_lite_lib.android.xxx/java/jar/PaddlePredictor.jar替换demo中的Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/libs/PaddlePredictor.jar
* 替换arm64-v8a jni库文件:将生成build.lite.android.armv8.gcc/inference_lite_lib.android.armv8/java/so/libpaddle_lite_jni.so库替换demo中的Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/jniLibs/arm64-v8a/libpaddle_lite_jni.so
* 替换armeabi-v7a jni库文件:将生成的build.lite.android.armv7.gcc/inference_lite_lib.android.armv7/java/so/libpaddle_lite_jni.so库替换demo中的Paddle-Lite-Demo/PaddleLite-android-demo/image_classification_demo/app/src/main/jniLibs/armeabi-v7a/libpaddle_lite_jni.so.
### ARMLinux更新预测库
* 替换头文件目录,将生成的cxx中的`include`目录替换`Paddle-Lite-Demo/PaddleLite-armlinux-demo/Paddle-Lite/include`目录;
* 替换armv8动态库,将生成的cxx/libs中的`libpaddle_light_api_shared.so`替换`Paddle-Lite-Demo/PaddleLite-armlinux-demo/Paddle-Lite/libs/armv8/libpaddle_light_api_shared.so`
* 替换armv7hf动态库,将生成的cxx/libs中的`libpaddle_light_api_shared.so`替换`Paddle-Lite-Demo/PaddleLite-armlinux-demo/Paddle-Lite/libs/armv7hf/libpaddle_light_api_shared.so`

## 效果展示

* iOS
* mobilenetv1 目标分类
* 基于MobileNetV1的图像分类

![ios_static](doc/ios_static.jpg) ![ios_video](doc/ios_video.jpg)
![ios_static](https://paddlelite-demo.bj.bcebos.com/doc/ios_static.jpg) ![ios_video](https://paddlelite-demo.bj.bcebos.com/doc/ios_video.jpg)

* mobilenetv1-ssd 目标检测
* 基于MobileNetV1-SSD的目标检测

![ios_static](doc/ios-image-detection.jpg) ![ios_video](doc/ios-video-detection.jpg)
![ios_static](https://paddlelite-demo.bj.bcebos.com/doc/ios-image-detection.jpg) ![ios_video](https://paddlelite-demo.bj.bcebos.com/doc/ios-video-detection.jpg)

* Android
* mobilenetv1 目标分类
* 基于MobileNetV1的图像分类

- CPU预测结果(测试环境:华为nova5)

![android_image_classification_cat_cpu](doc/android_image_classification_cat_cpu.jpg) ![android_image_classification_keyboard_cpu](doc/android_image_classification_keyboard_cpu.jpg)
![android_image_classification_cat_cpu](https://paddlelite-demo.bj.bcebos.com/doc/android_image_classification_cat_cpu.jpg) ![android_image_classification_keyboard_cpu](https://paddlelite-demo.bj.bcebos.com/doc/android_image_classification_keyboard_cpu.jpg)

- NPU预测结果(测试环境:华为nova5)

![android_image_classification_cat_npu](doc/android_image_classification_cat_npu.jpg) ![android_image_classification_keyboard_npu](doc/android_image_classification_keyboard_npu.jpg)
![android_image_classification_cat_npu](https://paddlelite-demo.bj.bcebos.com/doc/android_image_classification_cat_npu.jpg) ![android_image_classification_keyboard_npu](https://paddlelite-demo.bj.bcebos.com/doc/android_image_classification_keyboard_npu.jpg)

* mobilenetv1-ssd 目标检测
* 基于MobileNetV1-SSD的目标检测

- CPU预测结果(测试环境:华为nova5)

![android_object_detection_dog_npu](doc/android_object_detection_dog_cpu.jpg)
![android_object_detection_npu](https://paddlelite-demo.bj.bcebos.com/doc/android_object_detection_cpu.jpg)

- NPU预测结果(测试环境:华为nova5)

待支持

* 基于Ultra-Light-Fast-Generic-Face-Detector-1MB的人脸检测

- CPU预测结果(测试环境:华为nova5)

![android_face_detection_cpu](https://paddlelite-demo.bj.bcebos.com/doc/android_face_detection_cpu.jpg)

- NPU预测结果

待支持

* 基于DeeplabV3+MobilNetV2的人像分割

- CPU预测结果(测试环境:华为nova5)

![android_human_segmentation_cpu](https://paddlelite-demo.bj.bcebos.com/doc/android_human_segmentation_cpu.jpg)

- NPU预测结果

待支持

* ARMLinux
* mobilenetv1 目标分类
* 基于MobileNetV1的图像分类

![armlinux_image_classification_raspberry_pi](doc/armlinux_image_classification.jpg)
![armlinux_image_classification_raspberry_pi](https://paddlelite-demo.bj.bcebos.com/doc/armlinux_image_classification.jpg)

* mobilenetv1-ssd 目标检测
* 基于MobileNetV1-SSD的目标检测

![armlinux_object_detection_raspberry_pi](doc/armlinux_object_detection.jpg)
![armlinux_object_detection_raspberry_pi](https://paddlelite-demo.bj.bcebos.com/doc/armlinux_object_detection.jpg)
Binary file removed doc/android_image_classification_cat_cpu.jpg
Binary file not shown.
Binary file removed doc/android_image_classification_cat_npu.jpg
Binary file not shown.
Binary file removed doc/android_image_classification_keyboard_cpu.jpg
Binary file not shown.
Binary file removed doc/android_image_classification_keyboard_npu.jpg
Binary file not shown.
Binary file removed doc/android_object_detection_dog_cpu.jpg
Binary file not shown.
Binary file removed doc/armlinux_image_classification.jpg
Binary file not shown.
Binary file removed doc/armlinux_object_detection.jpg
Binary file not shown.
Binary file removed doc/enable_camera_on_raspberry_pi_step0.png
Binary file not shown.
Binary file removed doc/enable_camera_on_raspberry_pi_step1.png
Binary file not shown.
Binary file removed doc/enable_camera_on_raspberry_pi_step2.png
Binary file not shown.
Binary file removed doc/enable_camera_on_raspberry_pi_step3.png
Binary file not shown.
Binary file removed doc/enable_camera_on_raspberry_pi_step4.png
Binary file not shown.
Binary file removed doc/ios-image-detection.jpg
Binary file not shown.
Binary file removed doc/ios-video-detection.jpg
Binary file not shown.
Binary file removed doc/ios_static.jpg
Binary file not shown.
Binary file removed doc/ios_video.jpg
Binary file not shown.

0 comments on commit 448ff84

Please sign in to comment.