diff --git a/demo/android/PaddleMobile_Android/.gitignore b/demo/android/PaddleMobile_Android/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..39fb081a42a86ccf8f9cf99dbccc8bdf7c828bce
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/.gitignore
@@ -0,0 +1,9 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
+.externalNativeBuild
diff --git a/demo/android/PaddleMobile_Android/app/.gitignore b/demo/android/PaddleMobile_Android/app/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/.gitignore
@@ -0,0 +1 @@
+
diff --git a/demo/android/PaddleMobile_Android/app/build.gradle b/demo/android/PaddleMobile_Android/app/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..3d61efb83a083909a0038886469e1c7fce218e8c
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/build.gradle
@@ -0,0 +1,23 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ defaultConfig {
+ applicationId "com.baidu.paddle"
+ minSdkVersion 15
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'com.android.support:appcompat-v7:21.0.3'
+}
diff --git a/demo/android/PaddleMobile_Android/app/proguard-rules.pro b/demo/android/PaddleMobile_Android/app/proguard-rules.pro
new file mode 100644
index 0000000000000000000000000000000000000000..f1b424510da51fd82143bc74a0a801ae5a1e2fcd
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/demo/android/PaddleMobile_Android/app/src/main/AndroidManifest.xml b/demo/android/PaddleMobile_Android/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b9bf81dcb9fffb855d067cc7df1633ebcf586432
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demo/android/PaddleMobile_Android/app/src/main/java/com/baidu/paddle/MainActivity.java b/demo/android/PaddleMobile_Android/app/src/main/java/com/baidu/paddle/MainActivity.java
new file mode 100755
index 0000000000000000000000000000000000000000..febe816681d3845a61c5a8b40630e82ac9b4ea95
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/src/main/java/com/baidu/paddle/MainActivity.java
@@ -0,0 +1,408 @@
+/*
+ * Copyright (c) 2016 Baidu, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
+ * the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+package com.baidu.paddle;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Environment;
+
+import android.provider.MediaStore;
+
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static android.graphics.Color.blue;
+import static android.graphics.Color.green;
+import static android.graphics.Color.red;
+import static com.baidu.paddle.MainActivity.TYPE.googlenet;
+
+
+public class MainActivity extends Activity {
+ public static final int TAKE_PHOTO_REQUEST_CODE = 1001;
+
+ private Context mContext = null;
+
+ private int inputSize = 224;
+
+ enum TYPE {
+ googlenet
+ }
+
+ private TYPE type = googlenet;
+ private ImageView imageView;
+ private TextView tvSpeed;
+ private Button button;
+ private Bitmap bmp;
+
+ static {
+ try {
+ System.loadLibrary("paddle-mobile");
+
+ } catch (SecurityException e) {
+ e.printStackTrace();
+
+ } catch (UnsatisfiedLinkError e) {
+ e.printStackTrace();
+
+ } catch (NullPointerException e) {
+ e.printStackTrace();
+
+ }
+
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mContext = this;
+ setContentView(R.layout.main_activity);
+ init();
+ }
+
+ private void init() {
+ imageView = (ImageView) findViewById(R.id.imageView);
+ tvSpeed = (TextView) findViewById(R.id.tv_speed);
+ button = (Button) findViewById(R.id.button);
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (!isHasSdCard()) {
+ Toast.makeText(mContext, R.string.sdcard_not_available,
+ Toast.LENGTH_LONG).show();
+ return;
+ }
+ Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+ // save pic in sdcard
+ Uri imageUri = Uri.fromFile(getTempImage());
+ intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
+ startActivityForResult(intent, TAKE_PHOTO_REQUEST_CODE);
+
+ }
+ });
+ Button bt_load = (Button) findViewById(R.id.bt_load);
+ bt_load.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ String assetPath = "pml_demo";
+ String sdcardPath = Environment.getExternalStorageDirectory()
+ + File.separator + assetPath + File.separator + type;
+ PML.load(sdcardPath);
+
+ }
+ });
+ Button bt_clear = (Button) findViewById(R.id.bt_clear);
+ bt_clear.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+
+ PML.clear();
+
+
+ }
+ });
+ String assetPath = "pml_demo";
+ String sdcardPath = Environment.getExternalStorageDirectory()
+ + File.separator + assetPath;
+ copyFilesFromAssets(this, assetPath, sdcardPath);
+
+
+ }
+
+ public void copyFilesFromAssets(Context context, String oldPath, String newPath) {
+ try {
+ String[] fileNames = context.getAssets().list(oldPath);
+ if (fileNames.length > 0) {
+ // directory
+ File file = new File(newPath);
+ file.mkdirs();
+ // copy recursivelyC
+ for (String fileName : fileNames) {
+ copyFilesFromAssets(context, oldPath + "/" + fileName,
+ newPath + "/" + fileName);
+ }
+ } else {
+ // file
+ InputStream is = context.getAssets().open(oldPath);
+ FileOutputStream fos = new FileOutputStream(new File(newPath));
+ byte[] buffer = new byte[1024];
+ int byteCount;
+ while ((byteCount = is.read(buffer)) != -1) {
+ fos.write(buffer, 0, byteCount);
+ }
+ fos.flush();
+ is.close();
+ fos.close();
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public File getTempImage() {
+ if (Environment.getExternalStorageState().equals(
+ Environment.MEDIA_MOUNTED)) {
+ File tempFile = new File(Environment.getExternalStorageDirectory(), "temp.jpg");
+ try {
+ tempFile.createNewFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return tempFile;
+ }
+ return null;
+ }
+
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ switch (requestCode) {
+ case TAKE_PHOTO_REQUEST_CODE:
+ if (resultCode == RESULT_OK) {
+ DetectionTask detectionTask = new DetectionTask();
+ detectionTask.execute(getTempImage().getPath());
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * draw rect on imageView
+ *
+ * @param bitmap
+ * @param predicted
+ * @param viewWidth
+ * @param viewHeight
+ */
+ private void drawRect(Bitmap bitmap, float[] predicted, int viewWidth, int viewHeight) {
+
+ Canvas canvas = new Canvas(bitmap);
+ canvas.drawBitmap(bitmap, 0, 0, null);
+ if (type == googlenet) {
+ Paint paint = new Paint();
+ paint.setColor(Color.RED);
+ paint.setStyle(Paint.Style.STROKE);
+ paint.setStrokeWidth(3.0f);
+ float x1 = 0;
+ float x2 = 0;
+ float y1 = 0;
+ float y2 = 0;
+
+ // the googlenet result sequence is (left top right top bottom)
+ x1 = (predicted[0] * viewWidth / 224);
+ y1 = (predicted[1] * viewHeight / 224);
+ x2 = (predicted[2] * viewWidth / 224);
+ y2 = (predicted[3] * viewHeight / 224);
+
+
+ canvas.drawRect(x1, y1, x2, y2, paint);
+ }
+
+
+ imageView.setImageBitmap(bitmap);
+
+ }
+
+ float getMaxIndex(float[] predicted) {
+ float max = 0;
+ int index = 0;
+ for (int i = 0; i < predicted.length; i++) {
+ if (predicted[i] > max) {
+ max = predicted[i];
+ index = i;
+ }
+ }
+ return index;
+ }
+
+ public float[] getScaledMatrix(Bitmap bitmap, int desWidth,
+ int desHeight) {
+ float[] dataBuf = new float[3 * desWidth * desHeight];
+ int rIndex;
+ int gIndex;
+ int bIndex;
+ int[] pixels = new int[desWidth * desHeight];
+ Bitmap bm = Bitmap.createScaledBitmap(bitmap, desWidth, desHeight, false);
+ bm.getPixels(pixels, 0, desWidth, 0, 0, desWidth, desHeight);
+ int j = 0;
+ int k = 0;
+ for (int i = 0; i < pixels.length; i ++) {
+ int clr = pixels[i];
+ j = i / desHeight;
+ k = i % desWidth;
+ rIndex = j * desWidth + k;
+ gIndex = rIndex + desHeight * desWidth;
+ bIndex = gIndex + desHeight * desWidth;
+ dataBuf[rIndex] = (float)((clr & 0x00ff0000)>> 16) -148;
+ dataBuf[gIndex] = (float)((clr & 0x0000ff00)>> 8) - 148;
+ dataBuf[bIndex] = (float)((clr & 0x000000ff)) -148;
+
+ }
+ if (bm.isRecycled()) {
+ bm.recycle();
+ }
+ return dataBuf;
+
+
+ }
+ /**
+ * check whether sdcard is mounted
+ *
+ * @return
+ */
+ public boolean isHasSdCard() {
+ if (Environment.getExternalStorageState().equals(
+ Environment.MEDIA_MOUNTED)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public void dumpData(float[] results, String filename) {
+ try {
+ File writename = new File(filename);
+ writename.createNewFile();
+ BufferedWriter out = new BufferedWriter(new FileWriter(writename));
+ for (float result : results) {
+ out.write(result + " ");
+ }
+ out.flush();
+ out.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * scale bitmap in case of OOM
+ *
+ * @param ctx
+ * @param filePath
+ * @return
+ */
+ public Bitmap getScaleBitmap(Context ctx, String filePath) {
+ BitmapFactory.Options opt = new BitmapFactory.Options();
+ opt.inJustDecodeBounds = true;
+ BitmapFactory.decodeFile(filePath, opt);
+
+ int bmpWidth = opt.outWidth;
+ int bmpHeight = opt.outHeight;
+
+ int maxSize = 500;
+
+ opt.inSampleSize = 1;
+ while (true) {
+ if (bmpWidth / opt.inSampleSize < maxSize || bmpHeight / opt.inSampleSize < maxSize) {
+ break;
+ }
+ opt.inSampleSize *= 2;
+ }
+ opt.inJustDecodeBounds = false;
+ Bitmap bmp = BitmapFactory.decodeFile(filePath, opt);
+ return bmp;
+ }
+
+ @Override
+ public void onBackPressed() {
+ super.onBackPressed();
+ Log.d("mdl", "mdl clear");
+ // clear mdl
+ PML.clear();
+
+ }
+
+ class DetectionTask extends AsyncTask {
+ private long time;
+
+ public DetectionTask() {
+ super();
+ }
+
+ @Override
+ protected void onPreExecute() {
+ super.onPreExecute();
+ if (type == googlenet) {
+ inputSize = 224;
+ }
+ }
+
+ @Override
+ protected void onPostExecute(float[] result) {
+ super.onPostExecute(result);
+ try {
+ Bitmap src = Bitmap.createScaledBitmap(bmp, imageView.getWidth(),
+ imageView.getHeight(), false);
+ drawRect(src, result, imageView.getWidth(), imageView.getHeight());
+ tvSpeed.setText("detection cost:" + time + "ms");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ protected void onProgressUpdate(Void... values) {
+ super.onProgressUpdate(values);
+ }
+
+ @Override
+ protected void onCancelled() {
+ super.onCancelled();
+ }
+
+ @Override
+ protected float[] doInBackground(String... strings) {
+ bmp = getScaleBitmap(mContext, strings[0]);
+ float[] inputData = getScaledMatrix(bmp, inputSize, inputSize);
+ float[] result = null;
+ try {
+ long start = System.currentTimeMillis();
+ result = PML.predict(inputData);
+ long end = System.currentTimeMillis();
+ time = end - start;
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+ }
+}
diff --git a/demo/android/PaddleMobile_Android/app/src/main/java/com/baidu/paddle/PML.java b/demo/android/PaddleMobile_Android/app/src/main/java/com/baidu/paddle/PML.java
new file mode 100644
index 0000000000000000000000000000000000000000..7649d4c081223bace01b806d1eb7dca57129ed7c
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/src/main/java/com/baidu/paddle/PML.java
@@ -0,0 +1,23 @@
+package com.baidu.paddle;
+
+public class PML {
+ /**
+ * Load
+ * @param modelPath
+ * @return
+ */
+ public static native boolean load(String modelPath);
+
+
+ /**
+ * object detection
+ *
+ * @param buf
+ * @return
+ */
+ public static native float[] predict(float[] buf);
+
+
+ public static native void clear();
+
+}
diff --git a/demo/android/PaddleMobile_Android/app/src/main/res/drawable/ic_launcher_background.xml b/demo/android/PaddleMobile_Android/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d5fccc538c179838bfdce779c26eebb4fa0b5ce9
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demo/android/PaddleMobile_Android/app/src/main/res/layout/main_activity.xml b/demo/android/PaddleMobile_Android/app/src/main/res/layout/main_activity.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6653b182adbfc6d82d50d313db8c88789c0b027b
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/src/main/res/layout/main_activity.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/demo/android/PaddleMobile_Android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/demo/android/PaddleMobile_Android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000000000000000000000000000000000000..a2f5908281d070150700378b64a84c7db1f97aa1
Binary files /dev/null and b/demo/android/PaddleMobile_Android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/demo/android/PaddleMobile_Android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/demo/android/PaddleMobile_Android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000000000000000000000000000000000000..1b523998081149a985cef0cdf89045b9ed29964a
Binary files /dev/null and b/demo/android/PaddleMobile_Android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/demo/android/PaddleMobile_Android/app/src/main/res/values/colors.xml b/demo/android/PaddleMobile_Android/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3ab3e9cbce07f7cdc941fc8ba424c05e83ed80f0
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/demo/android/PaddleMobile_Android/app/src/main/res/values/strings.xml b/demo/android/PaddleMobile_Android/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f927237046f8a51f9f49ef37440cc05a3abcc0fa
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/src/main/res/values/strings.xml
@@ -0,0 +1,5 @@
+
+ PaddleMobile_Android
+ sdcard not available
+ detection cost:
+
diff --git a/demo/android/PaddleMobile_Android/app/src/main/res/values/styles.xml b/demo/android/PaddleMobile_Android/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5885930df6d10edf3d6df40d6556297d11f953da
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/demo/android/PaddleMobile_Android/build.gradle b/demo/android/PaddleMobile_Android/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..43c070853e6387cb26e12ad00449e2c4df192bf6
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/build.gradle
@@ -0,0 +1,27 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.1.3'
+
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/demo/android/PaddleMobile_Android/gradle.properties b/demo/android/PaddleMobile_Android/gradle.properties
new file mode 100644
index 0000000000000000000000000000000000000000..db1fda5348df0a517e66da43975df8d062ac7109
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+android.injected.testOnly=false
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
diff --git a/demo/android/PaddleMobile_Android/gradle/wrapper/gradle-wrapper.jar b/demo/android/PaddleMobile_Android/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000000000000000000000000000000000..13372aef5e24af05341d49695ee84e5f9b594659
Binary files /dev/null and b/demo/android/PaddleMobile_Android/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/demo/android/PaddleMobile_Android/gradle/wrapper/gradle-wrapper.properties b/demo/android/PaddleMobile_Android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000000000000000000000000000000000..45f9d18b437e41e53ed0620b52bbabc2c65b361b
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Jul 02 13:58:58 CST 2018
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
diff --git a/demo/android/PaddleMobile_Android/gradlew b/demo/android/PaddleMobile_Android/gradlew
new file mode 100755
index 0000000000000000000000000000000000000000..9d82f78915133e1c35a6ea51252590fb38efac2f
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/demo/android/PaddleMobile_Android/gradlew.bat b/demo/android/PaddleMobile_Android/gradlew.bat
new file mode 100644
index 0000000000000000000000000000000000000000..aec99730b4e8fcd90b57a0e8e01544fea7c31a89
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/demo/android/PaddleMobile_Android/settings.gradle b/demo/android/PaddleMobile_Android/settings.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..e7b4def49cb53d9aa04228dd3edb14c9e635e003
--- /dev/null
+++ b/demo/android/PaddleMobile_Android/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/doc/development_doc.md b/doc/development_doc.md
index 95d38ae11ec758b0c235278cbc5949a620b00bd7..90f07a65ffe00bd20a8277dce97286d92875670b 100644
--- a/doc/development_doc.md
+++ b/doc/development_doc.md
@@ -60,6 +60,7 @@ PaddleMobile.h
# Android开发文档
+
用户可通过如下两种方式,交叉编译Android平台上适用的paddle-mobile库:
- 基于Docker容器编译
diff --git a/tools/op.cmake b/tools/op.cmake
index e5b006ee0e890307275dcd472a2e31f51c3fb891..b413cb346261f03b955fa4b32aff371f6a4a32e0 100644
--- a/tools/op.cmake
+++ b/tools/op.cmake
@@ -19,7 +19,8 @@ elseif (NET STREQUAL "mobilenet")
set(BATCHNORM_OP ON)
set(POOL_OP ON)
set(RESHAPE_OP ON)
- set(FUSION_CONVADDBNRELU_OP)
+ set(FUSION_CONVADDBNRELU_OP ON)
+ set(FUSION_CONVADD_OP ON)
elseif (NET STREQUAL "yolo")
set(BATCHNORM_OP ON)
set(CONV_OP ON)