Skip to main content
Version: Next

Interface: ObjectDetectionType<L>

Defined in: types/objectDetection.ts:85

Return type for the useObjectDetection hook. Manages the state and operations for Computer Vision object detection tasks.

Type Parameters

L

L extends LabelEnum

The LabelEnum representing the model's class labels.

Properties

downloadProgress

downloadProgress: number

Defined in: types/objectDetection.ts:104

Represents the download progress of the model binary as a value between 0 and 1.


error

error: RnExecutorchError | null

Defined in: types/objectDetection.ts:89

Contains the error object if the model failed to load, download, or encountered a runtime error during detection.


forward()

forward: (input, detectionThreshold?) => Promise<Detection<L>[]>

Defined in: types/objectDetection.ts:114

Executes the model's forward pass with automatic input type detection.

Parameters

input

Image source (string path/URI or PixelData object)

string | PixelData

detectionThreshold?

number

An optional number between 0 and 1 representing the minimum confidence score. Default is 0.7.

Returns

Promise<Detection<L>[]>

A Promise that resolves to an array of Detection objects.

Throws

If the model is not loaded or is currently processing another image.


isGenerating

isGenerating: boolean

Defined in: types/objectDetection.ts:99

Indicates whether the model is currently processing an image.


isReady

isReady: boolean

Defined in: types/objectDetection.ts:94

Indicates whether the object detection model is loaded and ready to process images.


runOnFrame

runOnFrame: (frame, detectionThreshold) => Detection<L>[] | null

Defined in: types/objectDetection.ts:132

Synchronous worklet function for real-time VisionCamera frame processing. Automatically handles native buffer extraction and cleanup.

Use this for VisionCamera frame processing in worklets. For async processing, use forward() instead.

Available after model is loaded (isReady: true).

Param

VisionCamera Frame object

Param

The threshold for detection sensitivity.

Returns

Array of Detection objects representing detected items in the frame.