ImageSegmenterResult

public abstract class ImageSegmenterResult implements TaskResult

Represents the segmentation results generated by ImageSegmenter.

Summary

Public constructors

Public methods

abstract Optional<MPImage>
abstract Optional<List<MPImage>>
static ImageSegmenterResult
create(
    Optional<List<MPImage>> confidenceMasks,
    Optional<MPImage> categoryMask,
    List<Float> qualityScores,
    long timestampMs
)

Creates an ImageSegmenterResult instance from a list of segmentation MPImage.

abstract List<Float>
abstract long

Returns the timestamp that is associated with the task result object.

Public constructors

ImageSegmenterResult

public ImageSegmenterResult()

Public methods

categoryMask

public abstract Optional<MPImage> categoryMask()

confidenceMasks

public abstract Optional<List<MPImage>> confidenceMasks()

create

public static ImageSegmenterResult create(
    Optional<List<MPImage>> confidenceMasks,
    Optional<MPImage> categoryMask,
    List<Float> qualityScores,
    long timestampMs
)

Creates an ImageSegmenterResult instance from a list of segmentation MPImage.

Parameters
Optional<List<MPImage>> confidenceMasks

an Optional of List of MPImage in IMAGE_FORMAT_VEC32F1 format representing the confidence masks, where, for each mask, each pixel represents the prediction confidence, usually in the [0, 1] range.

Optional<MPImage> categoryMask

an Optional MPImage in IMAGE_FORMAT_ALPHA format representing a category mask, where each pixel represents the class which the pixel in the original image was predicted to belong to.

List<Float> 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.

long timestampMs

a timestamp for this result.

qualityScores

public abstract List<Float> qualityScores()

timestampMs

public abstract long timestampMs()

Returns the timestamp that is associated with the task result object.