AI-generated Key Takeaways
-
PoseDetectorOptions.Builder
helps configure settings for pose detection, like choosing between processing single images or a stream of related images (e.g., from a camera). -
It allows customization of the detector mode for handling either single images or continuous streams, influencing how input is processed.
-
Developers can set preferred hardware configurations for pose detection, prioritizing speed or accuracy based on device capabilities, with options like CPU, GPU, or a combination of both.
-
It offers flexibility in task execution by enabling the use of a custom Executor or relying on an internal background thread pool for processing pose detection tasks.
-
Using the
build()
method on the builder, developers can create aPoseDetectorOptions
instance with the desired settings to initialize the pose detector.
Builder for PoseDetectorOptions
.
Public Constructor Summary
Builder()
|
Public Method Summary
PoseDetectorOptions |
build()
|
PoseDetectorOptions.Builder |
setDetectorMode(int detectorMode)
Set the detector mode to be used, depending on what kind of input is being
processed.
|
PoseDetectorOptions.Builder | |
PoseDetectorOptions.Builder |
setPreferredHardwareConfigs(int config, int... moreConfigs)
Sets preferred
PoseDetectorOptionsBase.HardwareConfig s.
|
Inherited Method Summary
Public Constructors
public Builder ()
Public Methods
public PoseDetectorOptions build ()
public PoseDetectorOptions.Builder setDetectorMode (int detectorMode)
Set the detector mode to be used, depending on what kind of input is being
processed. The
PoseDetector.process(InputImage)
and
PoseDetector.process(MlImage)
call will treat the inputs differently based
on this mode.
Default:
PoseDetectorOptionsBase.STREAM_MODE
Use
PoseDetectorOptionsBase.STREAM_MODE
for input frames consisting of related
images, for example, frames from a user's camera. This mode uses tracking, which
provides a speed-up when the frames consists of related images without much of a scene
change.
Use
PoseDetectorOptionsBase.SINGLE_IMAGE_MODE
for a single still image, or when
the input frames are unrelated.
Parameters
detectorMode | the detector mode used, depending on what kind of input is being processed. One
of
PoseDetectorOptionsBase.STREAM_MODE or
PoseDetectorOptionsBase.SINGLE_IMAGE_MODE . |
---|
public PoseDetectorOptions.Builder setExecutor (Executor executor)
public PoseDetectorOptions.Builder setPreferredHardwareConfigs (int config, int... moreConfigs)
Sets preferred
PoseDetectorOptionsBase.HardwareConfig
s.
Available options: PoseDetectorOptionsBase.CPU
,
PoseDetectorOptionsBase.CPU_GPU
.
ML Kit will take availability, stability, correctness and latency of each config into consideration and pick the best one from the preferred configs. If none of the preferred configs is applicable, the default CPU config will be used automatically as fallback.
Example usages:
- To let ML Kit pick the best config, no need to call this API.
- If don't want to enable any acceleration, pass in only
PoseDetectorOptionsBase.CPU
. - If want to use GPU to offload CPU, even if GPU could be slower, pass in only
PoseDetectorOptionsBase.CPU_GPU
.