Image labeling
ML Kit contains an image labeling service. With it, you can identify common objects, places, animals, products, and more. Currently, the API supports over 400 categories, but you can also use a custom TensorFlow Lite model to add more objects. In this recipe, we’ll learn how to implement this feature in our sample app.
Getting ready
Before following this recipe, you should have completed the Using the device camera and Recognizing text from an image recipes in this chapter.
How to do it...
Let’s now add an image labeling feature to the existing app:
- Add the
google_mlkit_image_labeling
package to your project from the Terminal:flutter pub add google_mlkit_image_labeling
- In the
ml.dart
file, import the new package:import 'package:google_mlkit_image_labeling/google_mlkit_image_labeling.dart';
- Add a new async method and call it
labelImage
. The method takesFile
as a parameter...