PML.java 1.8 KB
Newer Older
1 2 3 4 5 6 7 8 9
package com.baidu.paddle;

public class PML {
    /**
     * load seperated model
     *
     * @param modelDir model dir
     * @return isloadsuccess
     */
H
hjchen2 已提交
10
    public static native boolean load(String modelDir, Boolean lodMode);
xiebaiyuan's avatar
xiebaiyuan 已提交
11

12 13 14 15 16 17 18
    /**
     * load combined model
     *
     * @param modelPath model file path
     * @param paramPath param file path
     * @return isloadsuccess
     */
H
hjchen2 已提交
19
    public static native boolean loadCombined(String modelPath, String paramPath, Boolean lodMode);
20 21 22 23 24 25 26

    /**
     * load model and qualified params
     *
     * @param modelDir qualified model dir
     * @return isloadsuccess
     */
H
hjchen2 已提交
27
    public static native boolean loadQualified(String modelDir, Boolean lodMode);
28 29 30 31 32 33 34 35

    /**
     * load model and qualified combined params
     *
     * @param modelPath model file path
     * @param paramPath qualified param path
     * @return isloadsuccess
     */
H
hjchen2 已提交
36
    public static native boolean loadCombinedQualified(String modelPath, String paramPath, Boolean lodMode);
37 38 39 40 41 42 43 44 45 46

    /**
     * predict image
     *
     * @param buf   of pretreated image (as your model like)
     * @param ddims format of your input
     * @return result
     */
    public static native float[] predictImage(float[] buf, int[] ddims);

47 48
    public static native float[] fetch(String varName);

49 50
    public static native float[] predictYuv(byte[] buf, int imgWidth, int imgHeight, int[] ddims, float[] meanValues);

H
hjchen2 已提交
51 52 53 54
    // predict with variable length input
    // support only one input and one output currently
    public static native float[] predictLod(float[] buf);

55 56 57 58 59 60 61 62 63 64 65 66
    /**
     * clear model data
     */
    public static native void clear();

    /**
     * setThread num when u enable openmp
     *
     * @param threadCount threadCount
     */
    public static native void setThread(int threadCount);
}