code: def main():
      nb_checked = 0
  
      augs = iaa.SomeOf(
          (1, None),
          [
              iaa.Resize({"height": (1, 100), "width": (1, 100)}),
              iaa.Affine(
                  scale=(0.01, 2.0),
                  rotate=(-360, 360),
                  shear=(-360, 360),
                  translate_px={"x": (-50, 50), "y": (-50, 50)},
              ),
              iaa.PerspectiveTransform((0.01, 0.2)),
          ],
      )
  
      height, width = 100, 200
  
      while True:
          poly = create_random_polygon(height, width, nb_checked)
          psoi = PolygonsOnImage([poly], shape=(height, width, 3))
          psoi_aug = augs.augment_polygons(psoi)
  
          if not poly.is_valid or not psoi_aug.polygons[0].is_valid:
              print("poly:     ", poly, poly.is_valid)
              print(
                  "poly_aug: ",
                  psoi_aug.polygons[0],
                  psoi_aug.polygons[0].is_valid,
              )
  
          assert poly.is_valid
          assert psoi_aug.polygons[0].is_valid
  
          nb_checked += 1
          if nb_checked % 100 == 0:
              print("Checked %d..." % (nb_checked,))
          if nb_checked > 100000:
              break
  
imports: from __future__ import print_function, division
  import numpy
  import imgaug
  import imgaug.augmenters
  from imgaug.augmentables.polys import Polygon, PolygonsOnImage
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types