code: def main():
      augmenters = [
          iaa.Identity(name="Identity"),
          iaa.Crop(px=(0, 8), name="Crop-px"),
          iaa.Crop(percent=(0, 0.1), name="Crop-percent"),
          iaa.Fliplr(0.5, name="Fliplr"),
          iaa.Flipud(0.5, name="Flipud"),
          iaa.Grayscale((0.0, 1.0), name="Grayscale"),
          iaa.GaussianBlur((0, 3.0), name="GaussianBlur"),
          iaa.AdditiveGaussianNoise(
              loc=0, scale=(0.0, 0.1), name="AdditiveGaussianNoise"
          ),
          iaa.Dropout((0.0, 0.1), name="Dropout"),
          iaa.Multiply((0.5, 1.5), name="Multiply"),
          iaa.ContrastNormalization(
              alpha=(0.5, 2.0), name="ContrastNormalization"
          ),
          iaa.Grayscale(alpha=(0.0, 1.0), name="Grayscale"),
          iaa.ElasticTransformation(
              alpha=(0.5, 8.0), sigma=1.0, name="ElasticTransformation"
          ),
          iaa.Affine(
              scale={"x": (0.8, 1.2), "y": (0.8, 1.2)},
              translate_px={"x": (-16, 16), "y": (-16, 16)},
              rotate=(-45, 45),
              shear=(-16, 16),
              order=0,
              cval=(0, 255),
              mode="constant",
              name="AffineOrder0ModeConstant",
          ),
      ]
  
      for order in [0, 1]:
          augmenters.append(
              iaa.Affine(
                  scale={"x": (0.8, 1.2), "y": (0.8, 1.2)},
                  translate_px={"x": (-16, 16), "y": (-16, 16)},
                  rotate=(-45, 45),
                  shear=(-16, 16),
                  order=order,
                  cval=(0, 255),
                  mode=ia.ALL,
                  name="AffineOrder%d" % (order,),
              )
          )
  
      augmenters.append(
          iaa.Affine(
              scale={"x": (0.8, 1.2), "y": (0.8, 1.2)},
              translate_px={"x": (-16, 16), "y": (-16, 16)},
              rotate=(-45, 45),
              shear=(-16, 16),
              order=ia.ALL,
              cval=(0, 255),
              mode=ia.ALL,
              name="AffineAll",
          )
      )
  
      kps = []
      for _ in sm.xrange(20):
          x = random.randint(0, 31)
          y = random.randint(0, 31)
          kps.append(ia.Keypoint(x=x, y=y))
      kps = ia.KeypointsOnImage(kps, shape=(32, 32, 3))
      small_keypoints_one = kps.on((4, 4, 3))
      medium_keypoints_one = kps.on((32, 32, 3))
      large_keypoints_one = kps.on((256, 256, 3))
      small_keypoints = [
          small_keypoints_one.deepcopy() for _ in sm.xrange(16)
      ]
      medium_keypoints = [
          medium_keypoints_one.deepcopy() for _ in sm.xrange(16)
      ]
      large_keypoints = [
          large_keypoints_one.deepcopy() for _ in sm.xrange(16)
      ]
  
      small_images = np.random.randint(0, 255, (16, 4, 4, 3)).astype(
          np.uint8
      )
      medium_images = np.random.randint(0, 255, (16, 32, 32, 3)).astype(
          np.uint8
      )
      large_images = np.random.randint(
          0, 255, (16, 256, 256, 3)
      ).astype(np.uint8)
  
      print("---------------------------")
      print("Keypoints")
      print("---------------------------")
      for augmenter in augmenters:
          print("[Augmenter: %s]" % (augmenter.name,))
          for keypoints in [
              small_keypoints,
              medium_keypoints,
              large_keypoints,
          ]:
              times = []
              for i in sm.xrange(100):
                  time_start = time.time()
                  _img_aug = augmenter.augment_keypoints(keypoints)
                  time_end = time.time()
                  times.append(time_end - time_start)
              times = np.array(times)
              img_str = "{:20s}".format(keypoints[0].shape)
              print(
                  "%s | SUM %.5fs | PER ITER avg %.5fs, min %.5fs, max %.5fs"
                  % (
                      img_str,
                      float(np.sum(times)),
                      np.average(times),
                      np.min(times),
                      np.max(times),
                  )
              )
  
      print("---------------------------")
      print("Images")
      print("---------------------------")
      for augmenter in augmenters:
          print("[Augmenter: %s]" % (augmenter.name,))
          for images in [small_images, medium_images, large_images]:
              times = []
              for i in sm.xrange(100):
                  time_start = time.time()
                  _img_aug = augmenter.augment_images(images)
                  time_end = time.time()
                  times.append(time_end - time_start)
              times = np.array(times)
              img_str = "{:20s}".format(images.shape)
              print(
                  "%s | SUM %.5fs | PER ITER avg %.5fs, min %.5fs, max %.5fs"
                  % (
                      img_str,
                      float(np.sum(times)),
                      np.average(times),
                      np.min(times),
                      np.max(times),
                  )
              )
  
file_path: imgaug/checks/check_performance.py
imports: from __future__ import print_function, division
  import imgaug
  from imgaug import augmenters
  import numpy
  import time
  import random
  import six.moves
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types