github albumentations-team/albumentations 1.4.21
Albumentations 1.4.21 Release Notes

16 hours ago
  • Support Our Work
  • Transforms
  • Core
  • Benchmark
  • Speedups

Support Our Work

  1. Love the library? You can contribute to its development by becoming a sponsor for the library. Your support is invaluable, and every contribution makes a difference.
  2. Haven't starred our repo yet? Show your support with a ⭐! It's just only one mouse click away.
  3. Got ideas or facing issues? We'd love to hear from you. Share your thoughts in our issues or join the conversation on our Discord server

Transforms

Auto padding in crops

Added option to pad the image if crop size is larger than the crop size

Old way

[
A.PadIfNeeded(min_height=1024, min_width=1024, p=1),
A.RandomCrop(height=1204, width=1024, p=1)
]

New way:

A.RandomCrop(height=1204, width=1024, p=1, pad_if_needed=True)

Works for:

You may also use it to pad image to a desired size.

Core

Random state

Now random state for the pipeline does not depend on the global random state

Before

random.seed(seed)
np.random.seed(seed)

transform = A.Compose(...) 

Now

transform = A.Compose(seed=seed, ...)

or

transform = A.Compose(...)
transform.set_random_seed(seed)

Saving used parameters

Now you can get exact parameters that were used in the pipeline on a given sample with

transform = A.Compose(save_applied_params=True, ...)

result = transform(image=image, bboxes=bboxes, mask=mask, keypoints=keypoints)

print(result["applied_transforms"])

Benchmark

Moved benchmark to a separate repo

https://github.com/albumentations-team/benchmark/

Current result for uint8 images:

Transform albumentations
1.4.20
augly
1.0.0
imgaug
0.4.0
kornia
0.7.3
torchvision
0.20.0
HorizontalFlip 8325 ± 955 4807 ± 818 6042 ± 788 390 ± 106 914 ± 67
VerticalFlip 20493 ± 1134 9153 ± 1291 10931 ± 1844 1212 ± 402 3198 ± 200
Rotate 1272 ± 12 1119 ± 41 1136 ± 218 143 ± 11 181 ± 11
Affine 967 ± 3 - 774 ± 97 147 ± 9 130 ± 12
Equalize 961 ± 4 - 581 ± 54 152 ± 19 479 ± 12
RandomCrop80 118946 ± 741 25272 ± 1822 11503 ± 441 1510 ± 230 32109 ± 1241
ShiftRGB 1873 ± 252 - 1582 ± 65 - -
Resize 2365 ± 153 611 ± 78 1806 ± 63 232 ± 24 195 ± 4
RandomGamma 8608 ± 220 - 2318 ± 269 108 ± 13 -
Grayscale 3050 ± 597 2720 ± 932 1681 ± 156 289 ± 75 1838 ± 130
RandomPerspective 410 ± 20 - 554 ± 22 86 ± 11 96 ± 5
GaussianBlur 1734 ± 204 242 ± 4 1090 ± 65 176 ± 18 79 ± 3
MedianBlur 862 ± 30 - 813 ± 30 5 ± 0 -
MotionBlur 2975 ± 52 - 612 ± 18 73 ± 2 -
Posterize 5214 ± 101 - 2097 ± 68 430 ± 49 3196 ± 185
JpegCompression 845 ± 61 778 ± 5 459 ± 35 71 ± 3 625 ± 17
GaussianNoise 147 ± 10 67 ± 2 206 ± 11 75 ± 1 -
Elastic 171 ± 15 - 235 ± 20 1 ± 0 2 ± 0
Clahe 423 ± 10 - 335 ± 43 94 ± 9 -
CoarseDropout 11288 ± 609 - 671 ± 38 536 ± 87 -
Blur 4816 ± 59 246 ± 3 3807 ± 325 - -
ColorJitter 536 ± 41 255 ± 13 - 55 ± 18 46 ± 2
Brightness 4443 ± 84 1163 ± 86 - 472 ± 101 429 ± 20
Contrast 4398 ± 143 736 ± 79 - 425 ± 52 335 ± 35
RandomResizedCrop 2952 ± 24 - - 287 ± 58 511 ± 10
Normalize 1016 ± 84 - - 626 ± 40 519 ± 12
PlankianJitter 1844 ± 208 - - 813 ± 211 -

Speedups

Don't miss a new albumentations release

NewReleases is sending notifications on new releases.