ML Kit and Image Labeling in Flutter

Aseem Wangoo
CodeChai
Published in
3 min readJul 17, 2018

ML Kit and Image Labeling in Flutter

All in one Flutter Resource: https://flatteredwithflutter.com/ml-kit-and-image-labeling-in-flutter/

Image Labeling using Machine Learning and MLKit….

ML (Machine Learning) Kit was one of the key highlights in Google I/O 2018. This kit is comprised of

  1. Image Labeling
  2. Text- Recognition
  3. Face- Detection
  4. Barcode- scanning
  5. Landmark- detection
From google site…

For text recognition using MLKit you can refer my article here.

I decided to explore more about it and utilize the power of ML Kit in Flutter. Programmers have started working on this kit globally.

One of the efficient flutter packages, I came across was from azihsoyn

mlkit 0.5.0— A Flutter plugin to use the Firebase ML Kit.

We simply need to import this package in our pubspec.yaml file as

Ml Kit package

and in your dart file : import ‘package:mlkit/mlkit.dart’;

Please note that the name of your app should be same in the Firebase, your project’s manifest.xml (if playing in android) and in the app-level build.gradle (if playing in android).

Image Labeling using MLKit…

Include the google-services.json in the app directory of android. (one of the steps in Firebase project setup).

Let’s begin..

VisionLabel of MlKit library, is used for storing the labels which are fetched from Firebase ML.

FirebaseVisionLabelDetector : This is used to initialize the Firebase instance of Vision Label.

Click on the floating button and it opens gallery. You select some image and it labels the items from the image using MLKit.

MLKit function for Image Labeling….

The data retrieved from Firebase ML, gives us three results :

  1. label
  2. confidence
  3. entityID

These are displayed in the application (as shown in the image above) as :

Image Label results

Articles related to Flutter:

For complete source code, visit

P.S…………….

The Flutter Pub is a medium publication to bring you the latest and amazing resources such as articles, videos, codes, podcasts etc. about this great technology to teach you how to build beautiful apps with it. You can find us on Facebook, Twitter, and Medium or learn more about us here. We’d love to connect! And if you are a writer interested in writing for us, then you can do so through these guidelines.

--

--