pixano_inference.impls.sam2.image
SAM2 image segmentation model.
Sam2ImageModel(config)
Bases: SegmentationModel
Native Ray Serve model for SAM2 image mask generation.
model_params contract:
path(str, required): HuggingFace model ID or local checkpoint path.torch_dtype(str, default"bfloat16"): Torch dtype for autocast.compile(bool, defaultTrue): Whether totorch.compilethe model.
Any remaining keys are forwarded to build_sam2 / build_sam2_hf.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ModelDeploymentConfig
|
Model deployment configuration. |
required |
Source code in pixano_inference/impls/sam2/image.py
metadata
property
Model metadata including path and dtype.
load_model()
Load the SAM2 image predictor.
Source code in pixano_inference/impls/sam2/image.py
predict(input)
Run SAM2 image mask generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
SegmentationInput
|
Segmentation input with image, prompts, and options. |
required |
Returns:
| Type | Description |
|---|---|
SegmentationOutput
|
Segmentation output with masks, scores, and optionally embeddings. |
Source code in pixano_inference/impls/sam2/image.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
unload()
Free resources.