{'fraction_non_alphanumeric': 0.02734505087881591, 'fraction_numerical': 0.007511563367252544, 'mean_word_length': 4.900873362445415, 'pattern_counts': {'":': 0, '<': 1, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
e-UDA: Efficient Unsupervised Domain Adaptation for Cross-Site Medical Image Segmentation

Domain adaptation in healthcare data is a potentially critical component in making computer-aided diagnostic systems applicable cross multiple sites and imaging scanners. In this paper, we propose an efficient unsupervised domain adaptation framework for robust image segmentation cross multiple similar domains. We enforce our algorithm to not only adapt to the new domains via an adversarial optimization, rejecting unlikely segmentation patterns, but also to maintain its performance on the source training data, by incorporating both semantic and boundary information into the data distributions. Further, as we do not have labels for the transfer domain, we propose a new quality score for the adaptation process, and strategies to retrain the diagnostic algorithm in a stable fashion. Using multi-centric data from a public benchmark for brain lesion segmentation, we demonstrate that recalibrating on just few unlabeled image sets from the target domain improves segmentation accuracies drastically, with performances almost similar to those from algorithms trained on fresh and fully annotated data from the test domain.


Introduction
Domain shifts are commonly observed in real-world machine learning applications. Especially in the field of medical imaging, with its inherently heterogeneous and complex data, the performance of computer-aided diagnostic (CAD) systems may drop rapidly when being tested on new data acquired with scanners or sequences that underwent minor, but critical updates. Same as in other fields, deep convo- lutional neural networks (CNN) have propelled unprecedented advances in biomedical image analysis [24]. Medical image segmentation, is an important step in quantifying and structuring medical image information in biomedical research and clinical practice, plays a crucial role in various medical applications. Although transformative advancements have been achieved by learning how to quantify medical images using CNNs [31,19], most of the supervised learning approaches were built based on a common assumption that training and test data are drawn from the same probability distribution. This leads the established models commonly to suffer from a domain shift in the data encountered at the inference stage [3]. We denote domain as a set of data samples from a same distribution. For example, MR images from one scanner with same imaging sequence can represent one domain whilst those acquired in another medical center, with a different scanner and a slightly modified imaging sequence can represent another [20]. One way to deal with this common problem in medical imaging is sampling the different domains, and including scans from a maximal number of centers into the training set. Unfortunately, high quality images with expert annotation and clinical follow-up verification is often only available for data acquired under highly controlled conditions, for example, during a clinical study. A diagnostic algorithm trained on samples from such a source is very likely to drop in performance significantly, when applied to real world scans from arbitrary target domains [23]. As an example, in Fig. 1 demonstrates the amount of domain shift in intensity distribution, contrast level, voxel size and noise among different sites. Domain adaptation [3] and transfer learning [30] methods have been studied to generalise established models. A naive solution is fine-tuning the models learned on source domain with extra labeled data from the target domain. However, the annotation is prohibitively time-consuming and expensive in real-world healthcare applications. Moreover, without control and approval of the quality and diagnosis of the new cases, which may require a full clinical study, modifying the training data sets may be prohibitive for most clinical diagnostic algorithms, also raising the question of how to rate and verify the quality of the added annotations.
Unsupervised domain adaptation (UDA) methods [8] are more feasible, given that the models are learnt across domains without using extra labelling in the target domain. Although various works have tackled UDA, they face common drawbacks: 1) feature-level adaptation methods require empirical selection of the feature level used during adaptation; 2) image adaptation methods require a high image quality in synthethized target domain images and a large amount of data are required to learn the distributions; 3) the adaptation process can not be validated since it is an unsupervised process in which does not including any labels from the target domain.
In this study, we propose to not only consider the relations of image features between different domains, but to also consider semantic and boundary information, i.e., the segmented images in both domains and the expected spatial patterns of the disease process. We assume that the understanding or knowledge of the disease patterns is domaininvariant and can be generalised to different domains. To learn this domain-invariant knowledge, we proposed an adversarial framework to drive the segmentation network to adapt to different domains constraint on semantic labels and information on the boundaries of critical image structures. This does not require to align the image features with an empirical selection of the feature level, meanwhile, the image features are also involved during the adaptation process.
Our unsupervised domain adaptation framework offers three-fold contributions: • We address the unsupervised domain adaptation problem using adversarial learning, with a few shots or instances of target-domain images and without requiring any annotation from unseen scanners, which holds large clinical benefits. • We propose to incorporate semantic and boundary information into the distribution to stabilize the adversarial learning process and we identify an effective criteria for evaluating the algorithm's behaviour in the target domain. • We benchmark our method on public datasets in an application scenario of cross-site brain lesion segmentation and quantification. Experiments show that the proposed method achieves good generalisation during the unsupervised 'recalibration' across multiple domains.

