Skip to content

sam2

Sam2EmbeddingResponse

Bases: BaseModel

SAM embedding response.

Attributes:

Name Type Description
embeddings Union[List[List[List[List[float]]]], Any]

The SAM embedding.

time float

The time in seconds it took to produce the embeddings including preprocessing.

Source code in inference/core/entities/responses/sam2.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class Sam2EmbeddingResponse(BaseModel):
    """SAM embedding response.

    Attributes:
        embeddings (Union[List[List[List[List[float]]]], Any]): The SAM embedding.
        time (float): The time in seconds it took to produce the embeddings including preprocessing.
    """

    image_id: str = Field(description="Image id embeddings are cached to")
    time: float = Field(
        description="The time in seconds it took to produce the embeddings including preprocessing"
    )

Sam2SegmentationPrediction

Bases: BaseModel

SAM segmentation prediction.

Attributes:

Name Type Description
masks Union[List[List[List[int]]], Any]

The set of output masks.

low_res_masks Union[List[List[List[int]]], Any]

The set of output low-resolution masks.

time float

The time in seconds it took to produce the segmentation including preprocessing.

Source code in inference/core/entities/responses/sam2.py
20
21
22
23
24
25
26
27
28
29
30
31
32
class Sam2SegmentationPrediction(BaseModel):
    """SAM segmentation prediction.

    Attributes:
        masks (Union[List[List[List[int]]], Any]): The set of output masks.
        low_res_masks (Union[List[List[List[int]]], Any]): The set of output low-resolution masks.
        time (float): The time in seconds it took to produce the segmentation including preprocessing.
    """

    masks: List[List[List[int]]] = Field(
        description="The set of points for output mask as polygon. Each element of list represents single point.",
    )
    confidence: float = Field(description="Masks confidences")