You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 24, 2024. It is now read-only.
-[Integrate Paddle C Library to iOS Project](#integrate-paddle-c-library-to-ios-project)
12
+
13
+
## Overview
14
+
3
15
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.
4
16
5
17
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)
6
18
19
+
### Pre-trained Models
7
20
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.
9
23
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"
Detected object will be highlighted as a bounding box with a classified object label and probability.
23
47
48
+
## Fast Installation through QR Code
24
49
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"
60
52
53
+
<palign="center">
54
+
<imgsrc="assets/qr_code_ios.png"width = "30%"/>
55
+
</p>
61
56
62
-
## Development or modify
57
+
## Build from Source Code
63
58
64
59
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.
65
60
66
61
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.
67
62
68
63
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.
69
64
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**
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.
89
68
@@ -92,11 +71,53 @@ Note: Only runs on iPhone6s or above (iPhone 6 or below will crash due to memory
92
71
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
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.
Here mainly describes how to deploy PaddlePaddle to the mobile end, as well as some deployment optimization methods and some benchmark.
7
9
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)
-[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
24
31
25
32
## 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)
27
34
28
35
## PaddlePaddle mobile benchmark
29
36
-[Benchmark of Mobilenet](./benchmark/README.md)
30
37
- 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)
32
39
33
40
This tutorial is contributed by [PaddlePaddle](https://github.com/PaddlePaddle/Paddle) and licensed under the [Apache-2.0 license](LICENSE).
0 commit comments