Attention: This MediaPipe Solutions Preview is an early release. Learn more.

ClassifierOptions.Builder

Stay organized with collections Save and categorize content based on your preferences.
public static abstract class ClassifierOptions.Builder

Builder for ClassifierOptions.

Public Constructors

Public Methods

final ClassifierOptions
build()
Validates and builds the ClassifierOptions instance.
abstract ClassifierOptions.Builder
setCategoryAllowlist(List<String> categoryAllowlist)
Sets the optional allowlist of category names.
abstract ClassifierOptions.Builder
setCategoryDenylist(List<String> categoryDenylist)
Sets the optional denylist of category names.
abstract ClassifierOptions.Builder
setDisplayNamesLocale(String locale)
Sets the optional locale to use for display names specified through the TFLite Model Metadata, if any.
abstract ClassifierOptions.Builder
setMaxResults(Integer maxResults)
Sets the optional maximum number of top-scored classification results to return.
abstract ClassifierOptions.Builder
setScoreThreshold(Float scoreThreshold)
Sets the optional score threshold.

Inherited Methods

Public Constructors

public Builder ()

Public Methods

public final ClassifierOptions build ()

Validates and builds the ClassifierOptions instance.

Throws
IllegalArgumentException if ERROR(/maxResults) is set to a value <= 0.

public abstract ClassifierOptions.Builder setCategoryAllowlist (List<String> categoryAllowlist)

Sets the optional allowlist of category names.

If non-empty, detection results whose category name is not in this set will be filtered out. Duplicate or unknown category names are ignored. Mutually exclusive with categoryDenylist.

Parameters
categoryAllowlist

public abstract ClassifierOptions.Builder setCategoryDenylist (List<String> categoryDenylist)

Sets the optional denylist of category names.

If non-empty, detection results whose category name is in this set will be filtered out. Duplicate or unknown category names are ignored. Mutually exclusive with categoryAllowlist.

Parameters
categoryDenylist

public abstract ClassifierOptions.Builder setDisplayNamesLocale (String locale)

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

Parameters
locale

public abstract ClassifierOptions.Builder setMaxResults (Integer maxResults)

Sets the optional maximum number of top-scored classification results to return.

If not set, all available results are returned. If set, must be > 0.

Parameters
maxResults

public abstract ClassifierOptions.Builder setScoreThreshold (Float scoreThreshold)

Sets the optional score threshold. Results with score below this value are rejected.

Overrides the score threshold specified in the TFLite Model Metadata, if any.

Parameters
scoreThreshold