ImageSegmenter.ImageSegmenterOptions.Builder

public abstract class ImageSegmenter.ImageSegmenterOptions.Builder


Builder for ImageSegmenterOptions.

Summary

Public constructors

Public methods

final ImageSegmenter.ImageSegmenterOptions

Validates and builds the ImageSegmenterOptions instance.

abstract ImageSegmenter.ImageSegmenterOptions.Builder

Sets the base options for the image segmenter task.

abstract ImageSegmenter.ImageSegmenterOptions.Builder

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

abstract ImageSegmenter.ImageSegmenterOptions.Builder

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

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

abstract ImageSegmenter.ImageSegmenterOptions.Builder

Sets the running mode for the image segmenter task.

Public constructors

Builder

public Builder()

Public methods

build

public final ImageSegmenter.ImageSegmenterOptions build()

Validates and builds the ImageSegmenterOptions instance.

Throws
java.lang.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.

setBaseOptions

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

Sets the base options for the image segmenter task.

setDisplayNamesLocale

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.

setErrorListener

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

Sets an optional ErrorListener}.

setOutputCategoryMask

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

Whether to output category mask.

setOutputConfidenceMasks

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

Whether to output confidence masks.

setResultListener

public abstract ImageSegmenter.ImageSegmenterOptions.Builder setResultListener(
    OutputHandler.ResultListener<ImageSegmenterResult, MPImage> value
)

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

setRunningMode

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.