DetectedObject.Label
Stay organized with collections
Save and categorize content based on your preferences.
Represents an image label of a detected object.
Public Method Summary
boolean |
|
float |
|
int |
getIndex
() Gets the index of this label.
|
String
|
getText
() Gets the text of this label.
|
int |
|
Inherited Method Summary
From class java.lang.Object
Public Methods
public boolean
equals
( Object
o)
public float
getConfidence
()
Gets the confidence of this label.
The range of this confidence depends on the classifier model used, but by convention
it should be [0.0f, 1.0f].
For an ObjectDetector
created with ObjectDetectorOptions
, the range is [0.0f, 1.0f].
public int
getIndex
()
Gets the index of this label.
This is the index of this label among all the labels the classifier model supports.
It can be used as a unique identifier of this label.
For an ObjectDetector
created with ObjectDetectorOptions
, the index is one of the integer constants defined in PredefinedCategory
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eDetectedObject.Label\u003c/code\u003e represents an image label for a detected object, providing information like confidence, index, and textual description.\u003c/p\u003e\n"],["\u003cp\u003eThe confidence score, ranging from 0.0f to 1.0f, indicates the certainty of the label assigned to the detected object.\u003c/p\u003e\n"],["\u003cp\u003eEach label has a unique index, serving as an identifier among all supported labels by the classifier model.\u003c/p\u003e\n"],["\u003cp\u003eThe textual description of the label depends on the specific classifier model employed for object detection.\u003c/p\u003e\n"]]],["The `DetectedObject.Label` class represents a label for a detected object in an image. It provides methods to access label information: `getConfidence()` returns the confidence score (typically between 0.0f and 1.0f), `getIndex()` returns a unique integer identifier for the label, and `getText()` returns the textual representation of the label. Additionally, `equals()` and `hashCode()` methods are included for object comparison and hashing, respectively. It also inherit other method from the Object class.\n"],null,["# DetectedObject.Label\n\npublic static class **DetectedObject.Label** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nRepresents an image label of a detected object. \n\n### Public Method Summary\n\n|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| boolean | [equals](/android/reference/com/google/mlkit/vision/objects/DetectedObject.Label#equals(java.lang.Object))([Object](//developer.android.com/reference/java/lang/Object.html) o) |\n| float | [getConfidence](/android/reference/com/google/mlkit/vision/objects/DetectedObject.Label#getConfidence())() Gets the confidence of this label. |\n| int | [getIndex](/android/reference/com/google/mlkit/vision/objects/DetectedObject.Label#getIndex())() Gets the index of this label. |\n| [String](//developer.android.com/reference/java/lang/String.html) | [getText](/android/reference/com/google/mlkit/vision/objects/DetectedObject.Label#getText())() Gets the text of this label. |\n| int | [hashCode](/android/reference/com/google/mlkit/vision/objects/DetectedObject.Label#hashCode())() |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public boolean **equals** ([Object](//developer.android.com/reference/java/lang/Object.html) o)\n\n#### public float **getConfidence** ()\n\nGets the confidence of this label.\n\nThe range of this confidence depends on the classifier model used, but by convention\nit should be \\[0.0f, 1.0f\\].\n\nFor an [ObjectDetector](/android/reference/com/google/mlkit/vision/objects/ObjectDetector)\ncreated with [ObjectDetectorOptions](/android/reference/com/google/mlkit/vision/objects/defaults/ObjectDetectorOptions), the range is \\[0.0f, 1.0f\\]. \n\n#### public int **getIndex** ()\n\nGets the index of this label.\n\nThis is the index of this label among all the labels the classifier model supports.\nIt can be used as a unique identifier of this label.\n\nFor an [ObjectDetector](/android/reference/com/google/mlkit/vision/objects/ObjectDetector)\ncreated with [ObjectDetectorOptions](/android/reference/com/google/mlkit/vision/objects/defaults/ObjectDetectorOptions), the index is one of the integer constants defined in\n[PredefinedCategory](/android/reference/com/google/mlkit/vision/objects/defaults/PredefinedCategory). \n\n#### public [String](//developer.android.com/reference/java/lang/String.html) **getText** ()\n\nGets the text of this label.\n\nThe text returned here depends on the classifier model used. For an [ObjectDetector](/android/reference/com/google/mlkit/vision/objects/ObjectDetector)\ncreated with [ObjectDetectorOptions](/android/reference/com/google/mlkit/vision/objects/defaults/ObjectDetectorOptions), the text is one of the String constants defined in\n[PredefinedCategory](/android/reference/com/google/mlkit/vision/objects/defaults/PredefinedCategory). \n\n#### public int **hashCode** ()"]]