0

For the last few days I've been mulling over 'predicting where my face would be' while the Face Detection algorithm in the play-services-vision library works. For now I've come to the conclusion that I need the time it takes for the algorithm to process the last preview frame it gets.

How can I know how long it takes for the algorithm to process a preview frame?

Gensoukyou1337
  • 1,507
  • 1
  • 13
  • 31

1 Answers1

0

Detection time will vary by device, image resolution, and the settings used in creating the face detector. For example, detection will take longer when landmark detection is enabled, but will be faster if only looking for a single prominent face.

I'd recommend benchmarking on representative images with your device / settings to get a feel for the average detection times in your target environment.

You could time face detection like this:

Frame frame = Frame.Builder().setBitmap(myBitmap).build();
long startTimeMs = System.currentTimeMillis();
myFaceDetector.detect(frame);
long elapsedMs = System.currentTimeMillis() - startTimeMs;
System.out.println("Elapsed time: " + elapsedMs);
pm0733464
  • 2,862
  • 14
  • 16