ClassifierOptions.Builder

public abstract class ClassifierOptions.Builder


Builder for ClassifierOptions.

Summary

Public constructors

Public methods

final ClassifierOptions

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

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.

Public constructors

Builder

public Builder()

Public methods

build

public final ClassifierOptions build()

Validates and builds the ClassifierOptions instance.

Throws
java.lang.IllegalArgumentException

if maxResults is set to a value <= 0.

setCategoryAllowlist

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.

setCategoryDenylist

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.

setDisplayNamesLocale

public abstract ClassifierOptions.Builder setDisplayNamesLocale(String locale)

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

setMaxResults

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.

setScoreThreshold

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.