diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj index 78370395195c57e3fcab85a355eaafd6cc6d9021..64e83351b8ca195b42f0a0b32b7537f8e6ba5bdb 100644 --- a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj +++ b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj @@ -30,6 +30,7 @@ FCEBEC2C20E1391F00C0B14D /* paddle_mobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FCEBEC2B20E1391F00C0B14D /* paddle_mobile.framework */; }; FCEBEC2D20E1391F00C0B14D /* paddle_mobile.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FCEBEC2B20E1391F00C0B14D /* paddle_mobile.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; FCEEE7D4210627A000444BEC /* banana.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = FCEEE7D3210627A000444BEC /* banana.jpeg */; }; + FCF437E8214B6DDB00943429 /* Multi-Predict-ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCF437E7214B6DDB00943429 /* Multi-Predict-ViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -75,6 +76,7 @@ FCDFD41A211D91C7005AB38B /* synset.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = synset.txt; sourceTree = ""; }; FCEBEC2B20E1391F00C0B14D /* paddle_mobile.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = paddle_mobile.framework; sourceTree = BUILT_PRODUCTS_DIR; }; FCEEE7D3210627A000444BEC /* banana.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = banana.jpeg; sourceTree = ""; }; + FCF437E7214B6DDB00943429 /* Multi-Predict-ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Multi-Predict-ViewController.swift"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -140,6 +142,7 @@ FC039B8A20E11C560081E9F8 /* LaunchScreen.storyboard */, FC039B8D20E11C560081E9F8 /* Info.plist */, FC27991121343A39000B6BAD /* paddle-mobile-demo-Bridging-Header.h */, + FCF437E7214B6DDB00943429 /* Multi-Predict-ViewController.swift */, ); path = "paddle-mobile-demo"; sourceTree = ""; @@ -343,6 +346,7 @@ files = ( FC039B8420E11C550081E9F8 /* ViewController.swift in Sources */, FC013928210204A3008100E3 /* PreProcessKernel.metal in Sources */, + FCF437E8214B6DDB00943429 /* Multi-Predict-ViewController.swift in Sources */, FCBCCC552122EF5500D94F7E /* MetalHelper.swift in Sources */, FC039B8220E11C550081E9F8 /* AppDelegate.swift in Sources */, ); diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard b/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard index a5efadeb97ccc41449dc32a2c1dfcdfcf9fceac5..2a6d748bbe43327d6c4155ff42b5821a4c601210 100644 --- a/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard @@ -11,6 +11,34 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -199,7 +227,7 @@ - + diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/Multi-Predict-ViewController.swift b/metal/paddle-mobile-demo/paddle-mobile-demo/Multi-Predict-ViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..2ffdd0f17edfdfdcbbd230493fccfab04cb6001b --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/Multi-Predict-ViewController.swift @@ -0,0 +1,24 @@ +// +// Multi-Predict-ViewController.swift +// paddle-mobile-demo +// +// Created by liuRuiLong on 2018/9/14. +// Copyright © 2018年 orange. All rights reserved. +// + +import UIKit +import paddle_mobile + +class Multi_Predict_ViewController: UIViewController { + var runner1: Runner! + var runner2: Runner! + override func viewDidLoad() { + super.viewDidLoad() +// let net = MobileNet_ssd_hand.init(device: MetalHelper.shared.device) +// runner1 = Runner.init(inNet: <#T##Net#>, commandQueue: <#T##MTLCommandQueue?#>, inPlatform: <#T##Platform#>) + } + + @IBAction func predictAct(_ sender: Any) { + + } +} diff --git a/metal/paddle-mobile/paddle-mobile/MobilenetSSD_AR.swift b/metal/paddle-mobile/paddle-mobile/MobilenetSSD_AR.swift index 7debb79c737e363940a735c4f74c7c9efbe58c0b..106a1882ff9dd6edeff107f013c282346fd83977 100644 --- a/metal/paddle-mobile/paddle-mobile/MobilenetSSD_AR.swift +++ b/metal/paddle-mobile/paddle-mobile/MobilenetSSD_AR.swift @@ -30,7 +30,7 @@ public class MobileNet_ssd_AR: Net{ class MobilenetssdPreProccess: CusomKernel { init(device: MTLDevice) { let s = CusomKernel.Shape.init(inWidth: 160, inHeight: 160, inChannel: 3) - super.init(device: device, inFunctionName: "mobilent_ar_preprocess", outputDim: s, usePaddleMobileLib: false) + super.init(device: device, inFunctionName: "mobilent_ar_preprocess_half", outputDim: s, usePaddleMobileLib: false) } } diff --git a/metal/paddle-mobile/paddle-mobile/PaddleMobile.swift b/metal/paddle-mobile/paddle-mobile/PaddleMobile.swift index b43ea3742bc23d18b596d7f90935da840342dbfd..cd329394c6cce744d6e3c4de61ed3df6aa00b070 100644 --- a/metal/paddle-mobile/paddle-mobile/PaddleMobile.swift +++ b/metal/paddle-mobile/paddle-mobile/PaddleMobile.swift @@ -16,7 +16,7 @@ import Foundation class ScaleKernel: CusomKernel { init(device: MTLDevice, shape: Shape) { - super.init(device: device, inFunctionName: "scale", outputDim: shape, usePaddleMobileLib: false) + super.init(device: device, inFunctionName: "scale_half", outputDim: shape, usePaddleMobileLib: false) } } diff --git a/metal/paddle-mobile/paddle-mobile/framework/Executor.swift b/metal/paddle-mobile/paddle-mobile/framework/Executor.swift index 1cc8c08713e4c513a4247f2d19d4f151634892a3..f76d86c4725d6a89a2add77c584cd55d77154c75 100644 --- a/metal/paddle-mobile/paddle-mobile/framework/Executor.swift +++ b/metal/paddle-mobile/paddle-mobile/framework/Executor.swift @@ -14,10 +14,10 @@ import Foundation -let testTo = 114 +let testTo = 2 var isTest = false -let computePrecision: ComputePrecision = .Float32 +let computePrecision: ComputePrecision = .Float16 public class ResultHolder { public let dim: [Int] @@ -67,7 +67,7 @@ public class Executor { queue = inQueue for block in inProgram.programDesc.blocks { //block.ops.count - for i in 0...shared.creat(device: inDevice, opDesc: op, scope: inProgram.scope)