Skip to main content
Version: Next

Function: useDepthEstimator()

useDepthEstimator(config, options?): object

Defined in: hooks/useDepthEstimator.ts:25

React hook to load and run a depth estimation 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 createDepthEstimator.

Parameters​

config​

DepthEstimatorModel

The depth estimation model configuration. See DepthEstimatorModel.

options?​

ResourceOptions

Load and caching options. See ResourceOptions.

Returns​

object

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

downloadProgress​

downloadProgress: any

error​

error: any

estimateDepth​

estimateDepth: any = model.estimateDepth

estimateDepthWorklet​

estimateDepthWorklet: any = model.estimateDepthWorklet

isReady​

isReady: boolean = !!model

resource​

resource: any

See​

DepthEstimator