Processing
CenterCrop
Bases: ClassificationProcess
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size |
int
|
Desired output size of the crop. |
224
|
Source code in V3_2/src/super_gradients/training/processing/processing.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
|
preprocess_image(image)
Crops the given image at the center.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
np.ndarray
|
Image, in (H, W, C) format. |
required |
Returns:
Type | Description |
---|---|
Tuple[np.ndarray, None]
|
The center cropped image. |
Source code in V3_2/src/super_gradients/training/processing/processing.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
|
ComposeProcessing
Bases: Processing
Compose a list of Processing objects into a single Processing object.
Source code in V3_2/src/super_gradients/training/processing/processing.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
postprocess_predictions(predictions, metadata)
Postprocess the model output predictions.
Source code in V3_2/src/super_gradients/training/processing/processing.py
81 82 83 84 85 86 |
|
preprocess_image(image)
Processing an image, before feeding it to the network.
Source code in V3_2/src/super_gradients/training/processing/processing.py
73 74 75 76 77 78 79 |
|
ImagePermute
Bases: Processing
Permute the image dimensions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
permutation |
Tuple[int, int, int]
|
Specify new order of dims. Default value (2, 0, 1) suitable for converting from HWC to CHW format. |
(2, 0, 1)
|
Source code in V3_2/src/super_gradients/training/processing/processing.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
NormalizeImage
Bases: Processing
Normalize an image based on means and standard deviation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mean |
List[float]
|
Mean values for each channel. |
required |
std |
List[float]
|
Standard deviation values for each channel. |
required |
Source code in V3_2/src/super_gradients/training/processing/processing.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
Processing
Bases: ABC
Interface for preprocessing and postprocessing methods that are used to prepare images for a model and process the model's output.
Subclasses should implement the preprocess_image
and postprocess_predictions
methods according to the specific requirements of the model and task.
Source code in V3_2/src/super_gradients/training/processing/processing.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
postprocess_predictions(predictions, metadata)
abstractmethod
Postprocess the model output predictions.
Source code in V3_2/src/super_gradients/training/processing/processing.py
60 61 62 63 |
|
preprocess_image(image)
abstractmethod
Processing an image, before feeding it to the network. Expected to be in (H, W, C) or (H, W).
Source code in V3_2/src/super_gradients/training/processing/processing.py
55 56 57 58 |
|
ProcessingMetadata
dataclass
Bases: ABC
Metadata including information to postprocess a prediction.
Source code in V3_2/src/super_gradients/training/processing/processing.py
25 26 27 |
|
Resize
Bases: ClassificationProcess
Source code in V3_2/src/super_gradients/training/processing/processing.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
|
preprocess_image(image)
Resize an image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
np.ndarray
|
Image, in (H, W, C) format. |
required |
Returns:
Type | Description |
---|---|
Tuple[np.ndarray, None]
|
The resized image. |
Source code in V3_2/src/super_gradients/training/processing/processing.py
319 320 321 322 323 324 325 326 327 328 329 |
|
ReverseImageChannels
Bases: Processing
Reverse the order of the image channels (RGB -> BGR or BGR -> RGB).
Source code in V3_2/src/super_gradients/training/processing/processing.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
preprocess_image(image)
Reverse the channel order of an image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
np.ndarray
|
Image, in (H, W, C) format. |
required |
Returns:
Type | Description |
---|---|
Tuple[np.ndarray, None]
|
Image with reversed channel order. (RGB if input was BGR, BGR if input was RGB) |
Source code in V3_2/src/super_gradients/training/processing/processing.py
111 112 113 114 115 116 117 118 119 120 121 122 |
|
StandardizeImage
Bases: Processing
Standardize image pixel values with img/max_val
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_value |
float
|
Current maximum value of the image pixels. (usually 255) |
255.0
|
Source code in V3_2/src/super_gradients/training/processing/processing.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
preprocess_image(image)
Reverse the channel order of an image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
np.ndarray
|
Image, in (H, W, C) format. |
required |
Returns:
Type | Description |
---|---|
Tuple[np.ndarray, None]
|
Image with reversed channel order. (RGB if input was BGR, BGR if input was RGB) |
Source code in V3_2/src/super_gradients/training/processing/processing.py
139 140 141 142 143 144 145 146 |
|
default_dekr_coco_processing_params()
Processing parameters commonly used for training DEKR on COCO dataset.
Source code in V3_2/src/super_gradients/training/processing/processing.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
|
default_ppyoloe_coco_processing_params()
Processing parameters commonly used for training PPYoloE on COCO dataset. TODO: remove once we load it from the checkpoint
Source code in V3_2/src/super_gradients/training/processing/processing.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
|
default_resnet_imagenet_processing_params()
Processing parameters commonly used for training resnet on Imagenet dataset.
Source code in V3_2/src/super_gradients/training/processing/processing.py
510 511 512 513 514 515 516 517 518 519 |
|
default_yolo_nas_coco_processing_params()
Processing parameters commonly used for training YoloNAS on COCO dataset. TODO: remove once we load it from the checkpoint
Source code in V3_2/src/super_gradients/training/processing/processing.py
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
|
default_yolox_coco_processing_params()
Processing parameters commonly used for training YoloX on COCO dataset. TODO: remove once we load it from the checkpoint
Source code in V3_2/src/super_gradients/training/processing/processing.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
|
get_pretrained_processing_params(model_name, pretrained_weights)
Get the processing parameters for a pretrained model. TODO: remove once we load it from the checkpoint
Source code in V3_2/src/super_gradients/training/processing/processing.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
|