Application and Use Cases

Using image labeling in Firebase’s ML Kit enables you to identify entities in an image without providing additional data. Among the items that can be recognized with the built-in, pre-trained API include activities, places, things, and people — just to mention a few.

Each entity found also comes with a confidence score. The device-based API supports 400+ labels. The cloud-based API supports 10,000+ labels. The choice of which API to use is based on price, number of labels, and the different capabilities of each. The on-device API is free but only supports 400+ labels. The cloud API is free for the first 1000 uses of this feature per month.

In terms of performance and functionality, the on-device flavor enables inference to happen locally, which can lead to faster speeds and ensures data security. Meanwhile, the cloud-based solution is more powerful and accurate and might be better for use-cases that don’t require real-time processing

In order to use the cloud-based API, ensure that you have set up billing and enabled the cloud vision API.

Should you choose to use the on-device API, remember to configure your application to automatically download the ML model to the device after the app is installed from the Play Store. To achieve that, add the following to your app’s AndroidManifest.xml :

<application ...>

...

<meta-data

android:name="com.google.firebase.ml.vision.DEPENDENCIES"

android:value="label" />

<!-- To use multiple models: android:value="label,model2,model3" -->

</application>

Also, remember to include the on-device dependency in your Android/app/build.gradle :