Related Work
Our work is related to unsupervised domain adaptation and cross-domain image segmentation. Unsupervised domain adaptation. Early studies on UDA focused on aligning or matching the distributions in feature space, by minimizing the distances between the features learnt from the source and target domain [26,27]. More recently, with the advances of generative adversarial network (GAN) and its extensions [12,1], the latent feature spaces across different domains can be implicitly aligned by adversarial learning. Y. Ganin et al. [9] proposed to learn domain-invariant features by sharing weights between two CNN networks. E. Tzeng et al. [32] introduced a unified framework in which each domain is equipped with a dedicated encoder before the last classification layer. However, as commented in [33], the above UDA methods for classification problems cannot work well to the dense segmentation problem [16], because the mapping functions from image space to label space may differ in source and target domains due to the domain shift. Cross-domain image segmentation. In contrast to prior works, the medical image segmentation we study is a highly-structured prediction problem, for which unsupervised domain adaptation attracts increasing attention. Transfer learning with simple fine-tuning strategies has been experimentally studied in [11] on the brain lesion segmentation application. The existing works can be divided into two main streams: feature-level adaptation and imagelevel adaptation. In the feature level, K. Kamnitsas et al. [19] proposed an early attempt to perform UDA for brain lesion segmentation which aimed to learn domain-invariant features with a domain discriminator. The cross-modality segmentation problem with large domain shift is addressed in [7] in which specific feature layers are fine-tuned and an adversarial loss is used to supervised feature learning. K. Bousmalis et al. [4] proposed an image-level adaptation framework, which aligns the image appearance between domains with the pixel-to-pixel transformation. In this direction, the domain shift problem is addressed at the input level. Although the images cannot be perfectly synthesized, existing studies [34,4,17] demonstrate that the image adaptation brings improvements in pixel-wise predictions on a target domain. A recent work [5] combines feature-level and image-level adaptation and achieves state-of-the-art results on cross-modality segmentation.
While the results were inspiring and demonstrated the efficacy of adversarial learning, there exists limitations for the two classes of methods above. For the feature-level adaptation methods, i) different levels of features are concatenated as the input of a domain discriminator. This requires much effort in empirical design of network architecture and is difficult to interpret. As shown in [19] and [7], different choices of features levels results in varied segmentation results. ii) as mentioned in [33], the assumption that features representations are aligned in source and target domains without carefully considering the structured labels, becomes less likely to hold. For the image-level adaptation ones, commonly a CycleGAN-based component [35] serve to synthesize the target images. However, the image quality of synthetic images is not guaranteed without large amount of data from the target domain, especially when the region of interest is tiny such as small brain lesions in our study. Furthermore, CycleGAN's extensions are based on pixelto-pixel transformation and thus cannot deal with domain shift in voxel size.

Method
Fig. 2 is an overview of our proposed method. With a segmentation model pre-trained on the source domain, we further adapt the model to target domains by using a distribution discriminator which judges whether the mapping from image space to label space is the same or not. This process is trained with an adversarial loss in an unsupervised manner as it does not require labels from the target domain.

Problem Definition, Assumption and Notation
Let X denote an input image space and Y a segmentation label space. We define a domain to be a joint distribution P XY on X × Y. Let P S and P T denote the sets of joint distributions from the source domains and the target domains respectively. We observe N source domains is sampled from P T . Notably, the samples from the target domain do not contain any groundtruth segmentation labels.
We consider two mapping functions from image spaces to label spaces. Φ S : X S → Y S is the mapping learnt in the source domain, and Φ T : X T → Y T is the one learnt in the target domain (if labels are available). We assume that, the two mappings from image space to label space are domaininvariant in image segmentation tasks, i.e., Φ S = Φ T . In other words, the knowledge for segmentation tasks is stable across different domains. The goal of unsupervised domain adaptation is to learn a generalised domain-invariant segmentation model Φ G given {S, T } such that Φ G approximates Φ S and Φ T . We aim to learn Φ G using Φ S as a reference or a teacher model [14] since Φ T is not observed.

