useObjectDetector<
F,L>(config,options?):object
Defined in: hooks/useObjectDetector.ts:28
React hook to load and run an object detection 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 createObjectDetector.
F extends "xyxy" | "xywh" | "cxcywh"
The bounding box format.
L
The type representing the object class labels.
ObjectDetectorModel<F, L>
The object detection model configuration. See ObjectDetectorModel.
Load and caching options. See ResourceOptions.
object
The same object as ObjectDetector (without dispose),
combined with loading state, download progress, and labels.
detectObjects: (
input,options?) =>Promise<ObjectDetection<F,L>[]> |undefined=model.detectObjects
detectObjectsWorklet: (
input,options?) =>ObjectDetection<F,L>[] |undefined=model.detectObjectsWorklet
downloadProgress:
number
error:
Error|undefined
isReady:
boolean=!!model
labels: readonly
L[] =config.modelOpts.labels
resource:
ObjectDetectorModel<F,L> |undefined