labels = new ArrayList<>();
+ while ((text = bufferedReader.readLine()) != null) {
+ labels.add(text);
+ }
+ return labels;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+}
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/layout/ActionBarLayout.java b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/layout/ActionBarLayout.java
new file mode 100644
index 000000000..099219fa9
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/layout/ActionBarLayout.java
@@ -0,0 +1,33 @@
+package com.baidu.paddle.fastdeploy.app.ui.layout;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.support.annotation.Nullable;
+import android.util.AttributeSet;
+import android.widget.RelativeLayout;
+
+
+public class ActionBarLayout extends RelativeLayout {
+ private int layoutHeight = 150;
+
+ public ActionBarLayout(Context context) {
+ super(context);
+ }
+
+ public ActionBarLayout(Context context, @Nullable AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public ActionBarLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ int width = MeasureSpec.getSize(widthMeasureSpec);
+ setMeasuredDimension(width, layoutHeight);
+ setBackgroundColor(Color.BLACK);
+ setAlpha(0.9f);
+ }
+}
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/AppCompatPreferenceActivity.java b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/AppCompatPreferenceActivity.java
new file mode 100644
index 000000000..c1a952dcf
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/AppCompatPreferenceActivity.java
@@ -0,0 +1,111 @@
+package com.baidu.paddle.fastdeploy.app.ui.view;
+
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.support.annotation.LayoutRes;
+import android.support.annotation.Nullable;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatDelegate;
+import android.support.v7.widget.Toolbar;
+import android.view.MenuInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * A {@link PreferenceActivity} which implements and proxies the necessary calls
+ * to be used with AppCompat.
+ *
+ * This technique can be used with an {@link android.app.Activity} class, not just
+ * {@link PreferenceActivity}.
+ */
+public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
+ private AppCompatDelegate mDelegate;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ getDelegate().installViewFactory();
+ getDelegate().onCreate(savedInstanceState);
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+ getDelegate().onPostCreate(savedInstanceState);
+ }
+
+ public ActionBar getSupportActionBar() {
+ return getDelegate().getSupportActionBar();
+ }
+
+ public void setSupportActionBar(@Nullable Toolbar toolbar) {
+ getDelegate().setSupportActionBar(toolbar);
+ }
+
+ @Override
+ public MenuInflater getMenuInflater() {
+ return getDelegate().getMenuInflater();
+ }
+
+ @Override
+ public void setContentView(@LayoutRes int layoutResID) {
+ getDelegate().setContentView(layoutResID);
+ }
+
+ @Override
+ public void setContentView(View view) {
+ getDelegate().setContentView(view);
+ }
+
+ @Override
+ public void setContentView(View view, ViewGroup.LayoutParams params) {
+ getDelegate().setContentView(view, params);
+ }
+
+ @Override
+ public void addContentView(View view, ViewGroup.LayoutParams params) {
+ getDelegate().addContentView(view, params);
+ }
+
+ @Override
+ protected void onPostResume() {
+ super.onPostResume();
+ getDelegate().onPostResume();
+ }
+
+ @Override
+ protected void onTitleChanged(CharSequence title, int color) {
+ super.onTitleChanged(title, color);
+ getDelegate().setTitle(title);
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ getDelegate().onConfigurationChanged(newConfig);
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ getDelegate().onStop();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ getDelegate().onDestroy();
+ }
+
+ public void invalidateOptionsMenu() {
+ getDelegate().invalidateOptionsMenu();
+ }
+
+ private AppCompatDelegate getDelegate() {
+ if (mDelegate == null) {
+ mDelegate = AppCompatDelegate.create(this, null);
+ }
+ return mDelegate;
+ }
+}
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java
new file mode 100644
index 000000000..94a5fdbd0
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java
@@ -0,0 +1,349 @@
+package com.baidu.paddle.fastdeploy.app.ui.view;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.SurfaceTexture;
+import android.hardware.Camera;
+import android.hardware.Camera.CameraInfo;
+import android.hardware.Camera.Size;
+import android.opengl.GLES11Ext;
+import android.opengl.GLES20;
+import android.opengl.GLSurfaceView;
+import android.opengl.GLSurfaceView.Renderer;
+import android.opengl.GLUtils;
+import android.opengl.Matrix;
+import android.util.AttributeSet;
+import android.util.Log;
+
+import com.baidu.paddle.fastdeploy.app.ui.Utils;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.FloatBuffer;
+import java.util.List;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+public class CameraSurfaceView extends GLSurfaceView implements Renderer,
+ SurfaceTexture.OnFrameAvailableListener {
+ private static final String TAG = CameraSurfaceView.class.getSimpleName();
+
+ public static int EXPECTED_PREVIEW_WIDTH = 1280; // 1920
+ public static int EXPECTED_PREVIEW_HEIGHT = 720; // 960
+
+ protected int numberOfCameras;
+ protected int selectedCameraId;
+ protected boolean disableCamera = false;
+ protected Camera camera;
+
+ protected Context context;
+ protected SurfaceTexture surfaceTexture;
+ protected int surfaceWidth = 0;
+ protected int surfaceHeight = 0;
+ protected int textureWidth = 0;
+ protected int textureHeight = 0;
+
+ protected Bitmap ARGB8888ImageBitmap;
+ protected boolean bitmapReleaseMode = true;
+
+ // In order to manipulate the camera preview data and render the modified one
+ // to the screen, three textures are created and the data flow is shown as following:
+ // previewdata->camTextureId->fboTexureId->drawTexureId->framebuffer
+ protected int[] fbo = {0};
+ protected int[] camTextureId = {0};
+ protected int[] fboTexureId = {0};
+ protected int[] drawTexureId = {0};
+
+ private final String vss = ""
+ + "attribute vec2 vPosition;\n"
+ + "attribute vec2 vTexCoord;\n" + "varying vec2 texCoord;\n"
+ + "void main() {\n" + " texCoord = vTexCoord;\n"
+ + " gl_Position = vec4 (vPosition.x, vPosition.y, 0.0, 1.0);\n"
+ + "}";
+
+ private final String fssCam2FBO = ""
+ + "#extension GL_OES_EGL_image_external : require\n"
+ + "precision mediump float;\n"
+ + "uniform samplerExternalOES sTexture;\n"
+ + "varying vec2 texCoord;\n"
+ + "void main() {\n"
+ + " gl_FragColor = texture2D(sTexture,texCoord);\n" + "}";
+
+ private final String fssTex2Screen = ""
+ + "precision mediump float;\n"
+ + "uniform sampler2D sTexture;\n"
+ + "varying vec2 texCoord;\n"
+ + "void main() {\n"
+ + " gl_FragColor = texture2D(sTexture,texCoord);\n" + "}";
+
+ private final float[] vertexCoords = {
+ -1, -1,
+ -1, 1,
+ 1, -1,
+ 1, 1};
+ private float[] textureCoords = {
+ 0, 1,
+ 0, 0,
+ 1, 1,
+ 1, 0};
+
+ private FloatBuffer vertexCoordsBuffer;
+ private FloatBuffer textureCoordsBuffer;
+
+ private int progCam2FBO = -1;
+ private int progTex2Screen = -1;
+ private int vcCam2FBO;
+ private int tcCam2FBO;
+ private int vcTex2Screen;
+ private int tcTex2Screen;
+
+ public void setBitmapReleaseMode(boolean mode) {
+ synchronized (this) {
+ bitmapReleaseMode = mode;
+ }
+ }
+
+ public Bitmap getBitmap() {
+ return ARGB8888ImageBitmap; // may null or recycled.
+ }
+
+ public interface OnTextureChangedListener {
+ boolean onTextureChanged(Bitmap ARGB8888ImageBitmap);
+ }
+
+ private OnTextureChangedListener onTextureChangedListener = null;
+
+ public void setOnTextureChangedListener(OnTextureChangedListener listener) {
+ onTextureChangedListener = listener;
+ }
+
+ public CameraSurfaceView(Context ctx, AttributeSet attrs) {
+ super(ctx, attrs);
+ context = ctx;
+ setEGLContextClientVersion(2);
+ setRenderer(this);
+ setRenderMode(RENDERMODE_WHEN_DIRTY);
+
+ // Find the total number of available cameras and the ID of the default camera
+ numberOfCameras = Camera.getNumberOfCameras();
+ CameraInfo cameraInfo = new CameraInfo();
+ for (int i = 0; i < numberOfCameras; i++) {
+ Camera.getCameraInfo(i, cameraInfo);
+ if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
+ selectedCameraId = i;
+ }
+ }
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ // Create OES texture for storing camera preview data(YUV format)
+ GLES20.glGenTextures(1, camTextureId, 0);
+ GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, camTextureId[0]);
+ GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
+ GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
+ surfaceTexture = new SurfaceTexture(camTextureId[0]);
+ surfaceTexture.setOnFrameAvailableListener(this);
+
+ // Prepare vertex and texture coordinates
+ int bytes = vertexCoords.length * Float.SIZE / Byte.SIZE;
+ vertexCoordsBuffer = ByteBuffer.allocateDirect(bytes).order(ByteOrder.nativeOrder()).asFloatBuffer();
+ textureCoordsBuffer = ByteBuffer.allocateDirect(bytes).order(ByteOrder.nativeOrder()).asFloatBuffer();
+ vertexCoordsBuffer.put(vertexCoords).position(0);
+ textureCoordsBuffer.put(textureCoords).position(0);
+
+ // Create vertex and fragment shaders
+ // camTextureId->fboTexureId
+ progCam2FBO = Utils.createShaderProgram(vss, fssCam2FBO);
+ vcCam2FBO = GLES20.glGetAttribLocation(progCam2FBO, "vPosition");
+ tcCam2FBO = GLES20.glGetAttribLocation(progCam2FBO, "vTexCoord");
+ GLES20.glEnableVertexAttribArray(vcCam2FBO);
+ GLES20.glEnableVertexAttribArray(tcCam2FBO);
+ // fboTexureId/drawTexureId -> screen
+ progTex2Screen = Utils.createShaderProgram(vss, fssTex2Screen);
+ vcTex2Screen = GLES20.glGetAttribLocation(progTex2Screen, "vPosition");
+ tcTex2Screen = GLES20.glGetAttribLocation(progTex2Screen, "vTexCoord");
+ GLES20.glEnableVertexAttribArray(vcTex2Screen);
+ GLES20.glEnableVertexAttribArray(tcTex2Screen);
+ }
+
+ @Override
+ public void onSurfaceChanged(GL10 gl, int width, int height) {
+ surfaceWidth = width;
+ surfaceHeight = height;
+ openCamera();
+ }
+
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ if (surfaceTexture == null) return;
+
+ GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
+ surfaceTexture.updateTexImage();
+ float[] matrix = new float[16];
+ surfaceTexture.getTransformMatrix(matrix);
+
+ // camTextureId->fboTexureId
+ GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo[0]);
+ GLES20.glViewport(0, 0, textureWidth, textureHeight);
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
+ GLES20.glUseProgram(progCam2FBO);
+ GLES20.glVertexAttribPointer(vcCam2FBO, 2, GLES20.GL_FLOAT, false, 4 * 2, vertexCoordsBuffer);
+ textureCoordsBuffer.clear();
+ textureCoordsBuffer.put(transformTextureCoordinates(textureCoords, matrix));
+ textureCoordsBuffer.position(0);
+ GLES20.glVertexAttribPointer(tcCam2FBO, 2, GLES20.GL_FLOAT, false, 4 * 2, textureCoordsBuffer);
+ GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
+ GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, camTextureId[0]);
+ GLES20.glUniform1i(GLES20.glGetUniformLocation(progCam2FBO, "sTexture"), 0);
+ GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
+ GLES20.glFlush();
+
+ // Check if the draw texture is set
+ int targetTexureId = fboTexureId[0];
+ if (onTextureChangedListener != null) {
+ // Read pixels of FBO to a bitmap
+ ByteBuffer pixelBuffer = ByteBuffer.allocate(textureWidth * textureHeight * 4);
+ GLES20.glReadPixels(0, 0, textureWidth, textureHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, pixelBuffer);
+
+ ARGB8888ImageBitmap = Bitmap.createBitmap(textureWidth, textureHeight, Bitmap.Config.ARGB_8888);
+ ARGB8888ImageBitmap.copyPixelsFromBuffer(pixelBuffer);
+
+ boolean modified = onTextureChangedListener.onTextureChanged(ARGB8888ImageBitmap);
+
+ if (modified) {
+ targetTexureId = drawTexureId[0];
+ // Update a bitmap to the GL texture if modified
+ GLES20.glActiveTexture(targetTexureId);
+ // GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, targetTexureId);
+ GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, targetTexureId);
+ GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, ARGB8888ImageBitmap, 0);
+ }
+ if (bitmapReleaseMode) {
+ ARGB8888ImageBitmap.recycle();
+ }
+ }
+
+ // fboTexureId/drawTexureId->Screen
+ GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
+ GLES20.glViewport(0, 0, surfaceWidth, surfaceHeight);
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
+ GLES20.glUseProgram(progTex2Screen);
+ GLES20.glVertexAttribPointer(vcTex2Screen, 2, GLES20.GL_FLOAT, false, 4 * 2, vertexCoordsBuffer);
+ textureCoordsBuffer.clear();
+ textureCoordsBuffer.put(textureCoords);
+ textureCoordsBuffer.position(0);
+ GLES20.glVertexAttribPointer(tcTex2Screen, 2, GLES20.GL_FLOAT, false, 4 * 2, textureCoordsBuffer);
+ GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, targetTexureId);
+ GLES20.glUniform1i(GLES20.glGetUniformLocation(progTex2Screen, "sTexture"), 0);
+ GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
+ GLES20.glFlush();
+ }
+
+ private float[] transformTextureCoordinates(float[] coords, float[] matrix) {
+ float[] result = new float[coords.length];
+ float[] vt = new float[4];
+ for (int i = 0; i < coords.length; i += 2) {
+ float[] v = {coords[i], coords[i + 1], 0, 1};
+ Matrix.multiplyMV(vt, 0, matrix, 0, v, 0);
+ result[i] = vt[0];
+ result[i + 1] = vt[1];
+ }
+ return result;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ releaseCamera();
+ }
+
+ @Override
+ public void onFrameAvailable(SurfaceTexture surfaceTexture) {
+ requestRender();
+ }
+
+ public void disableCamera() {
+ disableCamera = true;
+ }
+
+ public void switchCamera() {
+ releaseCamera();
+ selectedCameraId = (selectedCameraId + 1) % numberOfCameras;
+ openCamera();
+ }
+
+ public void openCamera() {
+ if (disableCamera) return;
+ camera = Camera.open(selectedCameraId);
+ List supportedPreviewSizes = camera.getParameters().getSupportedPreviewSizes();
+ Size previewSize = Utils.getOptimalPreviewSize(supportedPreviewSizes, EXPECTED_PREVIEW_WIDTH,
+ EXPECTED_PREVIEW_HEIGHT);
+ Camera.Parameters parameters = camera.getParameters();
+ parameters.setPreviewSize(previewSize.width, previewSize.height);
+ if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
+ parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
+ }
+ camera.setParameters(parameters);
+ int degree = Utils.getCameraDisplayOrientation(context, selectedCameraId);
+ camera.setDisplayOrientation(degree);
+ boolean rotate = degree == 90 || degree == 270;
+ textureWidth = rotate ? previewSize.height : previewSize.width;
+ textureHeight = rotate ? previewSize.width : previewSize.height;
+
+ // Destroy FBO and draw textures
+ GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
+ GLES20.glDeleteFramebuffers(1, fbo, 0);
+ GLES20.glDeleteTextures(1, drawTexureId, 0);
+ GLES20.glDeleteTextures(1, fboTexureId, 0);
+ // Normal texture for storing modified camera preview data(RGBA format)
+ GLES20.glGenTextures(1, drawTexureId, 0);
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, drawTexureId[0]);
+ GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, textureWidth, textureHeight, 0,
+ GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
+ // FBO texture for storing camera preview data(RGBA format)
+ GLES20.glGenTextures(1, fboTexureId, 0);
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, fboTexureId[0]);
+ GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, textureWidth, textureHeight, 0,
+ GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
+ // Generate FBO and bind to FBO texture
+ GLES20.glGenFramebuffers(1, fbo, 0);
+ GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo[0]);
+ GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D,
+ fboTexureId[0], 0);
+ try {
+ camera.setPreviewTexture(surfaceTexture);
+ } catch (IOException exception) {
+ Log.e(TAG, "IOException caused by setPreviewDisplay()", exception);
+ }
+ camera.startPreview();
+ }
+
+ public void releaseCamera() {
+ if (camera != null) {
+ camera.setPreviewCallback(null);
+ camera.stopPreview();
+ camera.release();
+ camera = null;
+ }
+ }
+}
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/ResultListView.java b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/ResultListView.java
new file mode 100644
index 000000000..62b48a054
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/ResultListView.java
@@ -0,0 +1,43 @@
+package com.baidu.paddle.fastdeploy.app.ui.view;
+
+import android.content.Context;
+import android.os.Handler;
+import android.util.AttributeSet;
+import android.widget.ListView;
+
+public class ResultListView extends ListView {
+ public ResultListView(Context context) {
+ super(context);
+ }
+
+ public ResultListView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public ResultListView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ private Handler handler;
+
+ public void setHandler(Handler mHandler) {
+ handler = mHandler;
+ }
+
+ public void clear() {
+ handler.post(new Runnable() {
+ @Override
+ public void run() {
+ removeAllViewsInLayout();
+ invalidate();
+ }
+ });
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
+ MeasureSpec.AT_MOST);
+ super.onMeasure(widthMeasureSpec, expandSpec);
+ }
+}
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/adapter/BaseResultAdapter.java b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/adapter/BaseResultAdapter.java
new file mode 100644
index 000000000..62747965a
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/adapter/BaseResultAdapter.java
@@ -0,0 +1,48 @@
+package com.baidu.paddle.fastdeploy.app.ui.view.adapter;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+
+import com.baidu.paddle.fastdeploy.app.examples.R;
+import com.baidu.paddle.fastdeploy.app.ui.view.model.BaseResultModel;
+
+import java.text.DecimalFormat;
+import java.util.List;
+
+public class BaseResultAdapter extends ArrayAdapter {
+ private int resourceId;
+
+ public BaseResultAdapter(@NonNull Context context, int resource) {
+ super(context, resource);
+ }
+
+ public BaseResultAdapter(@NonNull Context context, int resource, @NonNull List objects) {
+ super(context, resource, objects);
+ resourceId = resource;
+ }
+
+ @NonNull
+ @Override
+ public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
+ BaseResultModel model = getItem(position);
+ View view = LayoutInflater.from(getContext()).inflate(resourceId, null);
+ TextView indexText = (TextView) view.findViewById(R.id.index);
+ TextView nameText = (TextView) view.findViewById(R.id.name);
+ TextView confidenceText = (TextView) view.findViewById(R.id.confidence);
+ indexText.setText(String.valueOf(model.getIndex()));
+ nameText.setText(String.valueOf(model.getName()));
+ confidenceText.setText(formatFloatString(model.getConfidence()));
+ return view;
+ }
+
+ public static String formatFloatString(float number) {
+ DecimalFormat df = new DecimalFormat("0.00");
+ return df.format(number);
+ }
+}
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/model/BaseResultModel.java b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/model/BaseResultModel.java
new file mode 100644
index 000000000..cae71b690
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/model/BaseResultModel.java
@@ -0,0 +1,41 @@
+package com.baidu.paddle.fastdeploy.app.ui.view.model;
+
+public class BaseResultModel {
+ private int index;
+ private String name;
+ private float confidence;
+
+ public BaseResultModel() {
+
+ }
+
+ public BaseResultModel(int index, String name, float confidence) {
+ this.index = index;
+ this.name = name;
+ this.confidence = confidence;
+ }
+
+ public float getConfidence() {
+ return confidence;
+ }
+
+ public void setConfidence(float confidence) {
+ this.confidence = confidence;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/action_button_layer.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/action_button_layer.xml
new file mode 100644
index 000000000..a0d2e76bf
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/action_button_layer.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/album_btn.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/album_btn.xml
new file mode 100644
index 000000000..26d01c584
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/album_btn.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 000000000..1f6bb2906
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/realtime_start_btn.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/realtime_start_btn.xml
new file mode 100644
index 000000000..664134453
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/realtime_start_btn.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/realtime_stop_btn.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/realtime_stop_btn.xml
new file mode 100644
index 000000000..8869a1b2b
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/realtime_stop_btn.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/result_page_border_section_bk.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/result_page_border_section_bk.xml
new file mode 100644
index 000000000..bd068f169
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/result_page_border_section_bk.xml
@@ -0,0 +1,12 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/round_corner_btn.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/round_corner_btn.xml
new file mode 100644
index 000000000..c5dcc45d5
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/round_corner_btn.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_progress_realtime.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_progress_realtime.xml
new file mode 100644
index 000000000..b349d15a6
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_progress_realtime.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ -
+
+
+
+ -
+
+
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_progress_result.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_progress_result.xml
new file mode 100644
index 000000000..17cb68ed8
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_progress_result.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_thumb.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_thumb.xml
new file mode 100644
index 000000000..96bd95e0a
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_thumb.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_thumb_shape.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_thumb_shape.xml
new file mode 100644
index 000000000..26d033b6d
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/seekbar_thumb_shape.xml
@@ -0,0 +1,26 @@
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/switch_side_btn.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/switch_side_btn.xml
new file mode 100644
index 000000000..b9b2edfb6
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/switch_side_btn.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/take_picture_btn.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/take_picture_btn.xml
new file mode 100644
index 000000000..4966675c3
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-v24/take_picture_btn.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/album.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/album.png
new file mode 100644
index 000000000..3a6fdedae
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/album.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/album_pressed.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/album_pressed.png
new file mode 100644
index 000000000..aa873424e
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/album_pressed.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/back_btn.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/back_btn.png
new file mode 100644
index 000000000..ff121e85f
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/back_btn.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/more_menu.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/more_menu.png
new file mode 100644
index 000000000..edf9f3ccc
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/more_menu.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_start.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_start.png
new file mode 100644
index 000000000..94ab08172
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_start.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_start_pressed.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_start_pressed.png
new file mode 100644
index 000000000..feef0fea6
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_start_pressed.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_stop.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_stop.png
new file mode 100644
index 000000000..8c926367d
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_stop.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_stop_pressed.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_stop_pressed.png
new file mode 100644
index 000000000..309082788
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/realtime_stop_pressed.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/scan_icon.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/scan_icon.png
new file mode 100644
index 000000000..7517d99d0
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/scan_icon.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/seekbar_handle.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/seekbar_handle.png
new file mode 100644
index 000000000..55f5f7399
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/seekbar_handle.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/seekbar_progress_dotted.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/seekbar_progress_dotted.png
new file mode 100644
index 000000000..e6241d12e
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/seekbar_progress_dotted.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/seekbar_thumb_invisible.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/seekbar_thumb_invisible.png
new file mode 100644
index 000000000..acfe8d374
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/seekbar_thumb_invisible.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/switch_side.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/switch_side.png
new file mode 100644
index 000000000..3e6ae9a94
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/switch_side.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/switch_side_pressed.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/switch_side_pressed.png
new file mode 100644
index 000000000..25e152276
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/switch_side_pressed.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/take_picture.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/take_picture.png
new file mode 100644
index 000000000..d6ced986e
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/take_picture.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/take_picture_pressed.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/take_picture_pressed.png
new file mode 100644
index 000000000..5f9c8ee3b
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xhdpi/take_picture_pressed.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xxhdpi-v4/btn_switch_default.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xxhdpi-v4/btn_switch_default.png
new file mode 100644
index 000000000..b9e66c7f6
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xxhdpi-v4/btn_switch_default.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xxhdpi-v4/btn_switch_pressed.png b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xxhdpi-v4/btn_switch_pressed.png
new file mode 100644
index 000000000..9544133bd
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable-xxhdpi-v4/btn_switch_pressed.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_settings.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_settings.xml
new file mode 100644
index 000000000..917897b99
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_settings_default.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_settings_default.xml
new file mode 100644
index 000000000..e19589a97
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_settings_default.xml
@@ -0,0 +1,13 @@
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_settings_pressed.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_settings_pressed.xml
new file mode 100644
index 000000000..c4af2a042
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_settings_pressed.xml
@@ -0,0 +1,13 @@
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_shutter.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_shutter.xml
new file mode 100644
index 000000000..4f9826d3a
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_shutter.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_shutter_default.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_shutter_default.xml
new file mode 100644
index 000000000..234ca014a
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_shutter_default.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_shutter_pressed.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_shutter_pressed.xml
new file mode 100644
index 000000000..accc7aced
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_shutter_pressed.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_switch.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_switch.xml
new file mode 100644
index 000000000..691e8c2e9
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/btn_switch.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/ic_launcher_background.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 000000000..0d025f9bf
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_activity_main.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_activity_main.xml
new file mode 100644
index 000000000..51b548df4
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_activity_main.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_camera_page.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_camera_page.xml
new file mode 100644
index 000000000..f6b43ad0b
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_camera_page.xml
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_result_page.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_result_page.xml
new file mode 100644
index 000000000..958a85940
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_result_page.xml
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_result_page_item.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_result_page_item.xml
new file mode 100644
index 000000000..6a2b09ebf
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/layout/facedet_result_page_item.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 000000000..898f3ed59
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 000000000..dffca3601
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 000000000..64ba76f75
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 000000000..dae5e0823
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..e5ed46597
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 000000000..14ed0af35
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..b0907cac3
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 000000000..d8ae03154
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 000000000..2c18de9e6
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 000000000..beed3cdd2
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/values/arrays.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/values/arrays.xml
new file mode 100644
index 000000000..c7cf12378
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/values/arrays.xml
@@ -0,0 +1,39 @@
+
+
+
+ - 1 threads
+ - 2 threads
+ - 4 threads
+ - 8 threads
+
+
+ - 1
+ - 2
+ - 4
+ - 8
+
+
+ - HIGH(only big cores)
+ - LOW(only LITTLE cores)
+ - FULL(all cores)
+ - NO_BIND(depends on system)
+ - RAND_HIGH
+ - RAND_LOW
+
+
+ - LITE_POWER_HIGH
+ - LITE_POWER_LOW
+ - LITE_POWER_FULL
+ - LITE_POWER_NO_BIND
+ - LITE_POWER_RAND_HIGH
+ - LITE_POWER_RAND_LOW
+
+
+ - true
+ - false
+
+
+ - true
+ - false
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/values/colors.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/values/colors.xml
new file mode 100644
index 000000000..f8ec1f0c3
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/values/colors.xml
@@ -0,0 +1,22 @@
+
+
+ #008577
+ #00574B
+ #D81B60
+ #FF000000
+ #00000000
+ #00000000
+ #FFFFFFFF
+
+ #000000
+ #3B85F5
+ #F5A623
+ #FFFFFF
+
+ #EEEEEE
+
+ #3B85F5
+ #333333
+ #E5E5E5
+ #3b85f5
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/values/dimens.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/values/dimens.xml
new file mode 100644
index 000000000..2df89499d
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/values/dimens.xml
@@ -0,0 +1,17 @@
+
+
+ 26dp
+ 36dp
+ 34dp
+ 60dp
+ 16dp
+ 67dp
+ 67dp
+ 56dp
+ 56dp
+ 46dp
+ 46dp
+ 32dp
+ 24dp
+ 16dp
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/values/strings.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/values/strings.xml
new file mode 100644
index 000000000..267871056
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/values/strings.xml
@@ -0,0 +1,51 @@
+
+
+ EasyEdge
+
+ EasyEdge
+ EasyEdge
+ EasyEdge
+ EasyEdge
+ EasyEdge
+
+ CHOOSE_INSTALLED_MODEL_KEY
+ MODEL_DIR_KEY
+ LABEL_PATH_KEY
+ CPU_THREAD_NUM_KEY
+ CPU_POWER_MODE_KEY
+ SCORE_THRESHOLD_KEY
+ ENABLE_LITE_FP16_MODE_KEY
+
+ 2
+ LITE_POWER_HIGH
+ 0.4
+ 0.1
+ 0.25
+ true
+
+
+ models/picodet_s_320_coco_lcnet
+ labels/coco_label_list.txt
+
+ models
+ labels/ppocr_keys_v1.txt
+
+ models/MobileNetV1_x0_25_infer
+ labels/imagenet1k_label_list.txt
+
+ models/scrfd_500m_bnkps_shape320x320_pd
+
+ models/portrait_pp_humansegv2_lite_256x144_inference_model
+
+ 拍照识别
+ 实时识别
+ <
+ 模型名称
+ 识别结果
+ 序号
+ 名称
+ 置信度
+ 阈值控制
+ 重新识别
+ 保存结果
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/values/styles.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/values/styles.xml
new file mode 100644
index 000000000..67c147594
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/values/values.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/values/values.xml
new file mode 100644
index 000000000..156146d9a
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/values/values.xml
@@ -0,0 +1,17 @@
+
+
+ 120dp
+ 46px
+
+ 126px
+ 136px
+
+ 46px
+
+ 36px
+
+ 15dp
+
+ 15dp
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/app/src/main/res/xml/facedet_setting.xml b/examples/vision/facedet/scrfd/android/app/src/main/res/xml/facedet_setting.xml
new file mode 100644
index 000000000..cab7f937a
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/app/src/main/res/xml/facedet_setting.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vision/facedet/scrfd/android/build.gradle b/examples/vision/facedet/scrfd/android/build.gradle
new file mode 100644
index 000000000..d8d678b3f
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/build.gradle
@@ -0,0 +1,37 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+//plugins {
+// id 'com.android.application' version '7.2.2' apply false
+// id 'com.android.library' version '7.2.2' apply false
+//}
+//
+//task clean(type: Delete) {
+// delete rootProject.buildDir
+//}
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ // mavenCentral()
+
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:7.2.2'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ // mavenCentral()
+
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/examples/vision/facedet/scrfd/android/gradle.properties b/examples/vision/facedet/scrfd/android/gradle.properties
new file mode 100644
index 000000000..ae995d47c
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/gradle.properties
@@ -0,0 +1,13 @@
+# 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=-Xmx3096m
+# 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/examples/vision/facedet/scrfd/android/gradle/wrapper/gradle-wrapper.jar b/examples/vision/facedet/scrfd/android/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 000000000..e708b1c02
Binary files /dev/null and b/examples/vision/facedet/scrfd/android/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/examples/vision/facedet/scrfd/android/gradle/wrapper/gradle-wrapper.properties b/examples/vision/facedet/scrfd/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..7855fafe4
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Sat Oct 08 17:24:34 CST 2022
+distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
+distributionPath=wrapper/dists
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
diff --git a/examples/vision/facedet/scrfd/android/gradlew b/examples/vision/facedet/scrfd/android/gradlew
new file mode 100644
index 000000000..4f906e0c8
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# 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
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# 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
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# 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
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+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" -a "$nonstop" = "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 or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/examples/vision/facedet/scrfd/android/gradlew.bat b/examples/vision/facedet/scrfd/android/gradlew.bat
new file mode 100644
index 000000000..ac1b06f93
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@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
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@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="-Xmx64m" "-Xms64m"
+
+@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 execute
+
+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 execute
+
+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
+
+: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 %*
+
+: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/examples/vision/facedet/scrfd/android/local.properties b/examples/vision/facedet/scrfd/android/local.properties
new file mode 100644
index 000000000..fbfca12ef
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/local.properties
@@ -0,0 +1,8 @@
+## This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+#Thu Oct 20 16:50:08 CST 2022
+sdk.dir=/Users/qiuyanjun/Library/Android/sdk
diff --git a/examples/vision/facedet/scrfd/android/settings.gradle b/examples/vision/facedet/scrfd/android/settings.gradle
new file mode 100644
index 000000000..e7b4def49
--- /dev/null
+++ b/examples/vision/facedet/scrfd/android/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/examples/vision/segmentation/paddleseg/android/README.md b/examples/vision/segmentation/paddleseg/android/README.md
index a30ac9795..9b3fe5062 100644
--- a/examples/vision/segmentation/paddleseg/android/README.md
+++ b/examples/vision/segmentation/paddleseg/android/README.md
@@ -1,6 +1,6 @@
# 目标检测 PaddleSeg Android Demo 使用文档
-在 Android 上实现实时的目标检测功能,此 Demo 有很好的的易用性和开放性,如在 Demo 中跑自己训练好的模型等。
+在 Android 上实现实时的人像分割功能,此 Demo 有很好的的易用性和开放性,如在 Demo 中跑自己训练好的模型等。
## 环境准备
@@ -23,9 +23,10 @@
4. 点击 Run 按钮,自动编译 APP 并安装到手机。(该过程会自动下载预编译的 FastDeploy Android 库 以及 模型文件,需要联网)
成功后效果如下,图一:APP 安装到手机;图二: APP 打开后的效果,会自动识别图片中的人物并绘制mask;图三:APP设置选项,点击右上角的设置图片,可以设置不同选项进行体验。
- | APP 图标 | APP 效果 | APP设置项
+| APP 图标 | APP 效果 | APP设置项
| --- | --- | --- |
- |  |
|  |
+ |
|
|
|
+
## PaddleSegModel Java API 说明
- 模型初始化 API: 模型初始化API包含两种方式,方式一是通过构造函数直接初始化;方式二是,通过调用init函数,在合适的程序节点进行初始化。PaddleSegModel初始化参数说明如下:
diff --git a/examples/vision/segmentation/paddleseg/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java b/examples/vision/segmentation/paddleseg/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java
index 11d9fcdcb..94a5fdbd0 100644
--- a/examples/vision/segmentation/paddleseg/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java
+++ b/examples/vision/segmentation/paddleseg/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java
@@ -287,27 +287,20 @@ public class CameraSurfaceView extends GLSurfaceView implements Renderer,
public void openCamera() {
if (disableCamera) return;
camera = Camera.open(selectedCameraId);
- Camera.Parameters parameters = camera.getParameters();
- int degree = Utils.getCameraDisplayOrientation(context, selectedCameraId);
- camera.setDisplayOrientation(degree);
- boolean rotate = degree == 90 || degree == 270;
- int adjusted_width = rotate ? EXPECTED_PREVIEW_HEIGHT : EXPECTED_PREVIEW_WIDTH;
- int adjusted_height = rotate ? EXPECTED_PREVIEW_WIDTH : EXPECTED_PREVIEW_HEIGHT;
-
List supportedPreviewSizes = camera.getParameters().getSupportedPreviewSizes();
-
- Size previewSize = Utils.getOptimalPreviewSize(
- supportedPreviewSizes, adjusted_width, adjusted_height);
-
- textureWidth = previewSize.width;
- textureHeight = previewSize.height;
-
+ Size previewSize = Utils.getOptimalPreviewSize(supportedPreviewSizes, EXPECTED_PREVIEW_WIDTH,
+ EXPECTED_PREVIEW_HEIGHT);
+ Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewSize(previewSize.width, previewSize.height);
- camera.setParameters(parameters);
-
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
}
+ camera.setParameters(parameters);
+ int degree = Utils.getCameraDisplayOrientation(context, selectedCameraId);
+ camera.setDisplayOrientation(degree);
+ boolean rotate = degree == 90 || degree == 270;
+ textureWidth = rotate ? previewSize.height : previewSize.width;
+ textureHeight = rotate ? previewSize.width : previewSize.height;
// Destroy FBO and draw textures
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
diff --git a/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java b/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java
index 11d9fcdcb..94a5fdbd0 100644
--- a/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java
+++ b/java/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java
@@ -287,27 +287,20 @@ public class CameraSurfaceView extends GLSurfaceView implements Renderer,
public void openCamera() {
if (disableCamera) return;
camera = Camera.open(selectedCameraId);
- Camera.Parameters parameters = camera.getParameters();
- int degree = Utils.getCameraDisplayOrientation(context, selectedCameraId);
- camera.setDisplayOrientation(degree);
- boolean rotate = degree == 90 || degree == 270;
- int adjusted_width = rotate ? EXPECTED_PREVIEW_HEIGHT : EXPECTED_PREVIEW_WIDTH;
- int adjusted_height = rotate ? EXPECTED_PREVIEW_WIDTH : EXPECTED_PREVIEW_HEIGHT;
-
List supportedPreviewSizes = camera.getParameters().getSupportedPreviewSizes();
-
- Size previewSize = Utils.getOptimalPreviewSize(
- supportedPreviewSizes, adjusted_width, adjusted_height);
-
- textureWidth = previewSize.width;
- textureHeight = previewSize.height;
-
+ Size previewSize = Utils.getOptimalPreviewSize(supportedPreviewSizes, EXPECTED_PREVIEW_WIDTH,
+ EXPECTED_PREVIEW_HEIGHT);
+ Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewSize(previewSize.width, previewSize.height);
- camera.setParameters(parameters);
-
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
}
+ camera.setParameters(parameters);
+ int degree = Utils.getCameraDisplayOrientation(context, selectedCameraId);
+ camera.setDisplayOrientation(degree);
+ boolean rotate = degree == 90 || degree == 270;
+ textureWidth = rotate ? previewSize.height : previewSize.width;
+ textureHeight = rotate ? previewSize.width : previewSize.height;
// Destroy FBO and draw textures
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);