Facelandmarker slow on Android apps but fast with TFLite model benchmark tool #5872
Labels
gpu
MediaPipe GPU related issues
platform::android
Android Solutions
task:face landmarker
Issues related to Face Landmarker: Identify facial features for visual effects and avatars.
type:performance
Execution Time and memory heap, stackoverflow and garbage collection related
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
Yes
OS Platform and Distribution
Android 15
MediaPipe Tasks SDK version
0.10.21
Task name (e.g. Image classification, Gesture recognition etc.)
Face landmark detection
Programming Language and version (e.g. C++, Python, Java)
Kotlin
Describe the actual behavior
The face landmarker model takes about 30-70 ms to run on a Pixel 9 Pro
Describe the expected behaviour
I would expect the model to run in real-time (on Desktop, using Wasm it takes 15-20 ms)
Standalone code/steps you may have used to try to get what you need
I tried the code sample code from https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/face_landmarker/android
Other info / Complete Logs
To check how fast the model can run, I used the TFLite Model Benchmark Tool.
I unzipped the
face_landmarker.task
and benchmarked both theface_detector.tflite
and theface_landmarks_detector.tlite
models:Results:
So, on GPU:
And on CPU:
In my app, I am initializing like this:
And then using it like this:
I would expect to see a bit more than 15 ms because the
mpImage
is 640×480 and needs to be resized to 192×192 and 256×256 for the detector and the landmarker, respectively.However, the gap between the TFLite model benchmark tool (15ms) and the actual app (30-70ms) seems too large.
Am I initializing the model properly, is there something I am missing that's hampering the performance?
Thanks in advance.
The text was updated successfully, but these errors were encountered: