pixano_inference.impls.sam2.video
SAM2 video tracking model.
Sam2VideoModel(config)
Bases: TrackingModel
Native Ray Serve model for SAM2 video 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.vos_optimized(bool, defaultTrue): Use VOS-optimised predictor.propagate(bool, defaultTrue): Whether to propagate masks across the full video after adding prompts.
Any remaining keys are forwarded to the SAM2 predictor builder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ModelDeploymentConfig
|
Model deployment configuration. |
required |
Source code in pixano_inference/impls/sam2/video.py
metadata
property
Model metadata including path and dtype.
load_model()
Load the SAM2 video predictor.
Source code in pixano_inference/impls/sam2/video.py
predict(input)
Run SAM2 video mask generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
TrackingInput
|
Tracking input with video, prompts, and object IDs. |
required |
Returns:
| Type | Description |
|---|---|
TrackingOutput
|
Tracking output with objects_ids, frame_indexes, and masks. |
Source code in pixano_inference/impls/sam2/video.py
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 194 195 196 197 198 | |
unload()
Free resources.