useInstanceSegmenter<
F,L>(config,options?):object
Defined in: hooks/useInstanceSegmenter.ts:28
React hook to load and run an instance segmentation model.
This hook manages downloading (if remote URLs are provided) and loading the model assets, compiling them, tracking download progress and load errors, and releasing native memory when the component unmounts or the configuration changes.
For imperative usage, see createInstanceSegmenter.
F extends "xyxy" | "xywh" | "cxcywh"
The bounding box format.
L
The class labels type.
InstanceSegmenterModel<F, L>
The instance segmentation model configuration. See InstanceSegmenterModel.
Load and caching options. See ResourceOptions.
object
The same object as InstanceSegmenter (without dispose),
combined with loading state, download progress, and labels.
downloadProgress:
number
error:
Error|undefined
isReady:
boolean=!!model
labels: readonly
L[] =config.modelOpts.labels
resource:
InstanceSegmenterModel<F,L> |undefined
segmentInstances: (
input,options?) =>Promise<InstanceSegmentationResult<F,L>[]> |undefined=model.segmentInstances
segmentInstancesWorklet: (
input,options?) =>InstanceSegmentationResult<F,L>[] |undefined=model.segmentInstancesWorklet