AI-generated Key Takeaways
-
SelfieSegmenterOptions.Builder
is used to createSelfieSegmenterOptions
objects for configuring selfie segmentation. -
You can customize the segmentation process by enabling raw size masks, setting the detector mode (stream or single image), and providing a custom executor.
-
The
build()
method creates aSelfieSegmenterOptions
instance based on the builder's settings. -
By default, the detector mode is set to
STREAM_MODE
and an internal background thread pool is used if no custom executor is specified. -
Enabling
enableRawSizeMask()
returns the segmentation mask in the model's output size, requiring you to handle rescaling if needed.
Builder for SelfieSegmenterOptions
.
Public Constructor Summary
Builder()
|
Public Method Summary
SelfieSegmenterOptions |
build()
|
SelfieSegmenterOptions.Builder |
enableRawSizeMask()
Asks the segmenter to return the raw size mask which matches the model output
size.
|
SelfieSegmenterOptions.Builder |
setDetectorMode(int detectorMode)
Sets the detector mode to be either
SelfieSegmenterOptions.STREAM_MODE or
SelfieSegmenterOptions.SINGLE_IMAGE_MODE .
|
SelfieSegmenterOptions.Builder |
Inherited Method Summary
Public Constructors
public Builder ()
Public Methods
public SelfieSegmenterOptions build ()
public SelfieSegmenterOptions.Builder enableRawSizeMask ()
Asks the segmenter to return the raw size mask which matches the model output size.
The raw mask size (e.g. 256x256) is usually smaller than the InputImage
size. Please call
SegmentationMask.getWidth()
and
SegmentationMask.getHeight()
to get the size when enabling this option.
Without specifying this option, the segmenter will rescale the raw mask to match the input image size. Consider using this option if you want to apply customized rescaling logic or rescaling is not needed for your use case.
public SelfieSegmenterOptions.Builder setDetectorMode (int detectorMode)
Sets the detector mode to be either
SelfieSegmenterOptions.STREAM_MODE
or
SelfieSegmenterOptions.SINGLE_IMAGE_MODE
.
By default, it is
SelfieSegmenterOptions.STREAM_MODE
.
For more details about use cases of each mode, please check the documentation of
SelfieSegmenterOptions.STREAM_MODE
and
SelfieSegmenterOptions.SINGLE_IMAGE_MODE
.