Back to Tensorflow

AudioClassifier.AudioClassifierOptions.Builder

tensorflow/lite/g3doc/api_docs/java/org/tensorflow/lite/task/audio/classifier/AudioClassifier.AudioClassifierOptions.Builder.html

2.21.07.2 KB
Original Source

public static class AudioClassifier.AudioClassifierOptions.Builder

A builder that helps to configure an instance of AudioClassifierOptions.

Public Methods

| AudioClassifier.AudioClassifierOptions | build() | | AudioClassifier.AudioClassifierOptions.Builder | setBaseOptions(BaseOptions baseOptions) Sets the general options to configure Task APIs, such as accelerators.

| | AudioClassifier.AudioClassifierOptions.Builder | setDisplayNamesLocale(String displayNamesLocale) Sets the locale to use for display names specified through the TFLite Model Metadata, if any.

| | AudioClassifier.AudioClassifierOptions.Builder | setLabelAllowList(List<String> labelAllowList) Sets the optional allowlist of labels.

| | AudioClassifier.AudioClassifierOptions.Builder | setLabelDenyList(List<String> labelDenyList) Sets the optional denylist of labels.

| | AudioClassifier.AudioClassifierOptions.Builder | setMaxResults(int maxResults) Sets the maximum number of top scored results to return.

| | AudioClassifier.AudioClassifierOptions.Builder | setScoreThreshold(float scoreThreshold) Sets the score threshold.

|

Inherited Methods

From class java.lang.Object

| boolean | equals(Object arg0) | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

Public Methods

public AudioClassifier.AudioClassifierOptions build ()

public AudioClassifier.AudioClassifierOptions.Builder setBaseOptions (BaseOptions baseOptions)

Sets the general options to configure Task APIs, such as accelerators.

Parameters

| baseOptions | |

public AudioClassifier.AudioClassifierOptions.Builder setDisplayNamesLocale (String displayNamesLocale)

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

Defaults to English("en"). See the TFLite Metadata schema file. for the accepted pattern of locale.

Parameters

| displayNamesLocale | |

public AudioClassifier.AudioClassifierOptions.Builder setLabelAllowList (List<String> labelAllowList)

Sets the optional allowlist of labels.

If non-empty, classifications whose label is not in this set will be filtered out. Duplicate or unknown labels are ignored. Mutually exclusive with labelDenyList.

Parameters

| labelAllowList | |

public AudioClassifier.AudioClassifierOptions.Builder setLabelDenyList (List<String> labelDenyList)

Sets the optional denylist of labels.

If non-empty, classifications whose label is in this set will be filtered out. Duplicate or unknown labels are ignored. Mutually exclusive with labelAllowList.

Parameters

| labelDenyList | |

public AudioClassifier.AudioClassifierOptions.Builder setMaxResults (int maxResults)

Sets the maximum number of top scored results to return.

Parameters

| maxResults | if < 0, all results will be returned. If 0, an invalid argument error is returned. Defaults to -1. |

Throws

| IllegalArgumentException | if maxResults is 0 |

public AudioClassifier.AudioClassifierOptions.Builder setScoreThreshold (float scoreThreshold)

Sets the score threshold.

It overrides the one provided in the model metadata (if any). Results below this value are rejected.

Parameters

| scoreThreshold | |