Semantic-and boundary-aware layer
In order to effectively learn domain-invariant mapping, we introduce a semantic-and boundary-aware layer which incorporates semantic and boundary information into the distribution by spatially concatenating the image, semantic masks and edge maps as a part of the model input. We claim that such a combination of information is crucial for domain adaptation in image segmentation tasks especially boundary-aware input which shows its effectiveness in previous studies [13,6]. We introduce edge maps to detect the structure boundary in prediction masks using Sobel operators [10]. Since the labels of background and pathology are often highly unbalanced especially in brain lesion segmentation task, we further develop an inverse-label map to facilitate the learning process.
Let P denote the probability (or ground-truth) maps, f 1 and f 2 denote the Sobel operations for two directions, and J denote the all-ones matrix with the same size with P , the edge maps are defined as f 1 (P ) and f 2 (P ). The inverse label maps is defined as: J − P . Thus the semantic-and boundary-aware layer H(P ) concatenates multiple maps as its input: (1) The effectiveness of the edge maps and inverse maps is presented in Section 4.4.

Adversarial Domain Adaptation
The segmentation model in source domain Φ S can be learnt by supervised learning given S. Before domain adaptation, Φ S is not generalised to T and it can be used for an initialisation of Φ G . Since Φ G is expected to generalise on both S and T , Φ G should be partly supervised by S during the domain adaptation process. The goal of learning a domain-invariant Φ G is equal to minimizing the distance between Φ G and Φ S . Inspired by [9], we use an adversarial network including a generator G which performs label predictions given input images, and a discriminator D that evaluates whether the mapping is the same as Φ S or not, thus pushes Φ G to be close to Φ S . For this purpose, the mapping Φ S from source image space to ground-truth label space is treated as 'expert knowledge' while the mapping Φ G is treated as 'machine knowledge'. However, modeling of Φ G faces the challenge of measuring the similarity between mappings which is not straightforward to compute. Meanwhile, Φ S is difficult to be directly formulated. We choose to parameterize these functions by using a deep neural network D to map the samples {S, T } along with semantic and boundary information to a latent feature space and discriminate the latent features to be 'good' or not. The optimization of D and Φ G can be formulated as: However, this objective can be problematic since during the early training stage the discriminator converges quickly, causing the gradient-vanishing issue. It is typical to train the generator with the standard loss function with inverted labels [12]. This splits the optimization into two independent objectives, one for the discriminator and one for the generator: (4) Notably this two-stage optimization provides stronger gradients to the target mapping. ConvNets for segmentation. One of the basic components of the proposed system is a fully convolutional neural network (ConvNets) for image segmentation [25]. With the labeled dataset of N samples from source domain, supervised learning was conducted to establish a mapping from the input image space to the label space. We borrowed the top-performing U-shape architecture from [23] and adopted the same configuration for all meta-parameters. The parameters of the network are learnt by iteratively minimizing a segmentation loss using stochastic gradient descent. The segmentation loss function is a linear combination of Dice coefficient loss [29] and cross-entropy loss, formulated as where s is the smoothing factor to avoid numerical issues, y i and p i are the ground-truth label and prediction for i th voxel respectively. Notably the loss function can be a multi-class version depending on the segmentation task. Unlike the existing frameworks [7,32] which freeze the source-domain model and learn another model on target domain, we use only one ConvNet for both source and target domains. We argue that deep ConvNet offers large modeling capacity and can learn effective representations on diverse data from multiple domains as observed from recent segmentation benchmarks [2,22,36]. Given the modelling capacity, the goal of this work is to learn an domaininvariant segmentation model.

