Image Benchmark Results 🔗

Image Benchmark Summary

Image Augmentation Benchmarks 🔗

This directory contains benchmark results for image augmentation libraries.

Overview 🔗

The image benchmarks measure the performance of various image augmentation libraries on standard image transformations. The benchmarks are run on a single CPU thread to ensure consistent and comparable results.

Methodology 🔗

  1. Image Loading: Images are loaded using library-specific loaders to ensure optimal format compatibility:

    • OpenCV (BGR → RGB) for Albumentations and imgaug
    • torchvision for PyTorch-based operations
    • PIL for augly
    • Normalized tensors for Kornia
  2. Warmup Phase:

    • Performs adaptive warmup until performance variance stabilizes
    • Uses configurable parameters for stability detection
    • Implements early stopping for slow transforms
    • Maximum time limits prevent hanging on problematic transforms
  3. Measurement Phase:

    • Multiple runs of each transform
    • Measures throughput (images/second)
    • Calculates statistical metrics (median, standard deviation)
  4. Environment Control:

    • Forces single-threaded execution across libraries
    • Captures detailed system information and library versions
    • Monitors thread settings for various numerical libraries

Running the Benchmarks 🔗

To run the image benchmarks:

./run_single.sh -l albumentations -d /path/to/images -o /path/to/output

To run all libraries and generate a comparison:

./run_all.sh -d /path/to/images -o /path/to/output

Benchmark Results 🔗

Image Benchmark Results 🔗

System Information 🔗

  • Platform: macOS-15.1-arm64-arm-64bit
  • Processor: arm
  • CPU Count: 16
  • Python Version: 3.12.8

Benchmark Parameters 🔗

  • Number of images: 2000
  • Runs per transform: 5
  • Max warmup iterations: 1000

Library Versions 🔗

  • albumentations: 2.0.4
  • augly: 1.0.0
  • imgaug: 0.4.0
  • kornia: 0.8.0
  • torchvision: 0.20.1

Performance Comparison 🔗

Number shows how many uint8 images per second can be processed on one CPU thread. Larger is better. The Speedup column shows how many times faster Albumentations is compared to the fastest other library for each transform.

Transformalbumentations
2.0.4
augly
1.0.0
imgaug
0.4.0
kornia
0.8.0
torchvision
0.20.1
Speedup
(Alb/fastest other)
Affine1445 ± 9-1328 ± 16248 ± 6188 ± 21.09x
AutoContrast1657 ± 13--541 ± 8344 ± 13.06x
Blur7657 ± 114386 ± 45381 ± 125265 ± 11-1.42x
Brightness11985 ± 4552108 ± 321076 ± 321127 ± 27854 ± 135.68x
CLAHE647 ± 4-555 ± 14165 ± 3-1.17x
CenterCrop128119293 ± 2164----N/A
ChannelDropout11534 ± 306--2283 ± 24-5.05x
ChannelShuffle6772 ± 109-1252 ± 261328 ± 444417 ± 2341.53x
CoarseDropout18962 ± 1346-1190 ± 22--15.93x
ColorJitter1020 ± 91418 ± 5-104 ± 487 ± 12.44x
Contrast12394 ± 3631379 ± 25717 ± 51109 ± 41602 ± 138.99x
CornerIllumination484 ± 7--452 ± 3-1.07x
Elastic374 ± 2-395 ± 141 ± 03 ± 00.95x
Equalize1236 ± 21-814 ± 11306 ± 1795 ± 31.52x
Erasing27451 ± 2794--1210 ± 273577 ± 497.67x
GaussianBlur2350 ± 118387 ± 41460 ± 23254 ± 5127 ± 41.61x
GaussianIllumination720 ± 7--436 ± 13-1.65x
GaussianNoise315 ± 4-263 ± 9125 ± 1-1.20x
Grayscale32284 ± 11306088 ± 1073100 ± 241201 ± 522600 ± 235.30x
HSV1197 ± 23----N/A
HorizontalFlip14460 ± 3688808 ± 10129599 ± 4951297 ± 132486 ± 1071.51x
Hue1944 ± 64--150 ± 1-12.98x
Invert27665 ± 3803-3682 ± 792881 ± 434244 ± 306.52x
JpegCompression1321 ± 331202 ± 19687 ± 26120 ± 1889 ± 71.10x
LinearIllumination479 ± 5--708 ± 6-0.68x
MedianBlur1229 ± 9-1152 ± 146 ± 0-1.07x
MotionBlur3521 ± 25-928 ± 37159 ± 1-3.79x
Normalize1819 ± 49--1251 ± 141018 ± 71.45x
OpticalDistortion661 ± 7--174 ± 0-3.80x
Pad48589 ± 2059---4889 ± 1839.94x
Perspective1206 ± 3-908 ± 8154 ± 3147 ± 51.33x
PlankianJitter3221 ± 63--2150 ± 52-1.50x
PlasmaBrightness168 ± 2--85 ± 1-1.98x
PlasmaContrast145 ± 3--84 ± 0-1.71x
PlasmaShadow183 ± 5--216 ± 5-0.85x
Posterize12979 ± 1121-3111 ± 95836 ± 304247 ± 263.06x
RGBShift3391 ± 104--896 ± 9-3.79x
Rain2043 ± 115--1493 ± 9-1.37x
RandomCrop128111859 ± 137445395 ± 93421408 ± 6222946 ± 4231450 ± 2492.46x
RandomGamma12444 ± 753-3504 ± 72230 ± 3-3.55x
RandomResizedCrop4347 ± 37--661 ± 16837 ± 375.19x
Resize3532 ± 671083 ± 212995 ± 70645 ± 13260 ± 91.18x
Rotate2912 ± 681739 ± 1052574 ± 10256 ± 2258 ± 41.13x
SaltAndPepper629 ± 6--480 ± 12-1.31x
Saturation1596 ± 24-495 ± 3155 ± 2-3.22x
Sharpen2346 ± 10-1101 ± 30201 ± 2220 ± 32.13x
Shear1299 ± 11-1244 ± 14261 ± 1-1.04x
Snow611 ± 9--143 ± 1-4.28x
Solarize11756 ± 481-3843 ± 80263 ± 61032 ± 143.06x
ThinPlateSpline82 ± 1--58 ± 0-1.41x
VerticalFlip32386 ± 93616830 ± 165319935 ± 17082872 ± 374696 ± 1611.62x

Analysis 🔗

The benchmark results show that Albumentations is generally the fastest library for most image transformations. This is due to its optimized implementation and use of OpenCV for many operations.

Some key observations:

  • Albumentations is particularly fast for geometric transformations like resize, rotate, and affine
  • For some specialized transformations, other libraries may be faster
  • The performance gap is most significant for complex transformations

Recommendations 🔗

Based on the benchmark results, we recommend:

  1. Use Albumentations for production workloads where performance is critical
  2. Consider the specific transformations you need and check their relative performance
  3. For GPU acceleration, consider Kornia, especially for batch processing