Builder for ImageEmbedder.ImageEmbedderOptions
.
Public Constructors
Builder()
|
Public Methods
final ImageEmbedder.ImageEmbedderOptions |
build()
Validates and builds the
ImageEmbedder.ImageEmbedderOptions instance. |
abstract ImageEmbedder.ImageEmbedderOptions.Builder | |
abstract ImageEmbedder.ImageEmbedderOptions.Builder | |
abstract ImageEmbedder.ImageEmbedderOptions.Builder |
setL2Normalize(boolean l2Normalize)
Sets whether L2 normalization should be performed on the returned embeddings.
|
abstract ImageEmbedder.ImageEmbedderOptions.Builder |
setQuantize(boolean quantize)
Sets whether the returned embedding should be quantized to bytes via scalar quantization.
|
abstract ImageEmbedder.ImageEmbedderOptions.Builder |
setResultListener(ResultListener<ImageEmbedderResult, MPImage> resultListener)
Sets the
OutputHandler.ResultListener to receive the embedding results asynchronously when the
image embedder is in the live stream mode. |
abstract ImageEmbedder.ImageEmbedderOptions.Builder |
Inherited Methods
Public Constructors
public Builder ()
Public Methods
public final ImageEmbedder.ImageEmbedderOptions build ()
Validates and builds the ImageEmbedder.ImageEmbedderOptions
instance. *
Throws
IllegalArgumentException | if the result listener and the running mode are not properly configured. The result listener should only be set when the image embedder is in the live stream mode. |
---|
public abstract ImageEmbedder.ImageEmbedderOptions.Builder setBaseOptions (BaseOptions baseOptions)
Sets the BaseOptions
for the image embedder task.
Parameters
baseOptions |
---|
public abstract ImageEmbedder.ImageEmbedderOptions.Builder setErrorListener (ErrorListener errorListener)
Sets an optional ErrorListener
.
Parameters
errorListener |
---|
public abstract ImageEmbedder.ImageEmbedderOptions.Builder setL2Normalize (boolean l2Normalize)
Sets whether L2 normalization should be performed on the returned embeddings. Use this
option only if the model does not already contain a native L2_NORMALIZATION
TF
Lite Op. In most cases, this is already the case and L2 norm is thus achieved through TF
Lite inference.
False by default.
Parameters
l2Normalize |
---|
public abstract ImageEmbedder.ImageEmbedderOptions.Builder setQuantize (boolean quantize)
Sets whether the returned embedding should be quantized to bytes via scalar quantization.
Embeddings are implicitly assumed to be unit-norm and therefore any dimensions is
guaranteed to have value in [-1.0, 1.0]
. Use setL2Normalize(boolean)
if this is not the case.
False by default.
Parameters
quantize |
---|
public abstract ImageEmbedder.ImageEmbedderOptions.Builder setResultListener (ResultListener<ImageEmbedderResult, MPImage> resultListener)
Sets the OutputHandler.ResultListener
to receive the embedding results asynchronously when the
image embedder is in the live stream mode.
Parameters
resultListener |
---|
public abstract ImageEmbedder.ImageEmbedderOptions.Builder setRunningMode (RunningMode runningMode)
Sets the RunningMode
for the image embedder task. Default to the image mode. Image
embedder has three modes:
- IMAGE: The mode for performing embedding extraction on single image inputs.
- VIDEO: The mode for performing embedding extraction on the decoded frames of a video.
- LIVE_STREAM: The mode for for performing embedding extraction 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 embedding results asynchronously.
Parameters
runningMode |
---|