PaddleMobile.h 1.4 KB
Newer Older
1
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
L
liuruilong 已提交
2

3 4 5
 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
L
liuruilong 已提交
6

7
 http://www.apache.org/licenses/LICENSE-2.0
L
liuruilong 已提交
8

9 10 11 12 13 14
 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. */

15 16
#pragma once

17 18 19 20 21
#import <CoreImage/CoreImage.h>
#import <Foundation/Foundation.h>

@interface PaddleMobile : NSObject

L
liuruilong 已提交
22
/*
L
liuruilong 已提交
23
    创建对象
L
liuruilong 已提交
24
*/
25
- (instancetype)init;
L
liuruilong 已提交
26 27

/*
L
liuruilong 已提交
28
    load 模型, 开辟内存
L
liuruilong 已提交
29
*/
30
- (BOOL)load:(NSString *)modelPath andWeightsPath:(NSString *)weighsPath;
L
liuruilong 已提交
31

L
liuruilong 已提交
32 33 34 35 36
/*
  加载散开形式的模型, 需传入模型的目录
*/
- (BOOL)load:(NSString *)modelAndWeightPath;

L
liuruilong 已提交
37
/*
L
liuruilong 已提交
38
    进行预测, means 和 scale 为训练模型时的预处理参数, 如训练时没有做这些预处理则直接使用 predict
L
liuruilong 已提交
39
*/
40
- (NSArray *)predict:(CGImageRef)image dim:(NSArray<NSNumber *> *)dim means:(NSArray<NSNumber *> *)means scale:(float)scale;
L
liuruilong 已提交
41 42

/*
L
liuruilong 已提交
43
    进行预测
L
liuruilong 已提交
44
*/
45
- (NSArray *)predict:(CGImageRef)image dim:(NSArray<NSNumber *> *)dim;
L
liuruilong 已提交
46 47

/*
L
liuruilong 已提交
48
    清理内存
L
liuruilong 已提交
49
*/
50 51 52
- (void)clear;

@end