diff --git a/mediapipe/tasks/web/vision/image_segmenter/image_segmenter_result.ts b/mediapipe/tasks/web/vision/image_segmenter/image_segmenter_result.ts index 363cc213d..dc299798d 100644 --- a/mediapipe/tasks/web/vision/image_segmenter/image_segmenter_result.ts +++ b/mediapipe/tasks/web/vision/image_segmenter/image_segmenter_result.ts @@ -23,22 +23,28 @@ export class ImageSegmenterResult { * Multiple masks represented as `Float32Array` or `WebGLTexture`-backed * `MPImage`s where, for each mask, each pixel represents the prediction * confidence, usually in the [0, 1] range. + * @export */ readonly confidenceMasks?: MPMask[], /** * 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. + * @export */ readonly categoryMask?: MPMask, /** * 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. + * @export */ readonly qualityScores?: number[]) {} - /** Frees the resources held by the category and confidence masks. */ + /** + * Frees the resources held by the category and confidence masks. + * @export + */ close(): void { this.confidenceMasks?.forEach(m => { m.close(); @@ -46,3 +52,5 @@ export class ImageSegmenterResult { this.categoryMask?.close(); } } + + diff --git a/mediapipe/tasks/web/vision/interactive_segmenter/interactive_segmenter_result.ts b/mediapipe/tasks/web/vision/interactive_segmenter/interactive_segmenter_result.ts index 3b45d09e7..47dd443c8 100644 --- a/mediapipe/tasks/web/vision/interactive_segmenter/interactive_segmenter_result.ts +++ b/mediapipe/tasks/web/vision/interactive_segmenter/interactive_segmenter_result.ts @@ -23,22 +23,28 @@ export class InteractiveSegmenterResult { * Multiple masks represented as `Float32Array` or `WebGLTexture`-backed * `MPImage`s where, for each mask, each pixel represents the prediction * confidence, usually in the [0, 1] range. + * @export */ readonly confidenceMasks?: MPMask[], /** * 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. + * @export */ readonly categoryMask?: MPMask, /** * 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. + * @export */ readonly qualityScores?: number[]) {} - /** Frees the resources held by the category and confidence masks. */ + /** + * Frees the resources held by the category and confidence masks. + * @export + */ close(): void { this.confidenceMasks?.forEach(m => { m.close(); @@ -46,3 +52,5 @@ export class InteractiveSegmenterResult { this.categoryMask?.close(); } } + +