Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Commit b400c5d

Browse files
authored
Merge pull request #65 from Xreki/refine_readme
Refine the content of many README and add some Chinese README.
2 parents be2817a + e5b5aee commit b400c5d

File tree

7 files changed

+224
-89
lines changed

7 files changed

+224
-89
lines changed

Demo/iOS/AICamera/README_cn.md renamed to Demo/iOS/AICamera/README.cn.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ App模型需要开启摄像头权限。启动App后,点击屏幕,将会出
5151

5252
## 快速安装
5353

54-
如果你想快速地体验PDCamera,可通过扫描以下二维码进行安装。成功识别二维码之后,会自动跳转到安装页面,点击“Install PDCamera”链接,App会自动下载并安装到你的iOS设备上。
54+
如果你想快速地体验PDCamera,可通过扫描以下二维码进行安装。成功识别二维码之后,会自动跳转到安装页面,点击**“Install PDCamera”**链接,App会自动下载并安装到你的iOS设备上。
5555

56-
成功安装App后,你还需要安装如下步骤进一步设置:设置 → 通用 → 设备管理 → Baidu USA llc → 信任“Baidu USA llc”。
56+
成功安装App后,你还需要按照如下步骤设置你的iOS设备:**设置 → 通用 → 设备管理 → Baidu USA llc → 信任“Baidu USA llc”**
5757

5858
<p align="center">
5959
<img src="assets/qr_code_ios.png" width = "30%"/>
@@ -71,6 +71,8 @@ Github上面只维护了该Demo相关的源码文件和项目配置。用户可
7171

