CustomImageLabelerOptions.Builder

  • CustomImageLabelerOptions.Builder helps configure custom image labeling using local or remote models.

  • It allows setting the confidence threshold for detected labels, influencing which labels are returned.

  • Developers can specify a custom Executor for task processing or rely on the internal thread pool.

  • The maximum number of labels returned by the image labeler can be controlled using setMaxResultCount.

public static class CustomImageLabelerOptions.Builder extends Object

Public Constructor Summary

Builder(LocalModel localModel)
Creates a new builder to build CustomImageLabelerOptions with LocalModel.
Builder(CustomRemoteModel remoteModel)
Creates a new builder to build CustomImageLabelerOptions with CustomRemoteModel.

Public Method Summary

CustomImageLabelerOptions
CustomImageLabelerOptions.Builder
setConfidenceThreshold(float confidenceThreshold)
Sets confidence threshold of detected labels.
CustomImageLabelerOptions.Builder
setExecutor(Executor executor)
Sets the custom Executor to use.
CustomImageLabelerOptions.Builder
setMaxResultCount(int maxResultCount)
Sets the maximum number of results that the image labeler will return.

Inherited Method Summary

Public Constructors

public Builder (LocalModel localModel)

Creates a new builder to build CustomImageLabelerOptions with LocalModel.

public Builder (CustomRemoteModel remoteModel)

Creates a new builder to build CustomImageLabelerOptions with CustomRemoteModel.

Public Methods

public CustomImageLabelerOptions build ()

public CustomImageLabelerOptions.Builder setConfidenceThreshold (float confidenceThreshold)

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.

Throws
IllegalArgumentException if the confidenceThreshold is out of the range [0.0f, 1.0f].

public CustomImageLabelerOptions.Builder setExecutor (Executor executor)

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.

Parameters
executor the Executor to use
Returns
  • this object, for chaining method calls

public CustomImageLabelerOptions.Builder setMaxResultCount (int maxResultCount)

Sets the maximum number of results that the image labeler will return.