Monitoring Metrics
The performance of the network is hard to validate on the target domain since there is no ground-truth labels available. We introduce two monitoring metrics to observe the UDA process. The idea is that after the supervised pre-training on source domain, the model Φ G produces an initial segmentation mask on the target domain which differs much from the ground-truth mask. While performing UDA in each training iteration, the difference between the updated segmentation mask and the initial one increases. Metaphorically speaking the segmentation mask moves from the initial segmentation towards the ground truth mask, while increases the difference to the beginning. Consequently, we assume that the difference between the current and the initial segmentation mask is expected to reach its global maximum and show stable at the end of the UDA process.
Given a sample x from target domain, let M 0 denote the initial mask predicted by the pre-trained model before UDA, formulated as: M 0 = Φ 0 G (x). Let M i be the mask predicted by Φ Gi at iteration i during the UDA process, formulated as: M i = Φ i G (x). We use the Euclidean distance of the two masks as one of the monitoring metrics, formulated as: where || · || represents the Euclidean distance.
To measure the stability, we further compute the variance σ 2 d of the mask differences in an iteration interval, which can be formulated as: where µ is the average of the mask differences in an iteration interval. When σ 2 d is below a certain threshold , it indicates that the segmentation does not improve anymore and then we stop the training. This evaluation criterion is not only an indicator for the quality improvement of the segmentation but also a good stopping criteria for the learning process.

Training Strategies
In our training setting we define two stages (see Algorithm 1). In the first stage, we perform a supervised training on the source domain. In the second stage, we aim to learn a domain-invariant segmentation model by performing domain adaptation in an adversarial fashion.

Datasets and Evaluation Metrics
The public dataset of the MICCAI White Matter Hyperintensities Segmentation Challenge 2017 [22] is used for evaluation and benchmarking. It contains 60 MRI scans from 3 different scanners from the hospitals in the Netherlands and Singapore. Table 1 presents the characteristics of the imaging dataset. For each subject, 2D multi-slice FLAIR and T1, with the corresponding ground-truth annotated by two raters, are available.
We split the dataset into a source domain set and a target domain set. The source set contains the 40 scans from two scanners with manual segmentation masks while the target set represents the data of the leftover scanner but without the segmentation masks.
For evaluating the results of our proposed algorithm, we use five evaluation metrics, taken from the MICCAI WMH challenge to compare with the state-of-the-art. Given the ground-truth segmentation mask G and the generated mask

Image preprocessing
The intensity of the images are normalised in a preprocessing step. We use 2D axial slices of both FLAIR and T1 sequences for training. All images are cropped or padded to a uniform size of 200 by 200 pixels. Then the voxel intensity is normalised with a z-score normalisation. We use data augmentation (rotation, shearing and scaling) to achieve the desired invariance in the training stage.

Network architectures and parameters setting
The first part called generator is a fully convolutional network taken from [23]. The generator takes the concatenation of FLAIR and T1 image as a two-channel input and follows a U-net structure. A combination of convolutional and max-pooling layer downsamples the input data before the segmentation mask is produced by several upsampling layers. Additionally, skip connections between layers at the same level create a stronger relation between input and output. The output is a one-channel probability map with pixelwise predictions for the input image.
We further introduce a 2.5-D convolutional discriminator network which aim to identify the distribution difference between source and target domain. The discriminator takes a seven-channel input consisting of the paired FLAIR & T1 images, the segmentation mask, the mask's inverse-label maps, two Sobel edge maps and the edge maps' inverselabel maps. The use of the inverse mask and edge mask introduce semantic and boundary information of the interested area which helps the network to identify if the segmentation is correct or not. This is necessary because the interested areas are very small in our case. We use Patch-GAN [18] architecture with a small patch size of 10× 10 as the output. The discriminator model is trained with domain labels using a cross-entropy loss.
Adam optimizer [21] is used for stochastic optimization. The learning rates for the segmentation network, discriminator model and adversarial model are set to 0.0002, 0.001 and 0.0002 respectively.

Results
We first establish the performances of lower bound baseline and upper bound considering two scenarios: (i) Lower bound (L-bound): The baseline model is trained on the source dataset to establish a lower bound performance. The segmentation network is trained on the source domain images henceforth referred to as S, and tested on the subjects from a target dataset T . (ii) Upper bound (U-bound): Here, the segmentation model is trained same as L-Bound, however, the training dataset is a union of the data including images and masks from both S and a subset of T excluding one testing sample. Then we perform leave-one-subjectout evaluation on the testing set to establish a strong upper bound.
To demonstrate the efficiency of our approach, the algorithm are run considering two conditions of the target domain: (iii) using only a few shots of images: In this scenario, we use the data from S and only a tiny subset (i.e. one fixed batch) of the target domain and without using any annotation from the target domain. (iv) using the full set of the target domain: Here, we use the data from S and the full set of the target domain and without using any annotation from the target domain.

