Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
4791da97
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看板
未验证
提交
4791da97
编写于
9月 10, 2018
作者:
R
Ruilong Liu
提交者:
GitHub
9月 10, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #934 from codeWorm2015/metal
update paddle-mobile demo
上级
cc2b23d8
43bcc347
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
15 addition
and
14 deletion
+15
-14
metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift
...addle-mobile-demo/paddle-mobile-demo/ViewController.swift
+4
-3
metal/paddle-mobile-demo/paddle-mobile-demo/paddle-mobile-demo-Bridging-Header.h
...o/paddle-mobile-demo/paddle-mobile-demo-Bridging-Header.h
+1
-1
metal/paddle-mobile/paddle-mobile/Genet.swift
metal/paddle-mobile/paddle-mobile/Genet.swift
+3
-3
metal/paddle-mobile/paddle-mobile/MobileNetSSD.swift
metal/paddle-mobile/paddle-mobile/MobileNetSSD.swift
+3
-3
metal/paddle-mobile/paddle-mobile/PaddleMobile.swift
metal/paddle-mobile/paddle-mobile/PaddleMobile.swift
+1
-1
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.h
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.h
+3
-3
未找到文件。
metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift
浏览文件 @
4791da97
...
@@ -17,11 +17,11 @@ import MetalKit
...
@@ -17,11 +17,11 @@ import MetalKit
import
paddle_mobile
import
paddle_mobile
import
MetalPerformanceShaders
import
MetalPerformanceShaders
let
platform
:
Platform
=
.
C
PU
let
platform
:
Platform
=
.
G
PU
let
threadSupport
=
[
1
]
let
threadSupport
=
[
1
]
let
modelHelperMap
:
[
SupportModel
:
Runner
]
=
[
.
mobilenet_ssd
:
Runner
.
init
(
inNet
:
MobileNet_ssd_hand
.
init
(),
commandQueue
:
MetalHelper
.
shared
.
queue
,
inPlatform
:
platform
),
let
modelHelperMap
:
[
SupportModel
:
Runner
]
=
[
.
mobilenet_ssd
:
Runner
.
init
(
inNet
:
MobileNet_ssd_hand
.
init
(
device
:
MetalHelper
.
shared
.
device
),
commandQueue
:
MetalHelper
.
shared
.
queue
,
inPlatform
:
platform
),
.
genet
:
Runner
.
init
(
inNet
:
Genet
.
init
(),
commandQueue
:
MetalHelper
.
shared
.
queue
,
inPlatform
:
platform
)]
.
genet
:
Runner
.
init
(
inNet
:
Genet
.
init
(
device
:
MetalHelper
.
shared
.
device
),
commandQueue
:
MetalHelper
.
shared
.
queue
,
inPlatform
:
platform
)]
//, .genet : Genet.init()
//, .genet : Genet.init()
//let modelHelperMap: [SupportModel : Net] = [.mobilenet : MobileNet.init(), .mobilenet_ssd : MobileNet_ssd_hand.init()]
//let modelHelperMap: [SupportModel : Net] = [.mobilenet : MobileNet.init(), .mobilenet_ssd : MobileNet_ssd_hand.init()]
...
@@ -48,6 +48,7 @@ class ViewController: UIViewController {
...
@@ -48,6 +48,7 @@ class ViewController: UIViewController {
var
toPredictTexture
:
MTLTexture
?
var
toPredictTexture
:
MTLTexture
?
var
runner
:
Runner
{
var
runner
:
Runner
{
get
{
get
{
return
modelHelperMap
[
modelType
]
?
!
" has no this type "
return
modelHelperMap
[
modelType
]
?
!
" has no this type "
}
}
...
...
metal/paddle-mobile-demo/paddle-mobile-demo/paddle-mobile-demo-Bridging-Header.h
浏览文件 @
4791da97
...
@@ -4,4 +4,4 @@
...
@@ -4,4 +4,4 @@
#import "CPUCompute.h"
//#import <paddle_mobile/>
metal/paddle-mobile/paddle-mobile/Genet.swift
浏览文件 @
4791da97
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
import
Foundation
import
Foundation
class
Genet
:
Net
{
public
class
Genet
:
Net
{
@objc
override
init
(
device
:
MTLDevice
)
{
@objc
public
override
init
(
device
:
MTLDevice
)
{
super
.
init
(
device
:
device
)
super
.
init
(
device
:
device
)
means
=
[
128.0
,
128.0
,
128.0
]
means
=
[
128.0
,
128.0
,
128.0
]
scale
=
0.017
scale
=
0.017
...
@@ -34,7 +34,7 @@ class Genet: Net {
...
@@ -34,7 +34,7 @@ class Genet: Net {
}
}
}
}
override
func
resultStr
(
res
:
[
Float
])
->
String
{
override
public
func
resultStr
(
res
:
[
Float
])
->
String
{
return
"
\(
Array
<
Float
>
(
res
.
suffix
(
10
))
)
... "
return
"
\(
Array
<
Float
>
(
res
.
suffix
(
10
))
)
... "
}
}
...
...
metal/paddle-mobile/paddle-mobile/MobileNetSSD.swift
浏览文件 @
4791da97
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
import
Foundation
import
Foundation
class
MobileNet_ssd_hand
:
Net
{
public
class
MobileNet_ssd_hand
:
Net
{
@objc
override
init
(
device
:
MTLDevice
)
{
@objc
public
override
init
(
device
:
MTLDevice
)
{
super
.
init
(
device
:
device
)
super
.
init
(
device
:
device
)
means
=
[
123.68
,
116.78
,
103.94
]
means
=
[
123.68
,
116.78
,
103.94
]
scale
=
0.017
scale
=
0.017
...
@@ -34,7 +34,7 @@ class MobileNet_ssd_hand: Net{
...
@@ -34,7 +34,7 @@ class MobileNet_ssd_hand: Net{
}
}
}
}
override
func
resultStr
(
res
:
[
Float
])
->
String
{
override
public
func
resultStr
(
res
:
[
Float
])
->
String
{
return
"
\(
res
)
"
return
"
\(
res
)
"
}
}
...
...
metal/paddle-mobile/paddle-mobile/PaddleMobile.swift
浏览文件 @
4791da97
...
@@ -33,7 +33,7 @@ public class Net: NSObject {
...
@@ -33,7 +33,7 @@ public class Net: NSObject {
var
modelPath
:
String
=
""
var
modelPath
:
String
=
""
var
paramPath
:
String
=
""
var
paramPath
:
String
=
""
var
modelDir
:
String
=
""
var
modelDir
:
String
=
""
func
resultStr
(
res
:
[
Float
])
->
String
{
public
func
resultStr
(
res
:
[
Float
])
->
String
{
fatalError
()
fatalError
()
}
}
func
fetchResult
(
paddleMobileRes
:
ResultHolder
)
->
[
Float32
]
{
func
fetchResult
(
paddleMobileRes
:
ResultHolder
)
->
[
Float32
]
{
...
...
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.h
浏览文件 @
4791da97
...
@@ -16,9 +16,9 @@
...
@@ -16,9 +16,9 @@
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
typedef
enum
:
NSUInteger
{
typedef
enum
:
NSUInteger
{
MobileNet
,
MobileNet
Type
,
MobileNetSSD
,
MobileNetSSD
Type
,
Genet
,
Genet
Type
,
}
NetType
;
}
NetType
;
@interface
ModelConfig
:
NSObject
@interface
ModelConfig
:
NSObject
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录