mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

How to Improve the Efficiency of Face Landmarker Detection on Android Systems.Thank you.

Open RavenGluttonous opened this issue 2 years ago • 1 comments

Hi, I am using your Face Landmarker Detection project on a Huawei Honor V8 model, running the demo you provided, in LIVE_STREAM mode with setDelegate(Delegate.GPU), and trying to process 256 video frames, with a frame size of 480*640, the total time taken is about 27 seconds. The total time consumed is about 27 seconds, which is an average of 106 milliseconds per frame. How can I improve his efficiency so that he can give the result faster and the total time consumed can be less than 15 seconds?

    private fun returnLivestreamResult(
        result: FaceLandmarkerResult,
        input: MPImage
    ) {
        if (result.faceLandmarks().size > 0) {
            position++
            val finishTimeMs = SystemClock.uptimeMillis()
            val inferenceTime = finishTimeMs - result.timestampMs()
          
            timeCount += inferenceTime

            if (position == 256) {
                Log.d(TAG, "256 the total frame elapsed time is $timeCount" 
                + ",the average time taken was ${timeCount / 256}")
            }
            faceLandmarkerHelperListener?.onResults(
                ResultBundle(
                    result,
                    inferenceTime,
                    input.height,
                    input.width
                )
            )

        } else {
            faceLandmarkerHelperListener?.onEmpty()
        }
    }

RavenGluttonous avatar Nov 08 '23 10:11 RavenGluttonous

Probably just not use mediapipe and go with Tensorflow directly. You just need two models and really just one if you can detect fast yourself. That will spare you from all the unnessarily complexity the graph, calculators and particular dependencies and as a bonus will make your binaries smaller.

bedbad avatar Nov 14 '23 23:11 bedbad