Skip to content

pixano_inference.pydantic.tasks.video.mask_generation

Pydantic models for mask generation task.

VideoMaskGenerationInput

Bases: BaseModel

Input for mask generation.

Attributes:

Name Type Description
video str | Path | list[str] | list[Path]

Can be a path to the video or list of paths to the frames or a base64 encoded video or a list of base64 encoded frames.

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

Points for the mask generation. The first fimension is the number of objects the second the number of points for each object and the third the coordinates of the points.

labels list[list[int]] | None

Labels for the mask generation. The first fimension is the number of objects, the second the number of labels for each object.

boxes list[list[int]] | None

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

objects_ids list[int]

IDs of the objects to generate masks for.

frame_indexes list[int]

Indexes of the frames where the objects are located.

VideoMaskGenerationOutput

Bases: BaseModel

Output for mask generation.

Attributes:

Name Type Description
objects_ids list[int]

IDs of the objects.

frame_indexes list[int]

Indexes of the frames where the objects are located.

masks list[CompressedRLE]

Masks for the objects.

VideoMaskGenerationRequest

Bases: BaseRequest, VideoMaskGenerationInput

Request for mask generation.

to_input()

Convert the request to the input.

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

VideoMaskGenerationResponse

Bases: BaseResponse

Response for mask generation.

Attributes:

Name Type Description
data VideoMaskGenerationOutput

Output of the generation.