Machine learning is certainly the hot buzz word where everyone wants to get the advantages of it but great things comes with great cost and so as machine learning. Gathering dataset, training, testing all these requires a great amount of effort in order to get a good model. How about if all these can be done automatically where you just have bring your data and rest of all gets automated to give a well trained model.

Firebase this year added another machine learning capability to ML Kit which is AutoML Vision Edge, this provides the image labeling capability to Android and iOS app where you can train the model by providing the images for example a model can be trained to distinguish between the name of dishes, identify the type of object like cricket bat, baseball etc, the model is trained on firebase and provides three options for the model that is either download it, publish on firebase or download and publish in order to use it in the app.

How to use AutoML Vision Edge?

The first step to use AutoML is to create a project on firebase console and switch to ML Kit section, there click on AutoML, now click on get started

Note: If you are on Spark plan than you can only create 1 dataset with max 1000 image to get trained on with 3 hours of training a model.

By the time you click on “Get started” you should have your images ready with any of the following approach

1. zip folder containing all images

2. Uploading images to cloud storage first and upload the csv file thereafter

3. Upload images directly on firebase console and name them individually.

The easiest approach is to upload the zip file if you have where the following structure should be followed

training_data.zip

|____dog

| |____001.jpg

| |____2.jpg

| |____doggy.jpg

|____cat

| |____cat_one.gif

| |____1.png

The name of the folder is the label for the images, so keep all the images with same label in a single folder where name of the images inside the folder need not have to follow any sort of sequence however, the size of the images should be less than 30 Mb. Once all the folders are having appropriate images then create zip folder containing all other folders which you will upload to the firebase console. In order to upload you zip file click on the add dataset

Now enter the name for your dataset and select whether you want single label classification or multi-label and click on create.

Now you are just 3 steps away from getting your trained model, the 3 steps are import data, label image and train a model.

Import data

Click on browse the files and select the zip folder to upload on firebase console, during this phase it will upload the folder, validate the images and import the dataset.

Label images

In this phase it will show all the images and labels, you can label the unlabeled images here, in case the images are less than 100 for any associated label it will show a warning sign after the label name. If all looks good and images are labeled then click on train model.

Train model

That’s the final phase where you can name your model, select the latency for the responses from the model where lowest the latency higher the chance of inaccuracy. After selecting the appropriate latency and package size click on start training, where it will take time based on the number of image provided as dataset.

Training a model will take time and once it’s done you will receive an email from the firebase

Evaluate and publish the model

Finally the trained model is ready now you can evaluate the model by toggling the threshold value, do note that higher the threshold lower the changes for inaccuracy but it also lower the chances for labeling the image. The threshold is the minimum confidence the model must have for it to assign a label to an image.

Now as you have your model ready following are all the available options to use the trained model where all have their own advantages and disadvantages.

1. Bundle with apk — Model is always ready to use but need to upload app to play store everytime when model need to be updated.

2. Publish to firebase — This provides updated model anytime to the app without uploading new app to play store but this requires app to be connected to internet util model is downloaded.

3. Bundle and publish — This ensure that app to use the bundled model and in case updated model is available download it when internet is available but this increases the size of apk.

That’s it, you have trained your model and now can provide this model to the app developer for integration to Android and iOS app. ML Kit provides host of other ML capabilities, do checkout them and the other services of firebase!