Add exports to ImageSegmenterResult and InteractiveSegmenterResult

PiperOrigin-RevId: 565138661
This commit is contained in:
Sebastian Schmidt 2023-09-13 13:08:59 -07:00 committed by Copybara-Service
parent 7b091dbe53
commit 50bd79a317
2 changed files with 18 additions and 2 deletions

View File

@ -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();
}
}

View File

@ -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();
}
}