Domain Adaptation Results on Multi-site Data
Utrecht + Amsterdam → Singapore: For this setting, we take the site 1 and 3 (Utrecht and Amsterdam) as the source domain which leaves the site 2 (Singapore) for the target domain. Table 2 presents the final results of  Table 2: Results on two cross-site segmentation tasks. The values are calculated by averaging the results on the target dataset. We compare our method with current state-of-the-art method. L-bound denotes the performance without using adaptation whilst U-bound denotes the performance using almost the full set of the target domain.

Conditions
Dice our e-UDA algorithm on the target dataset and compares with baseline and state-of-the-art U-Net ensemble method [23]. Notably [23] is the top-performing algorithm on crossscanner segmentation as analyzed in [22]. CyCADA [15] is an image-level CycleGAN-based adaptation method. We found that CyCADA achieve poor result because of the low image quality in the synthesized target domain. Fig.  3 shows a failure example. Our e-UDA significantly improves segmentation performance on the target dataset after domain adaptation (eUDAs vs. L-bound, p-value < 0.0001). We observe that our e-UDA with a few shots of target images achieves similar Dice score comparing with using the full set of the target domain (78.0% vs. 78.2%). When using the full set, e-UDA achieve promising performance close to the upper bound in Dice score (78.2% vs. 80.3%) and lesion-wise recall (75.4% vs. 76.1%). Utrecht + Singapore → Amsterdam: For this experiment, we take site 1 and 2 (Utrecht and Singapore) as the source dataset whilst site 3 (Amsterdam) represents the target dataset. Similarly we observe that using a few shots of target images can significantly improve the segmentation results on target domain. When using the full set, e-UDA achieves promising performance close to the upper bound in lesion-wise recall (84.1% vs. 84.3%). The performance in AVD in Table 2 decreases after using the full set whilst the Dice stays stable and recall increases. This indicates that the algorithm encourages the network to produce reasonable prediction based on spatial patterns of the disease process.

Performance on both domains
Since the segmentation network is continually trained with supervised training using the data from source domain, Figure 3: The translation from Utrecht to Amsterdam using CycleGAN [35]. We observed that it introduce noise in the synthetic images and the voxel-size stays the same. the model faces the risk of overfitting issue on the source domain. We argue that the distribution discriminator can regularise the training process and can avoid overfitting issues. We further observe the behaviour of the segmentation model on both source domain and target domain without stopping the adaptation process. In this setting, we split the data from source domain into a training set (80%) and a validation set (20%) for observation. We use Dice score and lesion-wise recall for evaluation metrics. From Fig. 5, we confirm that the segmentation model does not overfit on the source domain whilst the performance on target domain is increasing stably.

Ablation Study
We conduct ablation experiments to evaluate the effectiveness of each key component in our proposed adversarial learning framework. Table. 3 shows the segmentation performance is increasingly better as more semantic information being included, especially, when incorporating edge Before After Figure 4: From left to right: results on five axial slices of the same subject. From top to bottom: FLAIR axial-view images, the segmentation results before domain adaptation, the segmentation results using the proposed method. Green color indicates overlap between the segmentation result and the ground truth masks, red color false positives, and gold color false negatives. (Best viewed in color) Figure 5: Performance on both domains during the domain adaptation process. We observe that the performance in the source domain remains stable whilst the performance in the target domain is increasing. and inverse maps.

Feature Visualisation
As shown in Fig. 6, we visualise the features corresponding to the pathological pixels from the source and target do-

Conclusion
We presented an efficient adversarial domain adaptation framework for cross-site medical image segmentation. The proposed framework enforce the segmentation model to adapt to target domain by learning semantic information in an adversarial fashion. We found that using a few shots Figure 6: Illustration of pixel-wise feature distribution. Blue denotes pixels from source domains, yellow represents pixels from target domain. We observe that the source features and domain features are more close to each other after domain adaptation. Visualization is done by t-SNE [28]. (Best viewed in color) of images from the target domain can significantly improve the segmentation results.