# Synthetic Data Generation for the Development of 2D Gel Electrophoresis Protein Spot Models
## 2 Materials and Methods
### Generation of Synthetic Protein Spot Images
#### 2.1.2 Method for Generating the Synthetic Spot Image Dataset
Some of these transformations can be done during the creation of the protein spot prototype (the previous step), e.g., by randomly sampling the center position of the spot, but for the simplicity of the generation process, all the geometric transforms are performed at this step. The transformations are created using the Albumentations library [50] ([[https://albumentations.ai](https://albumentations.ai)]([https://albumentations.ai](https://albumentations.ai)) (accessed on 1 February 2022) ). The library is designed for fast and flexible image augmentation. The augmentation includes the following geometric transforms from the Albumentations library: ShiftScaleRotate, GridDistortion, PiecewiseAffine, and OpticalDistortion. ShiftScaleRotate randomly applies affine transforms: it translates, scales, and rotates the image. The parameters of the transformation are as follows: the shift factor range for both height and width is \((-0.1,\ 0.1)\), the scaling factor range is \((-0.2,\ 0.2)\), the rotation angle range in degrees is \((-180,\ 180)\), bicubic interpolation, and image padding (border mode) is set to constant. The parameters of the GridDistortion transform are as follows: the count of grid cells on each side is 5, the distortion limit is \((-0.05,\ 0.05)\), bicubic interpolation, and image padding (border mode) is set to constant. PiecewiseAffine applies affine transformations that differ between local neighborhoods, creating local distortions. The parameters of the transform are as follows: the scale factor range is \((0.03,\ 0.05)\), the number of rows (and columns) of points that the regular grid should have is 4, and bicubic interpolation. The parameters of the OpticalDistortion transform are as follows: the distortion limit is 0.5, bicubic interpolation, and image padding (border mode) is set to constant. The probabilities of each transformation occurrence in the final augmentation pipeline are as follows: ShiftScaleRotate \(p\approx 0.62\); GridDistortion, PiecewiseAffine, and OpticalDistortion equally \(p\approx 0.13\). 3. Add secondary protein spots.The existence of a lonely protein spot in the 2 DE image region is a rare case. It is common that spots appear in groups with smaller or larger distances between them. If the distance is very small, spots may appear to overlap. This step of data generation simulates the real presence of protein spots in the 2 DE gel. The secondary spots in the current image patch are treated as noise that should be removed during spot reconstruction. The simulation of secondary spots is performed using the same modeling operations used for creating the primary spots. However, the spots' centers are allowed to appear only in the 6 px border area of the image patch. A maximum of 8 and minimum of 0 secondary spots may be placed in the border region. The number of secondary spots is determined randomly. The locations of the spots is also randomized but distributed  
The mask is created by segmenting the image using Watershed transform [51]. The Watershed transform splits the image so that each region contains a single local minimum. The 2 DE image must be in the form of dark spots with a light background in order for the segments to be generated properly. After the Watershed transformation, only the center-most region is selected as the spot mask. _5. Perform intensity random scaling_. The spots may appear to be of various intensities, from very weak to spanning the full intensity range. The intensities of the image samples containing the generated spots are scaled by random coefficient \(A_{\rm s}\) from the range \([0,\ 0.9]\). The same scaling factor is applied to the pair of images: the input image with secondary spots (step 5a) and the target image (step 5b). This step and the rest of the procedure are part of online data augmentation and are performed during the training of the ANN model. _6. Add random constant background_. Spots in real 2 DE images have a background due to chemical processes mentioned at the beginning of this Section.