Skip to content

pixano_inference.pydantic.tasks.image.mask_generation

Pydantic models for image mask generation task.

ImageMaskGenerationInput

Bases: BaseModel

Input for image mask generation.

Attributes:

Name Type Description
image str | Path

Image for image mask generation.

image_embedding NDArrayFloat | LanceVector | None

Image embedding for the image mask generation.

high_resolution_features list[NDArrayFloat] | list[LanceVector] | None

High resolution features for the image mask generation.

points list[list[list[int]]] | None

Points for the image mask generation. The first fimension is the number of prompts the second the number of points per mask and the third the coordinates of the points.

labels list[list[int]] | None

Labels for the image mask generation. The first fimension is the number of prompts, the second the number of labels per mask.

boxes list[list[int]] | None

Boxes for the image mask generation. The first fimension is the number of prompts, the second the coordinates of the boxes.

num_multimask_outputs int

Number of masks to generate per prediction.

multimask_output bool

Whether to generate multiple masks per prediction.

return_image_embedding bool

Whether to return the image embeddings.

ImageMaskGenerationOutput

Bases: BaseModel

Output for image mask generation.

Attributes:

Name Type Description
masks list[list[CompressedRLE]]

Generated masks. The first dimension is the number of predictions, the second the number of masks per prediction.

scores NDArrayFloat

Scores of the masks. The first dimension is the number of predictions, the second the number of masks per prediction.

image_embedding NDArrayFloat | None

Image embeddings.

high_resolution_features list[NDArrayFloat] | None

High resolution features.

ImageMaskGenerationRequest

Bases: BaseRequest, ImageMaskGenerationInput

Request for image mask generation.

to_input()

Convert the request to the input.

Source code in pixano_inference/pydantic/tasks/image/mask_generation.py
def to_input(self) -> ImageMaskGenerationInput:
    """Convert the request to the input."""
    return self.to_base_model(ImageMaskGenerationInput)

ImageMaskGenerationResponse

Bases: BaseResponse

Response for image mask generation.

Attributes:

Name Type Description
data ImageMaskGenerationOutput

Output of the generation.