提交 d2fdc0a7 编写于 作者: E eclipsycn 提交者: GitHub

Merge branch 'develop' into develop

...@@ -9,7 +9,6 @@ option(LOG_PROFILE "log profile" ON) ...@@ -9,7 +9,6 @@ option(LOG_PROFILE "log profile" ON)
option(CPU "armv7 with neon" ON) option(CPU "armv7 with neon" ON)
option(MALI_GPU "mali gpu" OFF) option(MALI_GPU "mali gpu" OFF)
option(FPGA "fpga" OFF) option(FPGA "fpga" OFF)
set(DEBUGING ON)
if (ARM_LINUX) if (ARM_LINUX)
include("${CMAKE_CURRENT_LIST_DIR}/tools/arm-platform.cmake") include("${CMAKE_CURRENT_LIST_DIR}/tools/arm-platform.cmake")
......
...@@ -121,7 +121,14 @@ public class MainActivity extends Activity { ...@@ -121,7 +121,14 @@ public class MainActivity extends Activity {
String assetPath = "pml_demo"; String assetPath = "pml_demo";
String sdcardPath = Environment.getExternalStorageDirectory() String sdcardPath = Environment.getExternalStorageDirectory()
+ File.separator + assetPath + File.separator + type; + File.separator + assetPath + File.separator + type;
PML.load(sdcardPath); //PML.load(sdcardPath);
String modelPath = Environment.getExternalStorageDirectory()
+ File.separator + assetPath +
File.separator + "googlenet_combine" + File.separator + "model";
String paramPath = Environment.getExternalStorageDirectory()
+ File.separator + assetPath +
File.separator + "googlenet_combine" + File.separator + "params";
PML.loadCombined(modelPath, paramPath);
} }
}); });
......
...@@ -8,6 +8,14 @@ public class PML { ...@@ -8,6 +8,14 @@ public class PML {
*/ */
public static native boolean load(String modelPath); public static native boolean load(String modelPath);
/**
* Load
* @param modelPath
* @param paramPath
* @return
*/
public static native boolean loadCombined(String modelPath,String paramPath);
/** /**
* object detection * object detection
......
...@@ -60,6 +60,15 @@ JNIEXPORT jboolean JNICALL Java_com_baidu_paddle_PML_load(JNIEnv *env, ...@@ -60,6 +60,15 @@ JNIEXPORT jboolean JNICALL Java_com_baidu_paddle_PML_load(JNIEnv *env,
optimize); optimize);
} }
JNIEXPORT jboolean JNICALL Java_com_baidu_paddle_PML_loadCombined(
JNIEnv *env, jclass thiz, jstring modelPath, jstring paramPath) {
ANDROIDLOGI("load invoked");
bool optimize = true;
return getPaddleMobileInstance()->Load(jstring2cppstring(env, modelPath),
jstring2cppstring(env, paramPath),
optimize);
}
JNIEXPORT jfloatArray JNICALL JNIEXPORT jfloatArray JNICALL
Java_com_baidu_paddle_PML_predict(JNIEnv *env, jclass thiz, jfloatArray buf) { Java_com_baidu_paddle_PML_predict(JNIEnv *env, jclass thiz, jfloatArray buf) {
jfloatArray result = NULL; jfloatArray result = NULL;
......
...@@ -22,11 +22,16 @@ extern "C" { ...@@ -22,11 +22,16 @@ extern "C" {
namespace paddle_mobile { namespace paddle_mobile {
namespace jni { namespace jni {
/** /**
* load model & params of the net for android * load separated model for android
*/ */
JNIEXPORT jboolean JNICALL Java_com_baidu_paddle_PML_load(JNIEnv *env, JNIEXPORT jboolean JNICALL Java_com_baidu_paddle_PML_load(JNIEnv *env,
jclass thiz, jclass thiz,
jstring modelPath); jstring modelPath);
/**
* load combined model for android
*/
JNIEXPORT jboolean JNICALL Java_com_baidu_paddle_PML_loadCombined(
JNIEnv *env, jclass thiz, jstring modelPath, jstring paramPath);
/** /**
* object detection for anroid * object detection for anroid
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册