# Applying Deep Learning Methods for Mammography Analysis and Breast Cancer Detection
## 3 Materials and Methods  
In this study, we aim to experiment with deep learning-based techniques for detecting cancer in mammograms. For this, we use the dataset provided by the Radiological Society of North America (RSNA) in a Kaggle competition [33]. Its aim was to detect instances of breast cancer in mammograms obtained during screening examinations. The dataset used in this competition was based on the ADMANI dataset [34], which contains annotated digital mammograms and non-image data, and is possibly the most extensive and diverse mammography dataset documented in the literature. The dataset incorporates a total of 28,911 instances of breast cancer, out of which 22,270 were detected during screening and 6641 were interval cases, significantly more than any other dataset published so far. The dataset also consists of a large number of examinations (1,048,345) and patients (629,863), making it one of the largest datasets reported to date [35]. However, the training set for this public competition consists of 11,913 examinations, out of which 486 are cancer cases, making it a very unbalanced dataset. The experimental process took place in three stages. The raw images from the RSNA dataset were used in the first stage, scaled to 256 \(\times\) 256 and 512 \(\times\) 512 resolution. In the second stage, pre-processing techniques were used, such as cropping, windowing, and normalization. The windowing process, which is used before normalization, involves brightness adjustment and gives a much greater contrast between soft and dense tissues, enhancing the visualization of specific anatomical structures or pathological features within an image. In order to overcome the class imbalance, we over-sample the positive examples in a ratio of 5:1 and investigate the generation of synthetic images for the positive class. Therefore, 1000 synthetic images were generated as positive examples using the StyleGAN-XL model [36] in the third stage. The experimental methodology is presented in Algorithm 1. One of the key innovations of the StyleGAN-type models is their ability to generate high-resolution images with impressive detail and realism, including photorealistic portraits of human faces. It achieves this by using a progressive growing strategy, in which the resolution of the generated images is gradually increased as the network learns to capture more complex visual patterns. The training process for the StyleGAN-XL model was executed progressively, starting from training a model for images of a size of 16 \(\times\) 16 pixels. In the second step, based on this model, a new model was trained to generate 32 \(\times\) 32 images. Finally, the model was scaled to generate images of 256 \(\times\) 256 pixels. The model was trained so that the discriminator could see 3 million images. In the end, the FID50k score was 9.8. The improvement of the synthetic image generator is presented in Figure 1.  
We have also trained the StyleGAN-XL model to generate images with a resolution of 512 \(\times\) 512 pixels. Using the previous best model, which was trained for the 256 \(\times\) 256 resolution as the stem, we trained for 400 k images and obtained a FIDK50 score of 13.66. All the trained models' weights and associated data files are available in Supplementary Material. FID50K stands for Frechet inception distance (FID) on the dataset of 50,000 generated images. It is a metric for evaluating the quality of generated images produced by generative models such as GANs, and has been shown to correlate well with human perception of image quality. The specific parameters for training the StyleGAN-XL model are given in Table 1.  
Because the training set was small and had only one class of images, the model size was reduced to improve the training speed. Therefore, the initial model used as a stem had 7 layers (syn_layers), and then in later stages, 4 more layers were added (head_layers). The generator had a capacity factor of 16384 (cbase), and the feature maps size was 256 (cmax).