ImageSegmenter.ImageSegmenterOptions.Builder

public static abstract class ImageSegmenter.ImageSegmenterOptions.Builder

Public Constructors

Public Methods

final ImageSegmenter.ImageSegmenterOptions
build()
Validates and builds the ImageSegmenter.ImageSegmenterOptions instance.
abstract ImageSegmenter.ImageSegmenterOptions.Builder
setBaseOptions(BaseOptions value)
Sets the base options for the image segmenter task.
abstract ImageSegmenter.ImageSegmenterOptions.Builder
setDisplayNamesLocale(String value)
The locale to use for display names specified through the TFLite Model Metadata, if any.
abstract ImageSegmenter.ImageSegmenterOptions.Builder
setErrorListener(ErrorListener value)
Sets an optional ErrorListener}.
abstract ImageSegmenter.ImageSegmenterOptions.Builder
setOutputCategoryMask(boolean value)
Whether to output category mask.
abstract ImageSegmenter.ImageSegmenterOptions.Builder
setOutputConfidenceMasks(boolean value)
Whether to output confidence masks.
abstract ImageSegmenter.ImageSegmenterOptions.Builder
setResultListener(ResultListener<ImageSegmenterResultMPImage> value)
/** Sets an optional OutputHandler.ResultListener to receive the segmentation results when the graph pipeline is done processing an image.
abstract ImageSegmenter.ImageSegmenterOptions.Builder
setRunningMode(RunningMode value)
Sets the running mode for the image segmenter task.

Inherited Methods

Public Constructors

public Builder ()

Public Methods

public final ImageSegmenter.ImageSegmenterOptions build ()

Validates and builds the ImageSegmenter.ImageSegmenterOptions instance.

Throws
IllegalArgumentException if the result listener and the running mode are not properly configured. The result listener must be set when the image segmenter is in the live stream mode.

public abstract ImageSegmenter.ImageSegmenterOptions.Builder setBaseOptions (BaseOptions value)

Sets the base options for the image segmenter task.

Parameters
value

public abstract ImageSegmenter.ImageSegmenterOptions.Builder setDisplayNamesLocale (String value)

The locale to use for display names specified through the TFLite Model Metadata, if any. Defaults to English.

Parameters
value

public abstract ImageSegmenter.ImageSegmenterOptions.Builder setErrorListener (ErrorListener value)

Sets an optional ErrorListener}.

Parameters
value

public abstract ImageSegmenter.ImageSegmenterOptions.Builder setOutputCategoryMask (boolean value)

Whether to output category mask.

Parameters
value

public abstract ImageSegmenter.ImageSegmenterOptions.Builder setOutputConfidenceMasks (boolean value)

Whether to output confidence masks.

Parameters
value

public abstract ImageSegmenter.ImageSegmenterOptions.Builder setResultListener (ResultListener<ImageSegmenterResultMPImage> value)

/** Sets an optional OutputHandler.ResultListener to receive the segmentation results when the graph pipeline is done processing an image.

Parameters
value

public abstract ImageSegmenter.ImageSegmenterOptions.Builder setRunningMode (RunningMode value)

Sets the running mode for the image segmenter task. Default to the image mode. Image segmenter has three modes:

  • IMAGE: The mode for segmenting image on single image inputs.
  • VIDEO: The mode for segmenting image on the decoded frames of a video.
  • LIVE_STREAM: The mode for for segmenting image on a live stream of input data, such as from camera. In this mode, setResultListener must be called to set up a listener to receive the recognition results asynchronously.

Parameters
value