Post processing
adjust_bbox_coordinates_to_client_scaling_factor(bbox, scaling_factor)
¶
Adjust a bbox coordinates to the client scaling factor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bbox
|
dict
|
The bbox to adjust. |
required |
scaling_factor
|
float
|
The scaling factor. |
required |
Returns:
Type | Description |
---|---|
dict
|
The adjusted bbox. |
Source code in inference_sdk/http/utils/post_processing.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
|
adjust_object_detection_predictions_to_client_scaling_factor(predictions, scaling_factor)
¶
Adjust a list of object detection predictions to the client scaling factor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
predictions
|
List[dict]
|
The list of object detection predictions. |
required |
scaling_factor
|
float
|
The scaling factor. |
required |
Returns:
Type | Description |
---|---|
List[dict]
|
The adjusted list of object detection predictions. |
Source code in inference_sdk/http/utils/post_processing.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
adjust_points_coordinates_to_client_scaling_factor(points, scaling_factor)
¶
Adjust a list of points coordinates to the client scaling factor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points
|
List[dict]
|
The list of points. |
required |
scaling_factor
|
float
|
The scaling factor. |
required |
Returns:
Type | Description |
---|---|
List[dict]
|
The adjusted list of points. |
Source code in inference_sdk/http/utils/post_processing.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
|
adjust_prediction_to_client_scaling_factor(prediction, scaling_factor)
¶
Adjust a prediction to the client scaling factor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prediction
|
dict
|
The prediction to adjust. |
required |
scaling_factor
|
Optional[float]
|
The scaling factor. |
required |
Returns:
Type | Description |
---|---|
dict
|
The adjusted prediction. |
Source code in inference_sdk/http/utils/post_processing.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|
adjust_prediction_with_bbox_and_points_to_client_scaling_factor(predictions, scaling_factor, points_key)
¶
Adjust a list of predictions with bbox and points to the client scaling factor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
predictions
|
List[dict]
|
The list of predictions. |
required |
scaling_factor
|
float
|
The scaling factor. |
required |
points_key
|
str
|
The key of the points. |
required |
Returns:
Type | Description |
---|---|
List[dict]
|
The adjusted list of predictions. |
Source code in inference_sdk/http/utils/post_processing.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
|
combine_clip_embeddings(embeddings)
¶
Combine clip embeddings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
embeddings
|
Union[dict, List[dict]]
|
The embeddings to combine. |
required |
Returns:
Type | Description |
---|---|
List[dict]
|
The combined embeddings. |
Source code in inference_sdk/http/utils/post_processing.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
|
combine_gaze_detections(detections)
¶
Combine gaze detections.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
detections
|
Union[dict, List[Union[dict, List[dict]]]]
|
The detections to combine. |
required |
Returns:
Type | Description |
---|---|
Union[dict, List[Dict]]
|
The combined detections. |
Source code in inference_sdk/http/utils/post_processing.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
|
decode_workflow_output(workflow_output, expected_format)
¶
Decode a workflow output.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workflow_output
|
Dict[str, Any]
|
The workflow output to decode. |
required |
expected_format
|
VisualisationResponseFormat
|
The expected format of the workflow output. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The decoded workflow output. |
Source code in inference_sdk/http/utils/post_processing.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
decode_workflow_output_image(value, expected_format)
¶
Decode a workflow output image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Dict[str, Any]
|
The value to decode. |
required |
expected_format
|
VisualisationResponseFormat
|
The expected format of the value. |
required |
Returns:
Type | Description |
---|---|
Union[str, ndarray, Image]
|
The decoded value. |
Source code in inference_sdk/http/utils/post_processing.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
decode_workflow_output_list(elements, expected_format)
¶
Decode a list of workflow outputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
elements
|
List[Any]
|
The list of elements to decode. |
required |
expected_format
|
VisualisationResponseFormat
|
The expected format of the elements. |
required |
Returns:
Type | Description |
---|---|
List[Any]
|
The decoded list of elements. |
Source code in inference_sdk/http/utils/post_processing.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
decode_workflow_outputs(workflow_outputs, expected_format)
¶
Decode a list of workflow outputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workflow_outputs
|
List[Dict[str, Any]]
|
The list of workflow outputs. |
required |
expected_format
|
VisualisationResponseFormat
|
The expected format of the workflow outputs. |
required |
Returns:
Type | Description |
---|---|
List[Dict[str, Any]]
|
The decoded list of workflow outputs. |
Source code in inference_sdk/http/utils/post_processing.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
filter_model_descriptions(descriptions, model_id)
¶
Filter model descriptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
descriptions
|
List[ModelDescription]
|
The list of model descriptions. |
required |
model_id
|
str
|
The model ID. |
required |
Returns:
Type | Description |
---|---|
Optional[ModelDescription]
|
The filtered model description. |
Source code in inference_sdk/http/utils/post_processing.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
|
is_workflow_image(value)
¶
Check if the value is a workflow image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Any
|
The value to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the value is a workflow image, False otherwise. |
Source code in inference_sdk/http/utils/post_processing.py
112 113 114 115 116 117 118 119 120 121 |
|
predictions_should_not_be_post_processed(prediction)
¶
Check if the predictions should not be post-processed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prediction
|
dict
|
The prediction to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the predictions should not be post-processed, False otherwise. |
Source code in inference_sdk/http/utils/post_processing.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
response_contains_jpeg_image(response)
¶
Check if the response contains a JPEG image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
response
|
Response
|
The response to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the response contains a JPEG image, False otherwise. |
Source code in inference_sdk/http/utils/post_processing.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
transform_base64_visualisation(visualisation, expected_format)
¶
Transform a base64 visualisation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
visualisation
|
str
|
The visualisation to transform. |
required |
expected_format
|
VisualisationResponseFormat
|
The expected format of the visualisation. |
required |
Returns:
Type | Description |
---|---|
Union[str, ndarray, Image]
|
The transformed visualisation. |
Source code in inference_sdk/http/utils/post_processing.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
transform_visualisation_bytes(visualisation, expected_format)
¶
Transform a visualisation bytes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
visualisation
|
bytes
|
The visualisation to transform. |
required |
expected_format
|
VisualisationResponseFormat
|
The expected format of the visualisation. |
required |
Returns:
Type | Description |
---|---|
Union[str, ndarray, Image]
|
The transformed visualisation. |
Source code in inference_sdk/http/utils/post_processing.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|