I am developing a cross-platform application and need to implement a feature for real-time object detection. Since I am focusing on Flutter (AI apps), I’m curious if using TFLite is still the most efficient way to maintain high performance on both iOS and Android, or if there are newer plugins that offer better latency for live camera feeds.
3 answers
For Flutter (AI apps), TensorFlow Lite (TFLite) remains a very strong contender because of its mature ecosystem and hardware acceleration capabilities. However, you should definitely look into Google’s ML Kit if you want a more "plug-and-play" experience for common tasks like face detection or text recognition. In a recent project, I used the google_ml_kit package and found that it significantly reduced the boilerplate code compared to raw TFLite implementations. The latency was impressively low on modern devices because it leverages the underlying system-level optimizations that standard plugins sometimes miss.
Margaret, does ML Kit support custom model hosting, or are we restricted only to the pre-trained models provided by Google for vision tasks?
I highly recommend using the camera package with an isolate to handle the heavy image processing off the main UI thread to prevent jank.
I agree with Brian; isolates are essential in Flutter (AI apps). I also found that converting the CameraImage format to something the model understands is much faster when done in C++ via FFI.
Jason, ML Kit does allow you to use custom TFLite models! You can either bundle them within your Flutter (AI apps) or download them dynamically via Firebase to keep your initial app size small. This is a huge advantage when you have a proprietary model but still want the simplified API that ML Kit provides for handling the camera stream and image rotations, which is usually the hardest part to get right.