Skip to main content
Version: 0.10.0

Function: useKeypointDetector()

useKeypointDetector<F, L>(config, options?): object

Defined in: hooks/useKeypointDetector.ts:28

React hook to load and run a keypoint 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 createKeypointDetector.

Type Parameters

F

F extends "xyxy" | "xywh" | "cxcywh"

The bounding box format.

L

L extends PropertyKey

The landmark labels type.

Parameters

config

KeypointDetectorModel<F, L>

The keypoint detection model configuration. See KeypointDetectorModel.

options?

ResourceOptions

Load and caching options. See ResourceOptions.

Returns

object

The same object as KeypointDetector (without dispose), combined with loading state, download progress, and landmarks.

detectKeypoints

detectKeypoints: any = model.detectKeypoints

detectKeypointsWorklet

detectKeypointsWorklet: any = model.detectKeypointsWorklet

downloadProgress

downloadProgress: any

error

error: any

isReady

isReady: boolean = !!model

landmarks

landmarks: readonly L[] = config.modelOpts.landmarks

resource

resource: any

See

KeypointDetector