PML.java 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
package com.baidu.paddle;

public class PML {
    /**
     * load seperated model
     *
     * @param modelDir model dir
     * @return isloadsuccess
     */
    public static native boolean load(String modelDir);

    /**
     * load combined model
     *
     * @param modelPath model file path
     * @param paramPath param file path
     * @return isloadsuccess
     */
    public static native boolean loadCombined(String modelPath, String paramPath);

    /**
     * load model and qualified params
     *
     * @param modelDir qualified model dir
     * @return isloadsuccess
     */
    public static native boolean loadQualified(String modelDir);

    /**
     * load model and qualified combined params
     *
     * @param modelPath model file path
     * @param paramPath qualified param path
     * @return isloadsuccess
     */
    public static native boolean loadCombinedQualified(String modelPath, String paramPath);

    /**
     * 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);


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

    /**
     * clear model data
     */
    public static native void clear();

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


}