AI-generated Key Takeaways
-
CustomObjectDetectorOptions.Builder
helps create customized object detection options using local or remote models. -
It allows enabling object classification and multiple object detection within an image.
-
Developers can configure detection mode, classification confidence threshold, and maximum labels per object.
-
A custom Executor can be set for task execution, otherwise, an internal background thread pool is used.
-
Calling
build()
on the builder creates aCustomObjectDetectorOptions
instance with the specified settings.
Builder of CustomObjectDetectorOptions
.
Public Constructor Summary
Builder(LocalModel localModel)
Creates a new builder to build
CustomObjectDetectorOptions with LocalModel .
|
|
Builder(CustomRemoteModel remoteModel)
Creates a new builder to build
CustomObjectDetectorOptions with CustomRemoteModel .
|
Public Method Summary
CustomObjectDetectorOptions |
build()
|
CustomObjectDetectorOptions.Builder |
enableClassification()
Enables classification.
|
CustomObjectDetectorOptions.Builder |
enableMultipleObjects()
Enables multiple objects for detection.
|
CustomObjectDetectorOptions.Builder |
setClassificationConfidenceThreshold(float
classificationConfidenceThreshold)
Sets the classification confidence threshold of labels to be detected.
|
CustomObjectDetectorOptions.Builder |
setDetectorMode(int detectorMode)
Sets the
DetectorMode , which contains two modes,
ObjectDetectorOptionsBase.STREAM_MODE and
ObjectDetectorOptionsBase.SINGLE_IMAGE_MODE .
|
CustomObjectDetectorOptions.Builder | |
CustomObjectDetectorOptions.Builder |
setMaxPerObjectLabelCount(int maxPerObjectLabelCount)
Sets the maximum number of labels per object that the detector will return.
|
Inherited Method Summary
Public Constructors
public Builder (LocalModel localModel)
Creates a new builder to build
CustomObjectDetectorOptions
with LocalModel
.
public Builder (CustomRemoteModel remoteModel)
Creates a new builder to build
CustomObjectDetectorOptions
with CustomRemoteModel
.
Public Methods
public CustomObjectDetectorOptions build ()
public CustomObjectDetectorOptions.Builder enableClassification ()
Enables classification.
By default, the classification is off.
public CustomObjectDetectorOptions.Builder enableMultipleObjects ()
Enables multiple objects for detection.
When enabled, the maximum number of detected objects per image is 5.
By default, the detector detects prominent object only.
public CustomObjectDetectorOptions.Builder setClassificationConfidenceThreshold (float classificationConfidenceThreshold)
Sets the classification confidence threshold of labels to be detected.
If not set, any classifier threshold specified by the model’s metadata will be used, or 0.0 will be used if no such metadata or threshold.
public CustomObjectDetectorOptions.Builder setDetectorMode (int detectorMode)
Sets the
DetectorMode
, which contains two modes,
ObjectDetectorOptionsBase.STREAM_MODE
and
ObjectDetectorOptionsBase.SINGLE_IMAGE_MODE
. For more details, please see
comments for
ObjectDetectorOptionsBase.STREAM_MODE
and
ObjectDetectorOptionsBase.SINGLE_IMAGE_MODE
.
By default, it is
ObjectDetectorOptionsBase.STREAM_MODE
.
public CustomObjectDetectorOptions.Builder setExecutor (Executor executor)
public CustomObjectDetectorOptions.Builder setMaxPerObjectLabelCount (int maxPerObjectLabelCount)
Sets the maximum number of labels per object that the detector will return.
If not set, the default value of 10 will be used.