Skip to main content
. 2025 Aug 28;15(17):2170. doi: 10.3390/diagnostics15172170
Algorithm 2 Image augmentation pipeline
  • Require: 

    Image Ialigned

  • Ensure: 

    Augmented Image I^

  •    1:

    Itf.image.random_flip_left_right(I)

  •    2:

    Itf.image.random_flip_up_down(I)

  •    3:

    Itf.image.random_brightness(I,0.3)

  •    4:

    Itf.image.random_contrast(I,0.8,1.2)

  •    5:

    Itf.image.random_saturation(I,0.8,1.2)

  •    6:

    Itf.image.random_hue(I,0.02)

  •    7:

    σtf.random.uniform([],0.1,2.0)

  •    8:

    Itf.image.gaussian_filter2d(I,(3,3),σ)

  •    9:

    stf.shape(I)[:2]×tf.random.uniform([],0.8,1.0)

  •  10:

    Itf.image.random_crop(I,s)

  •  11:

    Itf.image.resize(I,tf.shape(I)[:2])

  •  12:

    Itf.random.normal(tf.shape(I),0.0,0.05)

  •  13:

    Itf.clip_by_value(I+I,0.0,1.0)

  •  14:

    return Augmented Image I^