Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
f6d34bd0
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f6d34bd0
编写于
7月 06, 2018
作者:
W
WangLiu
提交者:
GitHub
7月 06, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #525 from codeWorm2015/develop
fix
#524
update development doc
上级
9ce3a516
debaeea6
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
88 addition
and
21 deletion
+88
-21
CMakeLists.txt
CMakeLists.txt
+4
-1
demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.pbxproj
...ddleMobileDemo/PaddleMobileDemo.xcodeproj/project.pbxproj
+11
-11
demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate
...ata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
demo/ios/PaddleMobileDemo/PaddleMobileDemo/PaddleMobile/PaddleMobile.h
...leMobileDemo/PaddleMobileDemo/PaddleMobile/PaddleMobile.h
+29
-3
doc/development_doc.md
doc/development_doc.md
+10
-6
src/ios_io/PaddleMobile.h
src/ios_io/PaddleMobile.h
+24
-0
src/ios_io/PaddleMobile.mm
src/ios_io/PaddleMobile.mm
+9
-0
tools/build.sh
tools/build.sh
+1
-0
未找到文件。
CMakeLists.txt
浏览文件 @
f6d34bd0
...
...
@@ -134,6 +134,9 @@ else ()
endif
()
if
(
DEBUGING
)
add_subdirectory
(
test
)
if
(
IS_IOS
)
else
()
add_subdirectory
(
test
)
endif
()
endif
()
demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.pbxproj
浏览文件 @
f6d34bd0
...
...
@@ -15,9 +15,9 @@
FC12E94120EB6B2900807EF4
/* main.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC12E94020EB6B2900807EF4
/* main.m */
;
};
FC12E94A20EB6B6800807EF4
/* libpaddle-mobile.a in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC12E94820EB6B6800807EF4
/* libpaddle-mobile.a */
;
};
FC12E94D20EB6BBB00807EF4
/* libstdc++.tbd in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC12E94C20EB6BBB00807EF4
/* libstdc++.tbd */
;
};
FC12E95120EB6BED00807EF4
/* params in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC12E94F20EB6BED00807EF4
/* params */
;
};
FC12E95220EB6BED00807EF4
/* model in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC12E95020EB6BED00807EF4
/* model */
;
};
FC12E95420EB6C0D00807EF4
/* apple.jpg in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC12E95320EB6C0D00807EF4
/* apple.jpg */
;
};
FC51640120EF758D00636C28
/* params in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC5163FF20EF758D00636C28
/* params */
;
};
FC51640220EF758D00636C28
/* model in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC51640020EF758D00636C28
/* model */
;
};
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
...
...
@@ -34,9 +34,9 @@
FC12E94820EB6B6800807EF4
/* libpaddle-mobile.a */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
archive.ar
;
path
=
"libpaddle-mobile.a"
;
sourceTree
=
"<group>"
;
};
FC12E94920EB6B6800807EF4
/* PaddleMobile.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
PaddleMobile.h
;
sourceTree
=
"<group>"
;
};
FC12E94C20EB6BBB00807EF4
/* libstdc++.tbd */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"sourcecode.text-based-dylib-definition"
;
name
=
"libstdc++.tbd"
;
path
=
"usr/lib/libstdc++.tbd"
;
sourceTree
=
SDKROOT
;
};
FC12E94F20EB6BED00807EF4
/* params */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
params
;
sourceTree
=
"<group>"
;
};
FC12E95020EB6BED00807EF4
/* model */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
model
;
sourceTree
=
"<group>"
;
};
FC12E95320EB6C0D00807EF4
/* apple.jpg */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.jpeg
;
path
=
apple.jpg
;
sourceTree
=
"<group>"
;
};
FC5163FF20EF758D00636C28
/* params */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
params
;
sourceTree
=
"<group>"
;
};
FC51640020EF758D00636C28
/* model */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
model
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
...
...
@@ -72,9 +72,9 @@
FC12E93020EB6B2800807EF4
/* PaddleMobileDemo */
=
{
isa
=
PBXGroup
;
children
=
(
FC12E95320EB6C0D00807EF4
/* apple.jpg */
,
FC12E94E20EB6BED00807EF4
/* googlenet_combine */
,
FC12E94720EB6B6800807EF4
/* PaddleMobile */
,
FC5163FE20EF758D00636C28
/* googlenet_combine */
,
FC12E95320EB6C0D00807EF4
/* apple.jpg */
,
FC12E93120EB6B2800807EF4
/* AppDelegate.h */
,
FC12E93220EB6B2800807EF4
/* AppDelegate.m */
,
FC12E93420EB6B2800807EF4
/* ViewController.h */
,
...
...
@@ -105,11 +105,11 @@
name
=
Frameworks
;
sourceTree
=
"<group>"
;
};
FC
12E94E20EB6BED00807EF4
/* googlenet_combine */
=
{
FC
5163FE20EF758D00636C28
/* googlenet_combine */
=
{
isa
=
PBXGroup
;
children
=
(
FC
12E94F20EB6BED00807EF4
/* params */
,
FC
12E95020EB6BED00807EF4
/* model */
,
FC
5163FF20EF758D00636C28
/* params */
,
FC
51640020EF758D00636C28
/* model */
,
);
path
=
googlenet_combine
;
sourceTree
=
"<group>"
;
...
...
@@ -171,10 +171,10 @@
isa
=
PBXResourcesBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
FC51640220EF758D00636C28
/* model in Resources */
,
FC51640120EF758D00636C28
/* params in Resources */
,
FC12E93E20EB6B2900807EF4
/* LaunchScreen.storyboard in Resources */
,
FC12E95220EB6BED00807EF4
/* model in Resources */
,
FC12E93B20EB6B2900807EF4
/* Assets.xcassets in Resources */
,
FC12E95120EB6BED00807EF4
/* params in Resources */
,
FC12E95420EB6C0D00807EF4
/* apple.jpg in Resources */
,
FC12E93920EB6B2800807EF4
/* Main.storyboard in Resources */
,
);
...
...
demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate
浏览文件 @
f6d34bd0
无法预览此类型文件
demo/ios/PaddleMobileDemo/PaddleMobileDemo/PaddleMobile/PaddleMobile.h
浏览文件 @
f6d34bd0
/* Copyright (c) 2018 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. */
#pragma once
#import <CoreImage/CoreImage.h>
#import <Foundation/Foundation.h>
@interface
PaddleMobile
:
NSObject
/*
创建对象
*/
-
(
instancetype
)
init
;
/*
load 模型, 开辟内存
*/
-
(
BOOL
)
load
:(
NSString
*
)
modelPath
andWeightsPath
:(
NSString
*
)
weighsPath
;
/*
加载散开形式的模型, 需传入模型的目录
*/
-
(
BOOL
)
load
:(
NSString
*
)
modelAndWeightPath
;
/*
进行预测, means 和 scale 为训练模型时的预处理参数, 如训练时没有做这些预处理则直接使用 predict
*/
-
(
NSArray
*
)
predict
:(
CGImageRef
)
image
dim
:(
NSArray
<
NSNumber
*>
*
)
dim
means
:(
NSArray
<
NSNumber
*>
*
)
means
scale
:(
float
)
scale
;
/*
进行预测
*/
-
(
NSArray
*
)
predict
:(
CGImageRef
)
image
dim
:(
NSArray
<
NSNumber
*>
*
)
dim
;
/*
清理内存
*/
-
(
void
)
clear
;
@end
doc/development_doc.md
浏览文件 @
f6d34bd0
...
...
@@ -4,9 +4,11 @@
## 编译
### 一. 使用 build.sh 编译
```
sh
# 在 paddle-mobile 目录下:
cd
tools
sh build.sh ios
# 如果只想编译某个特定模型的 op, 则需执行以下命令
...
...
@@ -17,9 +19,7 @@ cd ../build/release/ios/build
```
### 二. 集成
#### 如使用 oc 接口
## 集成
```
将上一步生成的:
...
...
@@ -28,7 +28,11 @@ libpaddle-mobile.a
/src/ios_io/ 下的
PaddleMobile.h
```
拖入工程, 接口如下:
拖入工程
#### oc 接口
接口如下:
```
/*
...
...
src/ios_io/PaddleMobile.h
浏览文件 @
f6d34bd0
...
...
@@ -19,10 +19,34 @@
@interface
PaddleMobile
:
NSObject
/*
创建对象
*/
-
(
instancetype
)
init
;
/*
load 模型, 开辟内存
*/
-
(
BOOL
)
load
:(
NSString
*
)
modelPath
andWeightsPath
:(
NSString
*
)
weighsPath
;
/*
加载散开形式的模型, 需传入模型的目录
*/
-
(
BOOL
)
load
:(
NSString
*
)
modelAndWeightPath
;
/*
进行预测, means 和 scale 为训练模型时的预处理参数, 如训练时没有做这些预处理则直接使用 predict
*/
-
(
NSArray
*
)
predict
:(
CGImageRef
)
image
dim
:(
NSArray
<
NSNumber
*>
*
)
dim
means
:(
NSArray
<
NSNumber
*>
*
)
means
scale
:(
float
)
scale
;
/*
进行预测
*/
-
(
NSArray
*
)
predict
:(
CGImageRef
)
image
dim
:(
NSArray
<
NSNumber
*>
*
)
dim
;
/*
清理内存
*/
-
(
void
)
clear
;
@end
src/ios_io/PaddleMobile.mm
浏览文件 @
f6d34bd0
...
...
@@ -62,6 +62,15 @@ static std::mutex shared_mutex;
}
}
-
(
BOOL
)
load
:(
NSString
*
)
modelAndWeightPath
{
std
::
string
model_path_str
=
std
::
string
([
modelAndWeightPath
UTF8String
]);
if
(
loaded_
=
pam_
->
Load
(
model_path_str
))
{
return
YES
;
}
else
{
return
NO
;
}
}
-
(
void
)
preprocess
:(
const
UInt8
*
)
input
output
:(
float
*
)
output
imageWidth
:(
int
)
imageWidth
imageHeight
:(
int
)
imageHeight
imageChannels
:(
int
)
imageChannels
means
:(
NSArray
<
NSNumber
*>
*
)
means
scale
:(
float
)
scale
dim
:(
std
::
vector
<
int64_t
>
)
dim
{
if
(
means
==
nil
)
{
means
=
@[
@0
,
@0
,
@0
];
...
...
tools/build.sh
浏览文件 @
f6d34bd0
...
...
@@ -119,6 +119,7 @@ build_for_ios() {
fi
cd
"
${
BUILD_DIR
}
"
make
-j
8
cp
../../../src/ios_io/PaddleMobile.h ./build/PaddleMobile.h
cd
./build
# 生成符号表
ranlib
*
.a
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录