Builder for AudioEmbedder.AudioEmbedderOptions
.
Public Constructors
Builder()
|
Public Methods
final AudioEmbedder.AudioEmbedderOptions |
build()
Validates and builds the
AudioEmbedder.AudioEmbedderOptions instance. |
abstract AudioEmbedder.AudioEmbedderOptions.Builder | |
abstract AudioEmbedder.AudioEmbedderOptions.Builder | |
abstract AudioEmbedder.AudioEmbedderOptions.Builder |
setL2Normalize(boolean l2Normalize)
Sets whether L2 normalization should be performed on the returned embeddings.
|
abstract AudioEmbedder.AudioEmbedderOptions.Builder |
setQuantize(boolean quantize)
Sets whether the returned embedding should be quantized to bytes via scalar quantization.
|
abstract AudioEmbedder.AudioEmbedderOptions.Builder |
setResultListener(PureResultListener<AudioEmbedderResult> resultListener)
Sets the
OutputHandler.ResultListener to receive the embedding results asynchronously when the
audio embedder is in the audio stream mode. |
abstract AudioEmbedder.AudioEmbedderOptions.Builder |
Inherited Methods
Public Constructors
public Builder ()
Public Methods
public final AudioEmbedder.AudioEmbedderOptions build ()
Validates and builds the AudioEmbedder.AudioEmbedderOptions
instance.
Throws
IllegalArgumentException | if the result listener and the running mode are not properly configured. The result listener should only be set when the audio embedder is in the audio stream mode. |
---|
public abstract AudioEmbedder.AudioEmbedderOptions.Builder setBaseOptions (BaseOptions baseOptions)
Sets the BaseOptions
for the audio embedder task.
Parameters
baseOptions |
---|
public abstract AudioEmbedder.AudioEmbedderOptions.Builder setErrorListener (ErrorListener errorListener)
Sets an optional ErrorListener
.
Parameters
errorListener |
---|
public abstract AudioEmbedder.AudioEmbedderOptions.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 AudioEmbedder.AudioEmbedderOptions.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 AudioEmbedder.AudioEmbedderOptions.Builder setResultListener (PureResultListener<AudioEmbedderResult> resultListener)
Sets the OutputHandler.ResultListener
to receive the embedding results asynchronously when the
audio embedder is in the audio stream mode.
Parameters
resultListener |
---|
public abstract AudioEmbedder.AudioEmbedderOptions.Builder setRunningMode (RunningMode runningMode)
Sets the RunningMode
for the audio embedder task. Default to the audio clips mode.
Image embedder has two modes:
- AUDIO_CLIPS: The mode for running audio embedding on audio clips. Users feed audio clips to the `embed` method, and will receive the embedding results as the return value.
- AUDIO_STREAM: The mode for running audio embedding on the audio stream, such as from microphone. Users call `embedAsync` to push the audio data into the AudioEmbedder, the embedding results will be available in the result callback when the audio embedder finishes the work.
Parameters
runningMode |
---|