dlib-android-app icon indicating copy to clipboard operation
dlib-android-app copied to clipboard

getFaceLandmarks() returns 0 landmarks for detected face

Open RRT955 opened this issue 5 years ago • 3 comments

I imported the library to my build.gradle, face detection is prfectlly done but the getFaceLandmarks() function returns 0 landmarks for each detected face. any idea how to solve this problem?

RRT955 avatar Mar 15 '21 19:03 RRT955

Facing the same issue . Just wanna know have you updated the plugins,dependencies , AndroidX migration ?

basheerkohli avatar Mar 21 '21 18:03 basheerkohli

What I have done is updated the gradle plugin , dependencies , buildtool & targetSDK versions to its max. Finally tested the application on Android 10 O.S. Able to detect the face but not land marks were detected . Fortunately the reason for this is due to the privacy policies on the Android 10 and + i.e,, scopped storages . Yes if you are testing the application on the Android 10 and +

 public static String getFaceShapeModelPath(Context context) {

        File sdcard = context.getExternalFilesDir(null); // this got resolved the issue for me. Hope this will help you
        String targetPath = sdcard.getAbsolutePath() + File.separator + "shape_predictor_68_face_landmarks.dat";
        return targetPath;
    }

DevBash18 avatar Mar 22 '21 09:03 DevBash18

The problem is that "shape_predictor_68_face_landmarks.dat" doesn't exists on the target device, hence the model is not loaded. I still have no idea how to get this file on the target device.

RRT955 avatar May 12 '21 20:05 RRT955