{'fraction_non_alphanumeric': 0.03029186320754717, 'fraction_numerical': 0.02255306603773585, 'mean_word_length': 4.894439617723719, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Does an ensemble of GANs lead to better performance when training segmentation networks with synthetic images?

Large annotated datasets are required to train segmentation networks. In medical imaging, it is often difficult, time consuming and expensive to create such datasets, and it may also be difficult to share these datasets with other researchers. Different AI models can today generate very realistic synthetic images, which can potentially be openly shared as they do not belong to specific persons. However, recent work has shown that using synthetic images for training deep networks often leads to worse performance compared to using real images. Here we demonstrate that using synthetic images and annotations from an ensemble of 10 GANs, instead of from a single GAN, increases the Dice score on real test images with 4.7 % to 14.0 % on specific classes.


INTRODUCTION
Artificial intelligence (AI) has become a popular tool in medicine to help clinicians work more efficiently and has been vastly discussed in recent decades. [1]. Due to the recent success of machine learning (ML) methods in other domains and the steady increase of image-based medical examinations, applying ML methods for medical image analysis is becoming increasingly popular. Since ML models learn from data, the quantity and quality of medical image data have a direct impact on the success of ML-based algorithms. These algorithms require large datasets with annotations created by human experts. Unfortunately, the availability of large open-source datasets in biomedical imaging is low. The main reasons for the unavailability of large public datasets in medical imaging can be categorized into three main groups; privacy concerns (due to the potentially sensitive information of the patients), expensiveness in terms of cost and time for data collection and annotation, and lack of data due to the rarity of some diseases. Synthetic images overcome all these problems and can help researchers in training complex models. Recently, augmentation of datasets with synthetically generated images is one of the techniques used to explore the insufficiency of annotated data to train the ML algorithms [2]. These synthetically produced images can be used for training deep networks, and can potentially be shared among peers without breaking privacy laws and data protection regulations.
Generative adversarial networks (GANs) recently gained a lot of attention in the computer vision community. Generative modeling is an unsupervised machine learning task that involves discovering and learning the patterns automatically in the input data, and then training itself to further generate new examples. GANs have proven themselves to be useful in multiple scenarios such as data augmentation [3], image-toimage translation [4], domain adaption, and filling in missing information. They provide an opportunity to produce large annotated medical data by producing realistic synthetic images which can further be used to train deep models. There are also several examples where GANs have been succesfully used for medical image applications [5,6,7]. GANs work by learning a complex high-dimensional data distribution to generate diverse high-resolution images. For image segmentation, it is necessary to produce annotations for each synthetic image, and different approaches have been used to achieve this. Bowles et al. [7] used a two-channel approach to synthesize images with their corresponding annotations. Foroozandeh1 et al. [8] used a two-step process where the authors first produce the annotations using a noise-toimage GAN [9], and then used an image-to-image GAN [10] to synthesize MR images from the annotations previously generated. Guibas et al. [11] also used a similar two-step approach to produce images along with corresponding annotations.
While the main principle of training networks with synthetic images has been demonstrated, several papers have shown that using synthetic images and annotations result in lower performance when training a segmentation network. Eilertsen et al. [12] demonstrated that using an ensemble of GANs leads to higher accuracy when training classifiers with synthetic images. Therefore we investigate if using an en-semble of GANs leads to better performance when training segmentation networks with synthetic images and annotations. In this paper, we follow the multi-channel approach to produce images and their corresponding annotations at the same time.

DATA
The MR images used for this project were downloaded from the Multimodal Brain tumour Segmentation Challenge (BraTS) 2020 [13,14,15,16,17]. The training set contains MR volumes of shape 240 × 240 × 155 from 369 patients, and for each patient four types of MR images are available: T1-weighted (T1), post gadolinium contrast T1-weighted (T1Gd), T2-weighted (T2), and T2 fluid attenuated inversion recovery (FLAIR). The annotations cover three parts of the brain tumor: peritumoural edema (ED), necrotic and non-enhancing tumour core (NCR/NET), and GD-enhancing tumour (ET). We used 313 subjects for training and 56 subjects for testing.

METHODS
All 3D volumes were split into 2D slices, as a 2D GAN was used, and only slices with at least 15% pixels with an intensity of more than 50 were included in the training. This resulted in a total of 23,478 5-channel images from the 313 training subjects, and 4,238 5-channel images from the 56 test subjects. Each slice was zero padded from 240 x 240 to 256 x 256 pixels, as the used GAN only works for resolutions that are a power of 2, and the intensity was rescaled to 0 -255. The intensities for the tumor annotations were changed from [1,2,4] to [51,102,204], such that the intensity range is more similar for the 5 channels.

GAN training
The progressive growing GAN architecture [9] was used for all experiments, with the default settings. The code was modified to generate 5-channel images (T1, T1Gd, T2, FLAIR, segmentation annotations) instead of 3-channel color images. The GAN will thereby learn to jointly generate 4-channel MR images and the corresponding tumor annotations at the same time.
The same GAN was trained 10 times and due to several sources of randomness, each GAN will learn to sample from slightly different parts of the high dimensional image distribution. The total training time was about 50 days on an Nvidia V100 GPU. A total of 100,000 synthetic 5-channel images were generated from each trained GAN. When using images from 5 GANs, each GAN provided 20,000 synthetic images. When using images from 10 GANs, each GAN provided 10,000 synthetic images.
There is no guarantee that the synthetic annotations will be restricted to the same values as the real annotations ([51,102,204]). The synthetic annotations were therefore thresholded to the closest original annotation value.

Tumor segmentation
The synthetic images were used to train a model to perform tumor segmentation, and the evaluation was performed using real images in the test set. The model structure and training setup used was inspired by the 2D segmentation code from nnUNet [18]. The model was a U-Net [19] with an extra depth layer and instance normalization instead of batch normalization. In addition, the ReLU activations was swapped for leaky ReLUs with a negative slope of 10 −2 . All models were trained with a loss consisting of a cross-entropy term and a soft Dice term weighted equally. In addition, deep supervision was used, meaning that the loss was applied on the five highest depth level with weighting 0.5 d where d is the depth.
The loss was minimized using stochastic gradient descent with Nesterov momentum of 0.99 and weight decay of 3 · 10 −5 . The initial learning rate was 5·10 −2 and was decreased using polynomial learning rate decay with an exponent of 0.9. All models were trained for 3 · 10 7 samples or 3 days, whichever occured first. 20% of the available images were used for validation and the model with the best mean Dice over the validation set was used for evaluation. If both real and synthetic data was used during training, the real dataset and the synthetic dataset were sampled equally often.
During training a geometric, and intensity-augmentation was applied. The image and target is first randomly rotated and scaled. Both rotation and scaling is applied with a probability of 0.75, the image and target is rotated with an angle uniformly sampled from [−30 • , 30 • ] and the width and height is scaled (independently) with a scale factor uniformly sampled from [0.9, 1.1]. Then the four input channels are augmented by; adding Gaussian noise (applied with probability 0.5, zero mean and standard deviation uniformly sampled from [0.0, 0.05]), blurring the image (applied with probability 0.2, gaussian blurring with standard deviation sampled from [0.5, 1.0]), faking lower resolution (zooming with a factor between 0.75 and 1.0 and then upsampling) and changing the gamma factor (scaling it with a factor between 0.8 and 1.2). Lastly the input image channels are normalized using Z-score normalization.
When training the 10 different GANS, the random training is a positive side effect. However, when training the segmentation networks this effect is undesired. Each segmentation network was therefore trained 10 times. Figure 1 shows an example of a real 5-channel image and a randomly selected synthetic 5-channel image. Table 1 shows the segmentation accuracy on real images when training the U-Net using only real images, using real and synthetic images together, or only using synthetic images. The results are repeated for synthetic images from a single GAN, from 5 GANs and from 10 GANs. The results represent  Table 1. Results on the test dataset (4,238 real images). Mean and standard deviation of Dice score across the dataset are calculated for the labels; GD-enhancing tumor (ET), peritumoral edema (ED), and necrotic and non-enhancing tumor core (NCR/NET). All results are presented as mean ± standard deviation of 10 trainings.

RESULTS
the mean and standard deviation over 10 trainings of the U-Net. The mean Dice score increases 4.7% for the enhancing tumor, 11.1% for the edema part, and 14.0% for the necrotic core, when training with only synthetic images from 10 GANs instead of from a single GAN. As expected, adding synthetic data to the original dataset during training (row 1-3 in Table 1) only gives a very small increase in segmentation performance.
Since the GANs that generate the synthetic data are trained on the same dataset, no new information in the form of annotated data is added and the addition of synthetic data can instead be compared to advanced data augmentation. However, the same trend with more GANs giving better performance still holds for these experiments. Figure 2 shows segmentation results for a randomly selected slice, for the same training setups as in Table 1.

DISCUSSION
Our results show that an ensemble of GANs indeed improves the segmentation accuracy when using the synthetic images for training segmentation networks, compared to using synthetic images from a single GAN. This comes at the cost of an increased training time, which scales linearly with the number of GANs. Our results thereby reflect the results obtained by [12] for classification. Even better results can potentially be obtained using more than 10 GANs. Here we use a rather strong baseline model, which may explain why we see only minor improvements when adding synthetic images to the real ones.
A challenge with the BraTS dataset is that the data originates from 19 different centers, and that the image quality and appearance varies between the centers. It is possible that better results can be obtained if the site information is used as a variable in the GAN training, to train conditional GANs which can learn to generate images that represent each center. Although BraTS 2020 contains images from 369 subjects (training set), it is possible that instead using BraTS 2021 (which contains 1251 training subjects) will give substantially better results.
Training with synthetic images still results in substantially lower segmentation accuracy, compared to training with real images. In future work we therefore plan to repeat the experiments with the more recent architectures StyleGAN [20], StyleGAN2 [21] and StyleGAN3 [22] (although they are even more computationally demanding), as well as with more re- cent diffusion models. It would especially be interesting to train conditional models where the imaging site, tumor size and tumor location can be controlled. We also plan to look into 3D GANs [23] and 3D diffusion models [24], but a general problem is that they will use a lot of GPU memory for generating 5-channel volumes.

COMPLIANCE WITH ETHICAL STANDARDS
This research study was conducted retrospectively using human subject data made available as open access by BraTS. Ethical approval was not required as confirmed by the ethical review board of Linköping.

ACKNOWLEDGEMENTS
Training the segmentation networks was performed using the supercomputing resource Berzelius (480 Nvidia A100 GPUs) provided by National Supercomputer Centre at Linköping University, Sweden, and the Knut and Alice Wallenberg Foundation. This research was supported by the ITEA/VINNOVA project ASSIST (Automation, Surgery Support and Intuitive 3D visualization to optimize workflow in IGT SysTems, 2021-01954), the VINNOVA funded project AIDA, LiU Cancer and theÅke Wiberg foundation. Anders Eklund has previously received graphics hardware from Nvidia.