3.2.4. Data Augmentation

Tellez et al. analyzed the problem of stain color variation in digital pathology very deeply [31]. They proposed different solutions for both stain color augmentation and stain color normalization. In this work, we exploited techniques proposed by them such as morphological transformations and Hue-Saturation-Value (HSV) shifts. An interesting morphological transformation is the elastic deformation; it was originally proposed by Simard et al. [32] for the analysis of visual documents,

and then has had a widespread application in medical imaging, as also shown by U-Net authors [28]. We used elastic deformation to generate plausible alterations of glomeruli shapes, increasing the variability of training images and thus reducing the risk of overfitting. An example of elastic deformation applied to our images is depicted in Figure 7. Examples of HSV shift are depicted in Figure 8.

**Figure 7.** Elastic deformation example. Left: original image. Right: after elastic deformation with *σ* = 6.29, *α* = 340.

**Figure 8.** HSV shift examples. Top Left: original image. Top Center: Δ*H* = +0.18, Δ*S* = +0.03. Top Right: Δ*H* = +0.06, Δ*S* = −0.06. Bottom Left: Δ*H* = −0.04, Δ*S* = −0.02. Bottom Center: Δ*H* = −0.11, Δ*S* = +0.10. Bottom Right: Δ*H* = +0.18, Δ*S* = +0.09.

A summary of the data augmentation techniques used for the training process is reported in Table 3. The augmentations in group 1 are independently performed, each with a given probability *p*. Resize augmentation used here is slightly different from standard resize; in fact, we apply mirroring padding (instead of zero padding) when we perform a resize which shrinks the image size. Augmentations, such as mirroring padding, which alter the morphology of the image are also executed for the mask. From the augmentations reported in group 2, only one is made. Group 3 contains only one augmentation, which is performed with a given probability. The augmentations are performed in the order they compare in the table, i.e., before the four in group 1, then one of group 2 and in the end the one of group 3.


**Table 3.** Augmentations.
