Skip to main content
Version: 0.10.0

Function: createInstanceSegmenter()

createInstanceSegmenter<F, L>(config, runtime?): Promise<InstanceSegmenter<F, L>>

Defined in: extensions/cv/tasks/instanceSegmentation.ts:166

Creates an instance segmenter runner for executing local Instance Segmentation models.

It validates model input/output tensor shapes and types, pre-allocates execution and auxiliary tensors, sets up an image preprocessor, and returns execution and resource management controls.

Type Parameters

F

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

The bounding box format type.

L

L

The label type.

Parameters

config

InstanceSegmenterModel<F, L>

Model configuration containing path and options. See InstanceSegmenterModel.

runtime?

any

Optional worklet runtime thread on which to run the model execution.

Returns

Promise<InstanceSegmenter<F, L>>

A promise resolving to the instantiated InstanceSegmenter runner.

Throws

With code LOAD_FAILED if model fails to load, or SCHEMA_MISMATCH if model schema does not match instance segmentation spec.