Builder for ImageClassifier.ImageClassifierOptions
.
Public Constructors
Builder()
|
Public Methods
Inherited Methods
Public Constructors
public Builder ()
Public Methods
public final ImageClassifier.ImageClassifierOptions build ()
Validates and builds the ImageClassifier.ImageClassifierOptions
instance. *
Throws
IllegalArgumentException | if any of the set options are invalid. |
---|
public abstract ImageClassifier.ImageClassifierOptions.Builder setBaseOptions (BaseOptions baseOptions)
Sets the BaseOptions
for the image classifier task.
Parameters
baseOptions |
---|
public abstract ImageClassifier.ImageClassifierOptions.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 ImageClassifier.ImageClassifierOptions.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 ImageClassifier.ImageClassifierOptions.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 ImageClassifier.ImageClassifierOptions.Builder setErrorListener (ErrorListener errorListener)
Sets an optional ErrorListener
.
Parameters
errorListener |
---|
public abstract ImageClassifier.ImageClassifierOptions.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 ImageClassifier.ImageClassifierOptions.Builder setResultListener (ResultListener<ImageClassifierResult, MPImage> resultListener)
Sets the OutputHandler.ResultListener
to receive the classification results asynchronously when
the image classifier is in the live stream mode.