google-ai-edge / mediapipe-samples

Apache License 2.0
1.61k stars 415 forks source link

About face_detector performance issues in android #411

Open gongqi126854 opened 4 months ago

gongqi126854 commented 4 months ago

I am here https://ai.google.dev/edge/mediapipe/solutions/vision/face_detector found this website, The website says that the average latency of the model can be 2.94ms when using the Pixel 6 CPU, which is an exciting number, but when I actually tried the example, I failed to meet my expectations. I know that the CPU of the Pixel 6 is the Google Tensor SoC, which is not easy to compare with existing models, so I checked https://storage.googleapis.com/mediapipe-assets/MediaPipe%20BlazeFace%20Model%20Card%20(Short%20Range).pdf This pdf says that the model can reach 275fps on a Pixel 2. I have used many phones with much higher configurations than this phone, but the latency is always high, and the fastest is more than 10ms, which is not right. What do I need to do to reduce the latency?

PaulTR commented 4 months ago

I'll look into where those benchmarks came from. I've generally seen 20-30ms, which is still very fast, but I'm not sure where 10ms comes from.

gongqi126854 commented 3 months ago

Hi, is there any result?

Mikkelet commented 3 months ago

I updated the the sample project to android 34 with agp=8.3.2, gradle=8.4 and framerate jumped from 30ms to 500, phone is S21

edit: sorry, there were other changes:

That seemed to slow it down a lot