Interface: InstanceSegmentationType<L>
Defined in: types/instanceSegmentation.ts:153
Return type for the useInstanceSegmentation hook.
Manages the state and operations for instance segmentation models.
Type Parameters
L
L extends LabelEnum
The label map type for the model, must conform to LabelEnum.
Properties
downloadProgress
downloadProgress:
number
Defined in: types/instanceSegmentation.ts:172
Represents the download progress of the model binary as a value between 0 and 1.
error
error:
RnExecutorchError|null
Defined in: types/instanceSegmentation.ts:157
Contains the error object if the model failed to load, download, or encountered a runtime error during segmentation.
forward()
forward: (
imageSource,options?) =>Promise<SegmentedInstance<L>[]>
Defined in: types/instanceSegmentation.ts:181
Executes the model's forward pass to perform instance segmentation on the provided image.
Parameters
imageSource
A string (e.g., a file path, URI ) or PixelData representing the image source to be processed.
string | PixelData
options?
InstanceSegmentationOptions<L>
Optional configuration for the segmentation process.
Returns
Promise<SegmentedInstance<L>[]>
A Promise resolving to an array of SegmentedInstance objects.
Throws
If the model is not loaded or is currently processing another image.
getAvailableInputSizes()
getAvailableInputSizes: () => readonly
number[] |undefined
Defined in: types/instanceSegmentation.ts:190
Returns the available input sizes for this model, or undefined if the model accepts single forward input size.
Returns
readonly number[] | undefined
An array of available input sizes, or undefined if not constrained.
isGenerating
isGenerating:
boolean
Defined in: types/instanceSegmentation.ts:167
Indicates whether the model is currently processing an image.
isReady
isReady:
boolean
Defined in: types/instanceSegmentation.ts:162
Indicates whether the instance segmentation model is loaded and ready to process images.
runOnFrame
runOnFrame: (
frame,isFrontCamera,options?) =>SegmentedInstance<L>[] |null
Defined in: types/instanceSegmentation.ts:205
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
Whether the front camera is active (for mirroring correction).
Param
Optional configuration for the segmentation process.
Returns
Array of SegmentedInstance objects representing detected items in the frame.