InteractiveSegmenterResult class

The output result of InteractiveSegmenter.

Signature:

export declare class InteractiveSegmenterResult 

Constructors

Constructor Modifiers Description
(constructor)(confidenceMasks, categoryMask, qualityScores) Constructs a new instance of the InteractiveSegmenterResult class

Properties

Property Modifiers Type Description
categoryMask MPMask | undefined A category mask represented as a Uint8ClampedArray or WebGLTexture-backed MPImage where each pixel represents the class which the pixel in the original image was predicted to belong to.
confidenceMasks MPMask[] | undefined Multiple masks represented as Float32Array or WebGLTexture-backed MPImages where, for each mask, each pixel represents the prediction confidence, usually in the [0, 1] range.
qualityScores number[] | undefined The quality scores of the result masks, in the range of [0, 1]. Defaults to 1 if the model doesn't output quality scores. Each element corresponds to the score of the category in the model outputs.

Methods

Method Modifiers Description
close() Frees the resources held by the category and confidence masks.

InteractiveSegmenterResult.(constructor)

Constructs a new instance of the InteractiveSegmenterResult class

Signature:

constructor(
    confidenceMasks?: MPMask[] | undefined, 
    categoryMask?: MPMask | undefined, 
    qualityScores?: number[] | undefined);

Parameters

Parameter Type Description
confidenceMasks MPMask[] | undefined
categoryMask MPMask | undefined
qualityScores number[] | undefined

InteractiveSegmenterResult.categoryMask

A category mask represented as a Uint8ClampedArray or WebGLTexture-backed MPImage where each pixel represents the class which the pixel in the original image was predicted to belong to.

Signature:

readonly categoryMask?: MPMask | undefined;

InteractiveSegmenterResult.confidenceMasks

Multiple masks represented as Float32Array or WebGLTexture-backed MPImages where, for each mask, each pixel represents the prediction confidence, usually in the [0, 1] range.

Signature:

readonly confidenceMasks?: MPMask[] | undefined;

InteractiveSegmenterResult.qualityScores

The quality scores of the result masks, in the range of [0, 1]. Defaults to 1 if the model doesn't output quality scores. Each element corresponds to the score of the category in the model outputs.

Signature:

readonly qualityScores?: number[] | undefined;

InteractiveSegmenterResult.close()

Frees the resources held by the category and confidence masks.

Signature:

close(): void;

Returns:

void