Add exports to ImageSegmenterResult and InteractiveSegmenterResult
PiperOrigin-RevId: 565138661
This commit is contained in:
parent
7b091dbe53
commit
50bd79a317
|
@ -23,22 +23,28 @@ export class ImageSegmenterResult {
|
||||||
* Multiple masks represented as `Float32Array` or `WebGLTexture`-backed
|
* Multiple masks represented as `Float32Array` or `WebGLTexture`-backed
|
||||||
* `MPImage`s where, for each mask, each pixel represents the prediction
|
* `MPImage`s where, for each mask, each pixel represents the prediction
|
||||||
* confidence, usually in the [0, 1] range.
|
* confidence, usually in the [0, 1] range.
|
||||||
|
* @export
|
||||||
*/
|
*/
|
||||||
readonly confidenceMasks?: MPMask[],
|
readonly confidenceMasks?: MPMask[],
|
||||||
/**
|
/**
|
||||||
* A category mask represented as a `Uint8ClampedArray` or
|
* A category mask represented as a `Uint8ClampedArray` or
|
||||||
* `WebGLTexture`-backed `MPImage` where each pixel represents the class
|
* `WebGLTexture`-backed `MPImage` where each pixel represents the class
|
||||||
* which the pixel in the original image was predicted to belong to.
|
* which the pixel in the original image was predicted to belong to.
|
||||||
|
* @export
|
||||||
*/
|
*/
|
||||||
readonly categoryMask?: MPMask,
|
readonly categoryMask?: MPMask,
|
||||||
/**
|
/**
|
||||||
* The quality scores of the result masks, in the range of [0, 1].
|
* 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
|
* Defaults to `1` if the model doesn't output quality scores. Each
|
||||||
* element corresponds to the score of the category in the model outputs.
|
* element corresponds to the score of the category in the model outputs.
|
||||||
|
* @export
|
||||||
*/
|
*/
|
||||||
readonly qualityScores?: number[]) {}
|
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 {
|
close(): void {
|
||||||
this.confidenceMasks?.forEach(m => {
|
this.confidenceMasks?.forEach(m => {
|
||||||
m.close();
|
m.close();
|
||||||
|
@ -46,3 +52,5 @@ export class ImageSegmenterResult {
|
||||||
this.categoryMask?.close();
|
this.categoryMask?.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,22 +23,28 @@ export class InteractiveSegmenterResult {
|
||||||
* Multiple masks represented as `Float32Array` or `WebGLTexture`-backed
|
* Multiple masks represented as `Float32Array` or `WebGLTexture`-backed
|
||||||
* `MPImage`s where, for each mask, each pixel represents the prediction
|
* `MPImage`s where, for each mask, each pixel represents the prediction
|
||||||
* confidence, usually in the [0, 1] range.
|
* confidence, usually in the [0, 1] range.
|
||||||
|
* @export
|
||||||
*/
|
*/
|
||||||
readonly confidenceMasks?: MPMask[],
|
readonly confidenceMasks?: MPMask[],
|
||||||
/**
|
/**
|
||||||
* A category mask represented as a `Uint8ClampedArray` or
|
* A category mask represented as a `Uint8ClampedArray` or
|
||||||
* `WebGLTexture`-backed `MPImage` where each pixel represents the class
|
* `WebGLTexture`-backed `MPImage` where each pixel represents the class
|
||||||
* which the pixel in the original image was predicted to belong to.
|
* which the pixel in the original image was predicted to belong to.
|
||||||
|
* @export
|
||||||
*/
|
*/
|
||||||
readonly categoryMask?: MPMask,
|
readonly categoryMask?: MPMask,
|
||||||
/**
|
/**
|
||||||
* The quality scores of the result masks, in the range of [0, 1].
|
* 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
|
* Defaults to `1` if the model doesn't output quality scores. Each
|
||||||
* element corresponds to the score of the category in the model outputs.
|
* element corresponds to the score of the category in the model outputs.
|
||||||
|
* @export
|
||||||
*/
|
*/
|
||||||
readonly qualityScores?: number[]) {}
|
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 {
|
close(): void {
|
||||||
this.confidenceMasks?.forEach(m => {
|
this.confidenceMasks?.forEach(m => {
|
||||||
m.close();
|
m.close();
|
||||||
|
@ -46,3 +52,5 @@ export class InteractiveSegmenterResult {
|
||||||
this.categoryMask?.close();
|
this.categoryMask?.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user