7272
VGG模型的识别精度高,但由于模型较大(104.3MB),需要占用较高的内存(\~800MB),并且识别速度慢(每帧~1.5秒),因此对设备的计算能力要求较高(iPhone6s以上),默认没有添加到项目中。用户也可自行下载[vgg\_ssd\_net.paddle](http://cloud.dlnel.org/filepub/?uuid=1116a5f3-7762-44b5-82bb-9954159cb5d4),添加到项目中,体验其高精度识别效果。
7373

74+
这里,我们使用的是**合并的模型**(merged model)。如何从配置文件(例如`config.py`)和训练得到的参数文件(例如`params_pass_0.tar.gz`)得的**合并的模型**文件,请参考[如何合并模型](../../../deployment/model/merge_config_parameters/README.cn.md)
75+
7476
### 准备PaddlePaddle库
7577

7678
用户可按照[iOS平台编译指南](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_ios_cn.md),拉取[Paddle](https://github.com/PaddlePaddle/Paddle)最新的源码,编译适用于iOS平台的PaddlePaddle库。在执行`make install`之后,PaddlePaddle库将会安装在`CMAKE_INSTALL_PREFIX`所指定的目录下。该目录包含如下子目录:

Demo/iOS/AICamera/README.md

Lines changed: 88 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,68 @@
11
# PDCamera iOS Demo with SSD Model
22

3+
- [Overview](#overview)
4+
- [Pre-trained Models](#pre-trained-models)
5+
- [Demo Screenshot](#demo-screenshot)
6+
- [Fast Installation through QR Code](#fast-installation-through-qr-code)
7+
- [Build from Source Code](#build-from-source-code)
8+
- [Prepare Models](#prepare-models)
9+
- [Prepare PaddlePaddle Inference Library](#prepare-paddlepaddle-inference-library)
10+
- [Directory Tree](#directory-tree)
11+
- [Integrate Paddle C Library to iOS Project](#integrate-paddle-c-library-to-ios-project)
12+
13+
## Overview
14+
315
This iOS demo shows PaddlePaddle running SSD(Single Shot MultiBox Detector)Object detection on iOS devices locally and offline. It loads a pretrained model with PaddlePaddle and uses camera to capture images and call PaddlePaddle's inference ability to show detected objects to users.
416

517
You can look at SSD model architecture [here](https://github.com/PaddlePaddle/models/tree/develop/ssd) and a linux demo [here](https://github.com/PaddlePaddle/Mobile/tree/develop/Demo/linux)
618

19+
### Pre-trained Models
720

8-
## Download and run the app
21+
`pascal_mobilenet_300_66` and `vgg_ssd_net` models can classify 20 objects.
22+
`face_mobilenet_160_91` can only classify human's face.
923

10-
To simply run the demo with iPhone/iPad, scan the QR code below, click "Install PDCamera" in the link and the app will be downloaded in the background.
11-
After installed, go to Settings -> General -> Device Management -> Baidu USA llc -> Trust "Baidu USA llc"
24+
| Model | Dimensions | Accuracy | Size |
25+
| ------------------------ |:----------:| --------:|------:|
26+
| [pascal\_mobilenet\_300\_66.paddle](http://cloud.dlnel.org/filepub/?uuid=39c325d9-b468-4940-ba47-d50c8ec5fd5b) | 300 x 300 | 66% | 23.2MB |
27+
| [vgg\_ssd\_net.paddle](http://cloud.dlnel.org/filepub/?uuid=1116a5f3-7762-44b5-82bb-9954159cb5d4) | 300 x 300 | 71% | 104.3MB |
28+
| [face\_mobilenet\_160\_91.paddle](http://cloud.dlnel.org/filepub/?uuid=038c1dbf-08b3-42a9-b2dc-efccd63859fb) | 160 x 160 | 91% | 18.4MB |
1229

30+
### Demo Screenshot
1331

14-
### QR code link
32+
Simply tap on the screen to toggle settings.
1533

16-
<img src="assets/qr_code_ios.png" width = "20%" />
17-
18-
### Demo screenshot
34+
- Models: Select Pascal MobileNet 300 or Face MobileNet 160, App will exit, need to launch to restart.
35+
- Camera: Toggle Front/Back Camera. App will exit, need to launch to restart.
36+
- Accuracy Threshold: Adjust threshold to filter more/less objects based on probability.
37+
- Time Refresh Rate: Adjust the time to refresh bounding box more/less frequently.
1938

20-
<img src="assets/demo_screenshot.jpg" width = "30%" />
39+
<p align="center">
40+
<img src="assets/demo_main.jpeg" width = "25%" />
41+
<img src="assets/demo_pascal.jpg" width = "25%" />
42+
<img src="assets/demo_face.jpeg" width = "25%" /><br/>
43+
Figure-1
44+
</p>
2145

2246
Detected object will be highlighted as a bounding box with a classified object label and probability.
2347

48+
## Fast Installation through QR Code
2449

25-
## Classifications
26-
`pascal_mobilenet_300_66` and `vgg_ssd_net` models can only classify following 20 objects:
27-
28-
- aeroplane
29-
- bicycle
30-
- background
31-
- boat
32-
- bottle
33-
- bus
34-
- car
35-
- cat
36-
- chair
37-
- cow
38-
- diningtable
39-
- dog
40-
- horse
41-
- motorbike
42-
- person
43-
- pottedplant
44-
- sheep
45-
- sofa
46-
- train
47-
- tvmonitor
48-
49-
`face_mobilenet_160_91` can only classify human's face
50-
51-
52-
## Settings
53-
54-
Simply tap on the screen to toggle settings
55-
56-
- Models: Select Pascal MobileNet 300 or Face MobileNet 160, App will exit, need to launch to restart.
57-
- Camera: Toggle Front/Back Camera. App will exit, need to launch to restart.
58-
- Accuracy Threshold: Adjust threshold to filter more/less objects based on probability
59-
- Time Refresh Rate: Adjust the time to refresh bounding box more/less frequently
50+
To simply run the demo with iPhone/iPad, scan the QR code below, click "Install PDCamera" in the link and the app will be downloaded in the background.
51+
After installed, go to Settings -> General -> Device Management -> Baidu USA llc -> Trust "Baidu USA llc"
6052

53+
<p align="center">
54+
<img src="assets/qr_code_ios.png" width = "30%"/>
55+
</p>
6156

62-
## Development or modify
57+
## Build from Source Code
6358

6459
Use latest XCode for development. This demo requires a camera for object detection, therefore you must use a device (iPhone or iPad) for development and testing. Simulators will not work as they cannot access camera.
6560

6661
For developers, feel free to use this as a reference to start a new project. This demo fully demonstrates how to integrate Paddle C Library to iOS and called from Swift.
6762

6863
Swift cannot directly call C API, in order to have client in Swift work, create Objective-C briding header and a Objective-C++ wrapper (.mm files) to access paddle APIs.
6964

70-
71-
## Integrate Paddle C Library to iOS
72-
73-
-Follow this guide [Build PaddlePaddle for iOS](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_ios_cn.md) to generate paddle libs(include, lib, third_party).
74-
-Create a folder paddle-ios and add to project root. Put the 3 paddle libs folder under paddle-ios.
75-
- Add the `include` directory to **Header Search Paths**
76-
![image](https://user-images.githubusercontent.com/12538138/32491809-b215cf7a-c37d-11e7-87f8-3d45f07bc63e.png)
77-
78-
- Add the `Accelerate.framework` or `veclib.framework` to your project, if your PaddlePaddle is built with `IOS_USE_VECLIB_FOR_BLAS=ON`
79-
- Add the libraries of paddle, `libpaddle_capi_layers.a` and `libpaddle_capi_engine.a`, and all the third party libraries to your project
80-
<img src="https://user-images.githubusercontent.com/12538138/32492222-2ecef414-c37f-11e7-9913-b90fc88be10f.png" width = "30%" />
81-
82-
- Set `-force_load` for `libpaddle_capi_layers.a`
83-
![image](https://user-images.githubusercontent.com/12538138/32492328-8504ebae-c37f-11e7-98b5-41615519fbb3.png)
84-
85-
86-
## Download Models
65+
### Prepare Models
8766

8867
Our models are too large to upload to Github. Create a model folder and add to project root. Download [face_mobilenet_160_91.paddle](http://cloud.dlnel.org/filepub/?uuid=038c1dbf-08b3-42a9-b2dc-efccd63859fb) and [pascal_mobilenet_300_66.paddle](http://cloud.dlnel.org/filepub/?uuid=39c325d9-b468-4940-ba47-d50c8ec5fd5b) to the model folder.
8968

@@ -92,11 +71,53 @@ Note: Only runs on iPhone6s or above (iPhone 6 or below will crash due to memory
9271
If you want to try it out, download [vgg_ssd_net.paddle](http://cloud.dlnel.org/filepub/?uuid=1116a5f3-7762-44b5-82bb-9954159cb5d4), then go to
9372
XCode target -> Bulid Phases -> Copy Bundle Resources, click '+' to add vgg_ssd_net.paddle
9473

74+
### Prepare PaddlePaddle Inference Library
75+
76+
Follow this guide [Build PaddlePaddle for iOS](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_ios_cn.md) to generate paddle libs(include, lib, third_party).
77+
Create a folder paddle-ios and add to project root. Put the 3 paddle libs folder under paddle-ios.
78+
79+
### Directory Tree
80+
81+
```
82+
$ git clone https://github.com/PaddlePaddle/Mobile.git
83+
$ cd Mobile/Demo/iOS/AICamera
84+
$ tree
85+
.
86+
├── AICamera # sources codes
87+
├── PDCamera.xcodeproj
88+
├── README.md
89+
├── README_cn.md
90+
├── assets
91+
├── models # models
92+
│   ├── face_mobilenet_160_91.paddle
93+
│   ├── pascal_mobilenet_300_66.paddle
94+
│   └── vgg_ssd_net.paddle
95+
└── paddle-ios # PaddlePaddle inference library
96+
├── include
97+
├── lib
98+
│   ├── libpaddle_capi_engine.a
99+
│   ├── libpaddle_capi_layers.a
100+
│   └── libpaddle_capi_whole.a
101+
└── third_party
102+
```
103+
104+
## Integrate Paddle C Library to iOS Project
95105

96-
## Accuracy
106+
- Add the `include` directory to **Header Search Paths**
107+
108+
<p align="center">
109+
<img src="https://user-images.githubusercontent.com/12538138/32491809-b215cf7a-c37d-11e7-87f8-3d45f07bc63e.png" width="90%">
110+
</p>
111+
112+
- Add the `Accelerate.framework` or `veclib.framework` to your project, if your PaddlePaddle is built with `IOS_USE_VECLIB_FOR_BLAS=ON`
113+
- Add the libraries of paddle, `libpaddle_capi_layers.a` and `libpaddle_capi_engine.a`, and all the third party libraries to your project
114+
115+
<p align="center">
116+
<img src="https://user-images.githubusercontent.com/12538138/32492222-2ecef414-c37f-11e7-9913-b90fc88be10f.png" width = "30%">
117+
</p>
118+
119+
- Set `-force_load` for `libpaddle_capi_layers.a`
97120

98-
| Model | Dimensions | Accuracy |
99-
| ------------------------ |:----------:| --------:|
100-
| face_mobilenet_160_91 | 160x160 | 91% |
101-
| pascal_mobilenet_300_66 | 300x300 | 66% |
102-
| vgg_ssd_net | 300x300 | 71% |
121+
<p align="center">
122+
<img src="https://user-images.githubusercontent.com/12538138/32492328-8504ebae-c37f-11e7-98b5-41615519fbb3.png" width="90%">
123+
</p>

README.cn.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# 移动PaddlePaddle
2+
3+
[![Build Status](https://travis-ci.org/PaddlePaddle/Mobile.svg?branch=develop)](https://travis-ci.org/PaddlePaddle/Mobile)
4+
[![Documentation Status](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](http://www.paddlepaddle.org/docs/develop/mobile/README.html)
5+
[![Download](https://img.shields.io/badge/download-latest-brightgreen.svg?style=flat)](https://github.com/PaddlePaddle/Mobile/wiki)
6+
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)
7+
8+
PaddlePaddle支持在移动设备上,使用训练好的模型进行离线推断。这里,我们主要介绍如何在移动设备上部署PaddlePaddle推断库,以及移动设备上可以使用到的一些优化方法。
9+
10+
## 构建PaddlePaddle库
11+
PaddlePaddle可以通过原生编译、交叉编译的方式,构建多种移动平台上的推断库。
12+
13+
- [Android平台编译指南](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_android_cn.md)
14+
- [iOS平台编译指南](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_ios_cn.md)
15+
- [Rapsberry Pi3平台编译指南](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_raspberry_cn.md)
16+
- NVIDIA Driver PX2平台,采用原生编译的方式,可直接依照[PaddlePaddle源码编译指南](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/getstarted/build_and_install/build_from_source_cn.rst)进行编译
17+
18+
## 使用示例
19+
20+
- [命令行示例程序](./benchmark/tool/C/README.cn.md)
21+
- [iOS示例应用:PDCamera](./Demo/iOS/AICamera/README.cn.md)
22+
23+
## 部署优化方法
24+
移动端对接入库的大小通常都有要求,在编译PaddlePaddle库时,用户可以通过设置一些编译选项来进行优化。
25+
26+
- [如何构建最小的PaddlePaddle推断库](./deployment/library/build_for_minimum_size.md)
27+
28+
训练得到的模型,可在不降低或者轻微降低模型推断精度的前提下,进行一些变换,优化移动设备上的内存使用和执行效率。
29+
30+
- [合并网络中的BN层](./deployment/model/merge_batch_normalization/README.md)
31+
- [压缩模型大小的rounding方法](./deployment/model/rounding/README.md)
32+
- [如何合并模型](./deployment/model/merge_config_parameters/README.cn.md)
33+
- INT8量化方法
34+
35+
## 模型压缩
36+
基于PaddlePaddle框架,可以使用模型压缩训练进一步裁剪模型的大小。
37+
38+
- [Pruning稀疏化方法](./model_compression/pruning/README.md)
39+
40+
## 性能数据
41+
我们列出一些移动设备上的性能测试数据,给用户参考和对比。
42+
43+
- [Mobilenet模型性能数据](./benchmark/README.md)
44+
- ENet模型性能数据
45+
- [DepthwiseConvolution优化效果](https://github.com/hedaoyuan/Function/blob/master/src/conv/README.md)
46+
47+
本教程由[PaddlePaddle](https://github.com/PaddlePaddle/Paddle)创作,采用[Apache-2.0 license](LICENSE)许可协议进行许可。

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
# Mobile
22

33
[![Build Status](https://travis-ci.org/PaddlePaddle/Mobile.svg?branch=develop)](https://travis-ci.org/PaddlePaddle/Mobile)
4+
[![Documentation Status](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](http://www.paddlepaddle.org/docs/develop/mobile/README.html)
5+
[![Download](https://img.shields.io/badge/download-latest-brightgreen.svg?style=flat)](https://github.com/PaddlePaddle/Mobile/wiki)
46
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)
57

68
Here mainly describes how to deploy PaddlePaddle to the mobile end, as well as some deployment optimization methods and some benchmark.
79

8-
## How to build PaddlePaddle for mobile
9-
- Build PaddlePaddle for Android [[Chinese](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_android_cn.md)] [[English](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_android_en.md)]
10-
- Build PaddlePaddle for IOS [[Chinese](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_ios_cn.md)] [[English](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_ios_en.md)]
11-
- Build PaddlePaddle for Raspberry Pi3 [[Chinese](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_raspberry_cn.md)] [[English](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_raspberry_en.md)]
12-
- Build PaddlePaddle for PX2
13-
- [How to build PaddlePaddle mobile inference library with minimum size.](./deployment/library/build_for_minimum_size.md)
10+
## Build PaddlePaddle
11+
- [Build PaddlePaddle for Android](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_android_en.md)
12+
- [Build PaddlePaddle for IOS](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_ios_en.md)
13+
- [Build PaddlePaddle for Raspberry Pi3](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/mobile/cross_compiling_for_raspberry_en.md)
14+
- Build PaddlePaddle for NVIDIA Driver PX2
1415

1516
## Demo
1617
- [A command-line inference demo.](./benchmark/tool/C/README.md)
17-
- [iOS demo of AICamera](./Demo/iOS/AICamera/README.md)
18+
- [iOS demo of PDCamera](./Demo/iOS/AICamera/README.md)
1819

1920
## Deployment optimization methods
20-
- [Merge batch normalization before deploying the model to the mobile.](./deployment/model/merge_batch_normalization/README.md)
21-
- [Compress the model before deploying the model to the mobile.](./deployment/model/rounding/README.md)
22-
- [Merge model config and parameter files into one file.](./deployment/model/merge_config_parameters/README.md)
23-
- How to deploy int8 model in mobile inference with PaddlePaddle.
21+
Optimization for the library:
22+
23+
- [How to build PaddlePaddle mobile inference library with minimum size.](./deployment/library/build_for_minimum_size.md)
24+
25+
Optimization for models:
26+
27+
- [Merge batch normalization layers](./deployment/model/merge_batch_normalization/README.md)
28+
- [Compress the model based on rounding](./deployment/model/rounding/README.md)
29+
- [Merge model's config and parameters](./deployment/model/merge_config_parameters/README.md)
30+
- How to deploy int8 model in mobile inference with PaddlePaddle
2431

2532
## Model compression
26-
- [How to use pruning to train smaller model](./model_compression/pruning/)
33+
- [How to use pruning to train smaller model](./model_compression/pruning/README.md)
2734

2835
## PaddlePaddle mobile benchmark
2936
- [Benchmark of Mobilenet](./benchmark/README.md)
3037
- Benchmark of ENet
31-
- [Benchmark of DepthwiseConvolution in PaddlePaddle](https://github.com/hedaoyuan/Function/blob/master/src/conv/README.md)
38+
- [Benchmark of DepthwiseConvolution](https://github.com/hedaoyuan/Function/blob/master/src/conv/README.md)
3239

3340
This tutorial is contributed by [PaddlePaddle](https://github.com/PaddlePaddle/Paddle) and licensed under the [Apache-2.0 license](LICENSE).

0 commit comments

Comments
 (0)