diff --git a/demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.pbxproj b/demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.pbxproj index 8500c89c9af5ab2d56e08b576dc007a424262d15..469c228e82841a8ceb79842bd9f021566b9fbf6f 100644 --- a/demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.pbxproj +++ b/demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.pbxproj @@ -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 = ""; }; FC12E94920EB6B6800807EF4 /* PaddleMobile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaddleMobile.h; sourceTree = ""; }; 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 = ""; }; - FC12E95020EB6BED00807EF4 /* model */ = {isa = PBXFileReference; lastKnownFileType = file; path = model; sourceTree = ""; }; FC12E95320EB6C0D00807EF4 /* apple.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = apple.jpg; sourceTree = ""; }; + FC5163FF20EF758D00636C28 /* params */ = {isa = PBXFileReference; lastKnownFileType = file; path = params; sourceTree = ""; }; + FC51640020EF758D00636C28 /* model */ = {isa = PBXFileReference; lastKnownFileType = file; path = model; sourceTree = ""; }; /* 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 = ""; }; - FC12E94E20EB6BED00807EF4 /* googlenet_combine */ = { + FC5163FE20EF758D00636C28 /* googlenet_combine */ = { isa = PBXGroup; children = ( - FC12E94F20EB6BED00807EF4 /* params */, - FC12E95020EB6BED00807EF4 /* model */, + FC5163FF20EF758D00636C28 /* params */, + FC51640020EF758D00636C28 /* model */, ); path = googlenet_combine; sourceTree = ""; @@ -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 */, ); diff --git a/demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate b/demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate index 395136a63bb50378df8c37256880d4bbf9fd2f83..a5b221642f9973f6abd0b18cc017a58d9a61e434 100644 Binary files a/demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate and b/demo/ios/PaddleMobileDemo/PaddleMobileDemo.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/demo/ios/PaddleMobileDemo/PaddleMobileDemo/PaddleMobile/PaddleMobile.h b/demo/ios/PaddleMobileDemo/PaddleMobileDemo/PaddleMobile/PaddleMobile.h index ec58371de032c265b2c32a5bac61ca6cf682ff28..5854c5c3a4d4c899feb88822b2f7993860d1ed76 100644 --- a/demo/ios/PaddleMobileDemo/PaddleMobileDemo/PaddleMobile/PaddleMobile.h +++ b/demo/ios/PaddleMobileDemo/PaddleMobileDemo/PaddleMobile/PaddleMobile.h @@ -1,26 +1,52 @@ /* 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 #import @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 *)dim means:(NSArray *)means scale:(float)scale; + +/* + 进行预测 +*/ - (NSArray *)predict:(CGImageRef)image dim:(NSArray *)dim; + +/* + 清理内存 +*/ - (void)clear; @end