1

I'm using google's firebase for object detection. You run it something like this:

Task<List<FirebaseVisionFace>> result =
    mDetector.detectInImage(FirebaseVisionImage.fromBitmap(dcBitmap))
                                        .addOnSuccessListener(  //etc, etc

Now I'm trying to understand how much this call impacts my apps frame rate, since it happens in the camera loop. I tried putting TimmingLogger splits around it but it told me that call returns in about 1ms. But clearly if I comment out the detector my fps goes way up. So I'm curious if anyone knows if this code is actually being called on a separate thread? Or have I somehow interrupted the operation of my thread and let it run this detection? I guess I'm trying to understand where the work is done and how to measure how much time it takes.

Ben Weiss
  • 17,182
  • 6
  • 67
  • 87
confused
  • 713
  • 1
  • 5
  • 16

1 Answers1

2

The detector itself runs in a separate thread, but the success listener is then invoked on the main/UI thread again.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Thank you. Does it mean that as soon as detector started, main thread continues regardless of detector process? – Liker777 Jul 16 '21 at 08:39