am15h / tflite_flutter_plugin

TensorFlow Lite Flutter Plugin
https://pub.dev/packages/tflite_flutter
Apache License 2.0
499 stars 352 forks source link

Anyone implemented "Movnet lightning/thunder" with Metal Delegate (Experiencing memory issues) #222

Open JunHeyy opened 1 year ago

JunHeyy commented 1 year ago

I attempted to use the Movnet model with tflite_flutter. The code is mostly based on the example code on ttps://github.com/am15h/object_detection_flutter, with a few minor changes.

It seems like there is a memory leak if i run the interpreter with metal delegate, the inference time is pretty good but the memory increase linearly and eventually the app crashes.

I created the interpreter outside of the isolate and also used Interpreter.fromFile instead of interpreter.fromAsset as i thought it was the issue but apparently it was not.

Here are some screenshots:

With the metal delegate: image

Without the metal delegate: image

The code can be seen on my public repository (https://github.com/JunHeyy/TFlite_Flutter_MovNet.git)

Any help would be appreciated :) Thank you for reading.

yaizudamashii commented 1 year ago

I don't think I can help but.. definitely an interesting attempt! I wonder how much better movnet models would be. Did you see any differences?