Git Product home page Git Product logo

Comments (19)

Isadorable avatar Isadorable commented on July 17, 2024 2

@clementf2b Thank you anyway :)
@EzequielAdrianM Thank you so much! Your previous post pushed me to focus more carefully on aspects that, in my opinion, were secondary. I've finally managed to find the landmarks. It was exclusively due to the way I was granting the read/write permissions (older API version) and the fact that I was completely ignoring the overlay permissions.

from dlib-android-app.

spife129 avatar spife129 commented on July 17, 2024 1

to gerardsimons, The dat file has to be copied to sdcard so the native code can assess it. Otherwise, native code cannot access res/raw folder like java code does.

from dlib-android-app.

tunda50 avatar tunda50 commented on July 17, 2024 1

It seems like there is issue with arm64-v8a . In CPU architecture arm64-v8a we are getting only face coordinates but ArrayList of landmark points are empty.
Phones which has CPU architecture "armeabi-v7a" can detect face and landmarks.

from dlib-android-app.

amogh112 avatar amogh112 commented on July 17, 2024 1

So what worked for me, alongside the classes and files being the same as this repository (on armeabi-v7a) is:

  1. Set the permission for external drive.
  2. Make sure that when FaceDetect object is initialised, the shape_predictor_face_landmarks.dat is present at the target location. Check this by putting
    String.valueOf(new File(Constants.getFaceShapeModelPath()).exists())
    before the initialisation
    Hope it helps
    Thanks

from dlib-android-app.

koltaar avatar koltaar commented on July 17, 2024

Pretty much the same here.

Basicly I got an image from an OpenCV cameraView or an OpenCV Mat and I can't figure out how to get the landmark from there.
I tried to convert it in Bitmap then use your bitmapFaceDetect but it doesn't find any face (and it's slow).

Could you please help me =) ? I'm not so experienced so don't hesitate to be really precise on how to get the faces and landmarks from an OpenCV Mat ! Thanks !!

from dlib-android-app.

gerardsimons avatar gerardsimons commented on July 17, 2024

Are you using the one that is copied to SD card? I am not sure why but it only seems to work if you use that one. I thought it was unnecessary so I tried loading directly from raw folder myself, but that does not work for some reason (anyone know why?).

Make sure it is copied correctly as in the example.

from dlib-android-app.

shubhwicked avatar shubhwicked commented on July 17, 2024

did you guys find the answer for crash: "Fatal signal 6 (SIGABRT), code -6 in tid 32077 (Thread-12710)".
In my code it crashes with same code on Nexus devices and it is running with other samsung device etc.

from dlib-android-app.

tlehffkffk avatar tlehffkffk commented on July 17, 2024

If you have this problem-cannot get landmark yet, change shape predictor dat file this url.
http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2

  • if use this, decompress bz2 file

I don't know this problem well, I think your dat file is too old to use your build verson.

from dlib-android-app.

clementf2b avatar clementf2b commented on July 17, 2024

@tlehffkffk I got the same problem. I changed to your .dat file but still doesn't work. Is there any other methods to fix this? Thank you.

from dlib-android-app.

clementf2b avatar clementf2b commented on July 17, 2024

It seems like the problem is coming from screen overlay. My friend modify this then he can use the application(my app and demo).

from dlib-android-app.

Isadorable avatar Isadorable commented on July 17, 2024

Hi @clementf2b , please can you explain more precisely how your friend fixed it?

from dlib-android-app.

EzequielAdrianM avatar EzequielAdrianM commented on July 17, 2024

To make it work, you need to ensure a couple of things:

  • Make sure your app has storage permission enabled.
  • You need to use the correct shape_predictor.dat file, otherwise, it will not detect the landmarks. On the first launch, you have to wait for it to be copied to your sdcard root path.
  • Sometimes, it does not detect faces because the detector only looks for faces between specific angles. I mean, you will make it work if you rotate your preview.. It CAN detect mirrored faces.
  • The detector uses OpenCV internally, so if you want to make it work with something more advanced than Bitmaps, like Mat or RAW Camera Byes.. you will need to modify and rebuild the library.
    I have already made it work and explained it HERE

Hope helping :)

from dlib-android-app.

Isadorable avatar Isadorable commented on July 17, 2024

Thank you for you reply @EzequielAdrianM .

In my case, face detection is working perfectly and it's quite precise. This leads me to to exclude your point 3 . I only have problems detecting landmarks. I've enabled both read and write permissions on external storage (but I'm working on camera frames therefore, this shouldn't be that important). Even using your .dat file I still have the same problem.

As for the image format, Bitmap is perfect for my purpose and given the fact that the face detection is working and the same bitmaps, converted to jpg and saved in the internal memory look good, confirms that they were converted properly from NV21. Thank you for your link tho, I bet your code can speed up the conversion process :)

n.b. I can visualise all the landmarks running the original demo.

I feel like I'm missing something stupid but still I can't figure it out.

from dlib-android-app.

clementf2b avatar clementf2b commented on July 17, 2024

@Izzy88 My friend only downloaded the demo Dlib apk and install it on the phone. Then it can detect the landmark result. But I still dun know the major problem. My feel is same as your last sentence

from dlib-android-app.

EzequielAdrianM avatar EzequielAdrianM commented on July 17, 2024

Sometimes stupid simple things can cause a lot of problems. I would like to see your Android Studio project.. Otherwise I can't know what is going wrong.

from dlib-android-app.

kirilamenski avatar kirilamenski commented on July 17, 2024

@Izzy88 Perhaps there is something else besides permitions? I was granting permissions as follow:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<uses-permission android:name="android.permission.CAMERA"/>

<uses-feature android:name="android.hardware.camera"/>

<uses-feature android:name="android.hardware.camera.autofocus"/>

but still getings 0 from getFaceLandmarks();
Can you please explain how did you decide this?

Regards!

from dlib-android-app.

helloworld77 avatar helloworld77 commented on July 17, 2024

Same problem, I use dlib + opencv to detect face, just detect a rectangle but no 68 landmarks.
Thanks to EzequielAdrianM.
I solved this problem by authorizing the READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE. From android 6.0, this permission should not only declare in AndroidManifest, but also dynamic declare in mainactibity:
// add this in AndroidManifest.xml

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

// create this class

import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
public class PermissionUtils {
    private static final int REQUEST_EXTERNAL_STORAGE = 1;
    private static String[] PERMISSIONS_STORAGE = {
            Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.WRITE_EXTERNAL_STORAGE};
    public static void verifyStoragePermissions(Activity activity) {
        int permission = ActivityCompat.checkSelfPermission(activity,
                Manifest.permission.WRITE_EXTERNAL_STORAGE);
        if (permission != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(activity, PERMISSIONS_STORAGE,
                    REQUEST_EXTERNAL_STORAGE);
        }
    }
}

// call verifyStoragePermissions in onCreate() MainActivity:
verifyStoragePermissions(this);

from dlib-android-app.

pjankiewicz avatar pjankiewicz commented on July 17, 2024

I had the same problem. It turned out that I initialized the detector in the frame processor and not in the MainActivity. I solved it by moving the initialization to the MainActivity.

from dlib-android-app.

bilalahmad6354 avatar bilalahmad6354 commented on July 17, 2024

You also need to ask the WRITE_EXTERNAL_STORAGE & READ_EXTERNAL_STORAGE runtime permission. This fixed my issue.

from dlib-android-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.