Last updated:
0 purchases
learning image labeling
ML Image Labeling #
The easy way to use ML Kit for image labeling in Flutter.
With ML Kit's image labeling we can detect and extract information about entities in an image across a broad group of categories. The default image labeling model can identify general objects, places, activities, animal species, products, and more.
Note that this is intended for image classification models that describe the full image. For classifying one or more objects in an image, such as shoes or pieces of furniture, plugin learning_object_detection may be a better fit.
Getting Started #
Add dependency to your flutter project:
$ flutter pub add learning_image_labeling
copied to clipboard
or
dependencies:
learning_image_labeling: ^0.0.1
copied to clipboard
Then run flutter pub get.
Usage #
import 'package:learning_image_labeling/learning_image_labeling.dart';
copied to clipboard
Input Image #
As in other ML vision plugins, input is fed as an instance of InputImage, which is part of package learning_input_image.
You can use widget InputCameraView from learning_input_image as default implementation for processing image (or image stream) from camera / storage into InputImage format. But feel free to learn the inside of InputCameraView code if you want to create your own custom implementation.
Here is example of using InputCameraView to get InputImage for face detection.
import 'package:learning_input_image/learning_input_image.dart';
InputCameraView(
title: 'Image Labeling',
onImage: (InputImage image) {
// now we can feed the input image into image labeling process
},
)
copied to clipboard
Image Labeling #
After getting the InputImage, we can start image labeling by calling method process from an instance of ImageLabeling.
ImageLabeling imageLabeling = ImageLabeling();
List<Label> labels = await imageLabeling.process(image);
copied to clipboard
ImageLabeling object is instantiated with default parameter confidenceThreshold as following.
ImageLabeling imageLabeling = ImageLabeling(confidenceThreshold: 0.8)
copied to clipboard
But feel free to setup using your own value of confidenceThreshold.
Output #
The result of image labeling process is a list of Label object, in each contains the following data.
int index // index of this label
String label // the label of image
double confidence // the value representing the probability that the label is right
copied to clipboard
Dispose #
imageLabeling.dispose();
copied to clipboard
Example Project #
You can learn more from example project here.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.