tflite-support icon indicating copy to clipboard operation
tflite-support copied to clipboard

Profiling a TFLite

Open roger-creus opened this issue 4 years ago • 4 comments

Hello everybody :)

I am using a custom TFLite model in an Android Studio Application and want to profile it so I can see the resources spent in each layer of the model. I have followed https://www.tensorflow.org/lite/performance/measurement but I am not capable of seeing the layer-specific resources in the profiler window. I wonder what is the best way of profiling the TFLite model (I have seen that it can also be done directly with adb but I'm not sure the profiled results are consistent with the real ones obtained in Android Studio).

Thank you!

roger-creus avatar Jul 28 '21 08:07 roger-creus

Asking @multiverse-tf for help.

xunkai55 avatar Jul 29 '21 12:07 xunkai55

Hi @yuyecreus, could you provide the Android phone you've used for the profiling, and more details about the steps you've done to get the profiling results in Android Studio?

As you are aware of the cmdline-based benchmark tool, although the exact results you obtain might be different from what you'll obtain in Android Studio, both of them are expected to show same performance issues. In particular, see this part for details about obtaining per-op profiling info.

FYI, nightly-pre-built benchmark tools could be found here.

multiverse-tf avatar Jul 30 '21 08:07 multiverse-tf

Hi @yuyecreus, could you provide the Android phone you've used for the profiling, and more details about the steps you've done to get the profiling results in Android Studio?

As you are aware of the cmdline-based benchmark tool, although the exact results you obtain might be different from what you'll obtain in Android Studio, both of them are expected to show same performance issues. In particular, see this part for details about obtaining per-op profiling info.

FYI, nightly-pre-built benchmark tools could be found here.

I have used a Xiaomi Poco X3 NFC. I have followed the steps for profiling in Android Studio https://www.tensorflow.org/lite/performance/measurement#android_studio_cpu_profiler. I can follow them but in the end I see no model related or per-op profilinig info as in the example under the recognizeImage() function. In fact, It does not appear any wrapper like the recognizeImage() function in the example.

Thank you!

roger-creus avatar Aug 02 '21 08:08 roger-creus

@multiverse-tf can you please follow up with the questions above? Thanks!

lu-wang-g avatar Aug 02 '21 18:08 lu-wang-g