Skip to content

基于rknn的官方Android项目rknn_yolov5_android_apk_demo进行修改,部署人脸检测模型retinaface和106人脸关键点检测模型,支持实时人脸检测。支持rk356x和rk3588设备npu推理。

License

Notifications You must be signed in to change notification settings

455670288/rknn_face_landmarks_deploy

Repository files navigation

Introduction

  • rknn_yolov5_android_apk_demo is the one showing how to deploy yolov5s model on the android apk on RK3566_RK3568, RK3562 or RK3588
  • 已配置加载opencv库,可直接编译运行

Pre-requisite

Structure

The demo can be split into two parts:

  • JAVA: com.rockchip.gpadc.demo: Reading camera inputs, and invoking jni interface to inferece and show the result

  • JNI: The interface for invoking rknnrt to do the inference of model.

Permission

This demo requires the permission of Camera and Read/Write permission for EXTERNAL_STORAGE

FAQ

Compiling error like“files found with path 'lib/arm64-v8a/xxx.so' from inputs:”

Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
   > 2 files found with path 'lib/arm64-v8a/librga.so' from inputs:
      - rknpu2/examples/rknn_yolov5_android_apk_demo/app/build/intermediates/merged_jni_libs/debug/out/arm64-v8a/librga.so
      - rknpu2/examples/rknn_yolov5_android_apk_demo/app/build/intermediates/cxx/Debug/3f40b265/obj/arm64-v8a/librga.so
     If you are using jniLibs and CMake IMPORTED targets, see
     https://developer.android.com/r/tools/jniLibs-vs-imported-targets

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

Alternatively,

2 files found with path 'lib/arm64-v8a/xxx.so' from inputs:
 - rknn_yolov5_android_apk_demo/app/build/intermediates/merged_jni_libs/debug/out/arm64-v8a/librga.so
 - rknn_yolov5_android_apk_demo/app/build/intermediates/cxx/Debug/3f40b265/obj/arm64-v8a/librga.so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets

This requires add the "jniLibs.srcDirs = ['libs']" on app/build.gradle file “https://developer.android.com/r/tools/jniLibs-vs-imported-targets”

During launch app,errors like "E/SurfaceView: Exception configuring surface"

D/rkyolo: camera facing: 1
V/rkyolo: Camera Supported Preview Size = 160x90
V/rkyolo: Camera Supported Preview Size = 320x180
V/rkyolo: Camera Supported Preview Size = 432x240
V/rkyolo: Camera Supported Preview Size = 640x360
V/rkyolo: Camera Supported Preview Size = 800x448
V/rkyolo: Camera Supported Preview Size = 864x480
V/rkyolo: Camera Supported Preview Size = 1024x576
V/rkyolo: Camera Supported Preview Size = 1280x720
V/rkyolo: Camera Supported Preview Size = 1600x896
V/rkyolo: Camera Supported Preview Size = 1920x1080
E/SurfaceView: Exception configuring surface
    java.lang.RuntimeException: setParameters failed
        at android.hardware.Camera.native_setParameters(Native Method)
        at android.hardware.Camera.setParameters(Camera.java:2068)
        at com.rockchip.gpadc.demo.MainActivity.setCameraParameters(MainActivity.java:295)
        at com.rockchip.gpadc.demo.MainActivity.startCamera(MainActivity.java:245)
        at com.rockchip.gpadc.demo.MainActivity.access$300(MainActivity.java:47)
        at com.rockchip.gpadc.demo.MainActivity$TSurfaceHolderCallback.surfaceCreated(MainActivity.java:199)

This is casued by the unsupported camera resolution , modifying CAMERA_PREVIEW_WIDTH in "app/src/main/java/com/rockchip/gpadc/demo/rga/HALDefine.java" for supported resolution.

Reference

https://github.com/rockchip-linux/rknpu2/tree/master/examples/rknn_yolov5_android_apk_demo

About

基于rknn的官方Android项目rknn_yolov5_android_apk_demo进行修改,部署人脸检测模型retinaface和106人脸关键点检测模型,支持实时人脸检测。支持rk356x和rk3588设备npu推理。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published