tzutalin / dlib-android-app

:dragon: Android app to demo dlib-android(https://github.com/tzutalin/dlib-android). Use the prebuilt shared-lib built from dlib-android
Apache License 2.0
683 stars 246 forks source link

getFaceLandmarks() returns 0 landmarks for detected face #68

Open RRT955 opened 3 years ago

RRT955 commented 3 years ago

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?

basheerkohli commented 3 years ago

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

DevBash18 commented 3 years ago

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;
    }
RRT955 commented 3 years ago

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.