CustomImageLabelerOptions.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
|
|
|
Builder(CustomRemoteModel remoteModel)
|
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Constructors
public Builder (LocalModel
localModel)
public Builder (CustomRemoteModel
remoteModel)
Public Methods
Sets confidence threshold of detected labels. Only labels detected with confidence
higher than this threshold are returned.
The default value will be read from model metadata. If not presented, will use
0.
Sets the custom Executor
to use. If no Executor
is set, an internal background thread pool will be used.
Most clients should not need to call this method.
Returns
- this object, for chaining method calls
Sets the maximum number of results that the image labeler will return.
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\u003eCustomImageLabelerOptions.Builder\u003c/code\u003e helps configure custom image labeling using local or remote models.\u003c/p\u003e\n"],["\u003cp\u003eIt allows setting the confidence threshold for detected labels, influencing which labels are returned.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can specify a custom \u003ccode\u003eExecutor\u003c/code\u003e for task processing or rely on the internal thread pool.\u003c/p\u003e\n"],["\u003cp\u003eThe maximum number of labels returned by the image labeler can be controlled using \u003ccode\u003esetMaxResultCount\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `CustomImageLabelerOptions.Builder` class builds `CustomImageLabelerOptions` using either a `LocalModel` or `CustomRemoteModel`. It offers methods to customize the image labeling process. `setConfidenceThreshold` adjusts the minimum confidence for a label to be returned. `setMaxResultCount` limits the number of returned labels. `setExecutor` allows for a custom `Executor`, otherwise, an internal thread pool is used. The `build` method constructs the final `CustomImageLabelerOptions` object.\n"],null,["# CustomImageLabelerOptions.Builder\n\npublic static class **CustomImageLabelerOptions.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nBuilder of [CustomImageLabelerOptions](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions). \n\n### Public Constructor Summary\n\n|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Builder](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder#Builder(com.google.mlkit.common.model.LocalModel))(LocalModel localModel) Creates a new builder to build [CustomImageLabelerOptions](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions) with [LocalModel](/android/reference/com/google/mlkit/common/model/LocalModel). |\n| | [Builder](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder#Builder(com.google.mlkit.common.model.CustomRemoteModel))(CustomRemoteModel remoteModel) Creates a new builder to build [CustomImageLabelerOptions](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions) with [CustomRemoteModel](/android/reference/com/google/mlkit/common/model/CustomRemoteModel). |\n\n### Public Method Summary\n\n|--------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [CustomImageLabelerOptions](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions) | [build](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder#build())() |\n| [CustomImageLabelerOptions.Builder](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder) | [setConfidenceThreshold](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder#setConfidenceThreshold(float))(float confidenceThreshold) Sets confidence threshold of detected labels. |\n| [CustomImageLabelerOptions.Builder](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder) | [setExecutor](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder#setExecutor(java.util.concurrent.Executor))([Executor](//developer.android.com/reference/java/util/concurrent/Executor.html) executor) Sets the custom [Executor](//developer.android.com/reference/java/util/concurrent/Executor.html) to use. |\n| [CustomImageLabelerOptions.Builder](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder) | [setMaxResultCount](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder#setMaxResultCount(int))(int maxResultCount) Sets the maximum number of results that the image labeler will return. |\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 Constructors\n-------------------\n\n#### public **Builder** (LocalModel localModel)\n\nCreates a new builder to build [CustomImageLabelerOptions](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions) with [LocalModel](/android/reference/com/google/mlkit/common/model/LocalModel). \n\n#### public **Builder** (CustomRemoteModel remoteModel)\n\nCreates a new builder to build [CustomImageLabelerOptions](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions) with [CustomRemoteModel](/android/reference/com/google/mlkit/common/model/CustomRemoteModel).\n\nPublic Methods\n--------------\n\n#### public [CustomImageLabelerOptions](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions)\n**build** ()\n\n#### public [CustomImageLabelerOptions.Builder](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder) **setConfidenceThreshold** (float confidenceThreshold)\n\nSets confidence threshold of detected labels. Only labels detected with confidence\nhigher than this threshold are returned.\n\nThe default value will be read from model metadata. If not presented, will use\n0. \n\n##### Throws\n\n| [IllegalArgumentException](//developer.android.com/reference/java/lang/IllegalArgumentException.html) | if the `confidenceThreshold` is out of the range \\[0.0f, 1.0f\\]. |\n|-------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|\n\n#### public [CustomImageLabelerOptions.Builder](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder) **setExecutor** ([Executor](//developer.android.com/reference/java/util/concurrent/Executor.html) executor)\n\nSets the custom [Executor](//developer.android.com/reference/java/util/concurrent/Executor.html)\nto use. If no [Executor](//developer.android.com/reference/java/util/concurrent/Executor.html)\nis set, an internal background thread pool will be used.\n\nMost clients should not need to call this method. \n\n##### Parameters\n\n| executor | the [Executor](//developer.android.com/reference/java/util/concurrent/Executor.html) to use |\n|----------|---------------------------------------------------------------------------------------------|\n\n##### Returns\n\n- this object, for chaining method calls \n\n#### public [CustomImageLabelerOptions.Builder](/android/reference/com/google/mlkit/vision/label/custom/CustomImageLabelerOptions.Builder) **setMaxResultCount** (int maxResultCount)\n\nSets the maximum number of results that the image labeler will return."]]