Search code examples
javaandroidperformanceface-api

Slow processing of all images by google face API?


I am making an android app which is using the Google face API to detect faces of all the images in the gallery. It is taking a long time to process all the images and hence the apps get stuck for a long time. Any workaround? I tried reducing the size of the image and then process, but it gives a faulty answer on it.


Solution

  • 2 minutes for 715 images is a really good time.
    Steps that can be taken:

    1. enable fast mode in FaceDetector
    2. set setTrackingEnabled to false if you don't want to track
    3. set minimum face size to an appropriate size according to your dataset
    4. Load the bitmaps using Universal Image Loader or glide library of Android. I used the UIL library.
    5. 640x480 is an optimum size for face detection and classification for scale down the size for less time and almost the same result.
    6. Set setLandmarkType and setClassificationType according to your needs and disable if not required.