{'fraction_non_alphanumeric': 0.0380041103736397, 'fraction_numerical': 0.011690980762103703, 'mean_word_length': 4.821141400274564, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, '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}}
Cross-Modality Brain Tumor Segmentation via Bidirectional Global-to-Local Unsupervised Domain Adaptation

Accurate segmentation of brain tumors from multi-modal Magnetic Resonance (MR) images is essential in brain tumor diagnosis and treatment. However, due to the existence of domain shifts among different modalities, the performance of networks decreases dramatically when training on one modality and performing on another, e.g., train on T1 image while performing on T2 image, which is often required in clinical applications. This also prohibits a network from being trained on labeled data and then transferred to unlabeled data from a different domain. To overcome this, unsupervised domain adaptation (UDA) methods provide effective solutions to alleviate the domain shift between labeled source data and unlabeled target data. In this paper, we propose a novel Bidirectional Global-to-Local (BiGL) adaptation framework under a UDA scheme. Specifically, a bidirectional image synthesis and segmentation module is proposed to segment the brain tumor using the intermediate data distributions generated for the two domains, which includes an image-to-image translator and a shared-weighted segmentation network. Further, a global-to-local consistency learning module is proposed to build robust representation alignments in an integrated way. Extensive experiments on a multi-modal brain MR benchmark dataset demonstrate that the proposed method outperforms several state-of-the-art unsupervised domain adaptation methods by a large margin, while a comprehensive ablation study validates the effectiveness of each key component. The implementation code of our method will be released at \url{https://github.com/KeleiHe/BiGL}.

the following two situations: 1) applying the models trained from one modality to another; and 2) performing on data from different machines with different protocols.
On the other hand, delineating the brain tumors in multimodal images is unacceptable in clinical situation for two reasons: 1) it requires substantial time and clinical expertise, and 2) the tumors and infected regions are not clear or even absence in some modalities. Therefore, it would be highly desirable for trained networks to be able to adapt between modalities, with segmentations only labeled on one modality. This would also make the segmentation methods much more user friendly for clinicians, as it saves them potential time. However, this is a very challenging task due to the varied contexts in different modalities [8]. To tackle this challenge, the unsupervised domain adaptation (UDA) methods [9], [10], [11], [12], [13] have been explored and developed. The UDA methods aim to improve the model generalization ability when learning from the labeled data (i.e., source domain) and performing on the different unlabeled data (i.e., target domain) with domain shifts. Although UDA has proven effective, existing methods still have several limitation. First, some of these methods partially leverage synthesized images to achieve domain adaptation [9], [11], i.e., they only use the synthesized target images to construct the model. However, the synthesized source images can also take effect on this kind of problem. Second, they align inefficient representations for the adaptation. The structured output assumption in [10] is not applicable to some tasks, e.g., medical image segmentation. Besides, most previous methods [9], [11] use the redundant features for domain alignment, which inhibits the performance of UDA. Third, most methods were originally designed for the task of organ segmentation, which is easier than tumor segmentation, as tumors are not of structural appearances. We report the performance of these networks as well as a baseline network without adaptation in experiments (as reported in Section 4), and show they are unable to generate highquality segmentation.
To overcome the aforementioned limitations, we propose a framework that can accurately delineate brain tumors in one sequence of MR images (i.e., the target domain) when trained on another sequence of MR images (i.e., the source domain), and vise versa. In the training stage, the proposed method randomly selects two unpaired images (one image from each domain) as the input. Then, the images are send to the framework which consists of two main components. Firstly, to reduce the gap between the two domains, a bidirectional image-to-image generation and segmentation module is introduced. It first generates one synthesized image for each original image, and then segments all the images (i.e., the original and synthesized images) using a encoder-decoder architecture. The features and outputs of the images are further aligned by the novel global-to-local adaptor (GTA) applied to the network. From a global perspective, the adaptor aligns the real and synthesized images of one subject in the output space, by assuming that they share the same label. It also aligns the real and synthesized images of different subjects through the commonly used feature alignment. However, tumors are often located in small arbitrary regions of the image, making tumor segmentation a more difficult task than organ segmentation. Therefore, in the GTA, we propose a local alignment by utilizing the attention maps captured from the features. This attentionbased alignment helps transfer the most discriminate part of features through domains, by assuming the silences of the images are consistent inter-domain, thus enhancing the adaptation ability. Moreover, inspired by the work in [9], [10], we conduct adversarial learning to build distribution consistencies between the aligned representations.
To conclude, the contributions of our proposed method are three-fold: • We propose a novel bidirectional global-to-local (BiGL) unsupervised domain adaptation method to tackle the challenging problem of cross-modal brain tumor segmentation, in which unsupervised domain adaptation, adversarial learning, attention mechanism and brain tumor segmentation are integrated into a unified framework.

•
The global-to-local adaptation module is proposed to reduce domain gap between the source and target domains as well as between the synthesized and real images, which can effectively improve the generalization ability of UDA and thus boost the segmentation performance.
• Experimental results on a brain tumor benchmark dataset (i.e., BraTS' 19 [14]) demonstrate the effectiveness of our BiGL method, which significantly outperforms other state-of-the-art UDA methods. And experiments on another benchmark dataset (i.e., MMWHS [15]) for cross-modality (i.e., CT to MR) whole heart segmentation shown the generalization ability of the proposed method.
The following sections are organized as follows: Section 2 reviews the related work of the proposed method; Section 3 introduces the detailed architecture of the proposed BiGL method for cross-modal brain tumor segmentation; Section 4 reports the experiments of the proposed method on a brain tumor segmentation dataset and a benchmark heart structural segmentation dataset; Section 5 concludes this work and gives possible future directions.

RELATED WORK
We briefly review two types of works that are most related to our method, including 1) deep learning-based methods for brain tumor segmentation, and 2) unsupervised domain adaptation methods and its applications in medical images.

Deep Learning-based Brain Tumor Segmentation
Deep learning methods have achieved remarkable results in the application of brain tumor segmentation. We roughly divide the related segmentation methods into two categories.
1) Single-prediction methods that predict the label of a single pixel over an input image patch. For example, Pereira et al. [16] propose a automatic brain tumor segmentation method based on a specifically designed CNN architecture with data augmentation techniques, e.g., normalization and rotation. Havaei et al. [17] proposed to tackle the brain tumor segmentation task via cascaded CNNs. Specifically, they solved the label imbalance problem using a two-stage framework, and utilized a two-pathway CNN architecture to further leverage multi-scale features. As CNN-based methods are quite time consuming with redundant operations, the FCN-based method to densely predict segmentation is more popular in recent years.
2) Densely-prediction methods use a fully-convolutional network (FCN). For example, Dong et al. [18] uses the popular FCN architecture in medical image segmentation, i.e., U-Net, to segment brain tumors in MR images. By leveraging the U-Net and conditional random field method, Chen et al. [19] proposed a two-pathway network to incorporate multi-scale inputs for tumor segmentation. These methods show the effectiveness of the U-Net under fully-supervision, especially with multi-modality data annotations. However, the segmentation performance under the weakly-supervised setting will be quite poor. In this case, the unsupervised domain adaptation applied to solve the brain tumor segmentation problem is required.

Unsupervised Domain Adaptation Methods
The unsupervised domain adaptation methods can be roughly categorized into two types, i.e., the one-step UDA methods and the multi-step domain adaptation methods. The one-step UDA methods often simply align the feature distributions of the two domains by minimizing their distances [20], [21]. For example, Tsai et al. [10] proposed a multi-level adversarial architecture to adapt structured output from a source to target domain for semantic segmentation. This method performs alignment on the original domain data, but it is difficult for the network to minimize the huge domain discrepancy.
By contrast, the multi-step UDA methods often introduce intermediate domains between the source and target domain in order to get a more smooth domain alignment. In existing methods, these intermediate domains are often generated by generative adversarial learning methods. For instance, Hoffman et al. [9] proposed to use an unsupervised image translator (i.e., Cycle-GAN [22]) to generate fake target images that have closer feature distributions to the target domain. Then, the unpaired fake image and target image were utilized to build a framework that can effectively guide the adaptation of the learned network.
A few attempts have also tried to address the UDA problem in medical image applications. [12], [23]. For instance, [24] proposed a UDA framework that uses cycleconsistencies to generate a faked source image, and then performs alignment on the fake and target image pair in the output space. The work combines the advantages of the existing methods proposed in [9] and [10]. However, these methods used partially the generated data information, which lead to limited domain alignment performance.

Overview of Framework
For simplicity, we construct the proposed BiGL framework between T 1 (as source domain) and T 2 (as target domain) MR images as an example to illustrate the overview architecture, as shown in Fig. 2. The proposed framework uses two unpaired images as the inputs, with each from one domain. Then, the framework is constructed with three main components: 1) A bidirectional image-to-image translator is firstly used to generate two synthesized images from the two input images. Then, 2) four shared-weighted segmentation networks are performed following the translator to segment over all the four images, including all the input images and the synthesized images. Finally, 3) A global-to-local adaptor is inserted between the segmentation networks to reduce the domain shift.

Bidirectional Cross-modal Image Synthesis
Domain shift is large between the source (T 1 ) and target domain (T 2 ) for the brain tumor segmentation task in multimodal MR images. Several studies [9], [24] proposed to use image translator to firstly reduce this gap. Therefore, we also tackle this domain shift problem by transferring image appearances to the counterpart domains before align the distributions of the two domains. Specifically, given the unpaired inputs x s ∈ S, x t ∈ T for the source and target domains, two synthesized images x s→t and x t→s are produced using an unsupervised image synthesis network proposed in [3], with an pix2pix [22] like generative adversarial learning paradigm. Specifically, for images from x s , the generator G of this method tries to generate images x s→t similar to x t . The objective function of the generator can be therefore written as, And the discriminator D tries to discriminate these two images, and can be written as, Obviously, the synthesized images convey the style information of the new modality and the texture information of the old one. Therefore, they can be regarded as intermediate samples for transferring from the source to the target domain. Afterward, different from the aforementioned methods that using only the synthesized target images (i.e., [9], [11]) for domain alignment, our method takes the effect of the source images to provide structural consistencies also in the source domain. In this case, our method also establishing a bidirectional adaptation scheme, other than the bidirectional image synthesis scheme. Then, the four images (i.e., two real and two synthesized images) are fed into an attention-based encoder-decoder network for segmentation.

Dual-attention based Segmentation Network
U-Net based models have been widely applied in brain tumor segmentation. However, it cannot identify the discriminative features for capturing high-level semantic cues. To suppress irrelevant regions while highlighting useful features for medical segmentation task, attention mechanisms (including Squeeze-and-Excitation mechanisms [25]) have been widely used in convolutional neural networks to enhance such an ability. Besides, the attention U-Net [26] is proposed to incorporate a gated attention mechanism into each level of the conventional U-Net in the up-sampling path. By contrast, we equip our U-Net with the dualattention mechanism proposed in [5] which applies not only spatial-wise but also channel-wise attention for high-level features. The dual-attention block is inserted in-between the encoding and decoding path of U-Net. The dual-attention U-Net can therefore effectively learn the feature relationships of high-level extracted features. Specifically, given a Global-to-Local Adaptor Fig. 2. The architecture of our proposed BiGL framework. We use the task of T 1 → T 2 as an example, which regards the annotated T 1 MR images as the source domain, and non-annotated T 2 images as the target domain. G T * →T * denote the generator for cross-domain image synthesis. "GT" denote the ground-truth.
feature of C channels with spatial dimensions of H ×W . The position-wise attention mechanism learns an H×W ×H×W dimensional mask to reveal the objective-oriented feature relationships inside each feature map. Similarly, the channelwise attention module of C × C dimensions reveals the salience in-between the feature maps. Given ξ as the input of the attention block, the output of each attention masked feature ξ A can be obtained by where A denote the abovementioned attention masks for each module, ξ B denote the feature before the attention block, and α is a learnable weight. The output of the dualattention module is the aggregation of the two attention masked features. More importantly, our experiments show that the proposed dual-attention U-Net improves the segmentation performance compared to the conventional U-Net model (See Section 4 for details).
Remarks. The motivation behind the attention-based U-Net is based on the supposition that the attention mask encodes the most discriminative image semantics, which is helpful for achieving an accurate adaptation between the two domains. Since the two domains cannot be fullyaligned with each other, for which existing UDA methods [9], [10], [24] tend to incorporate significant noise and in-consistency when using features or output masks for the alignment. Experiments show that our proposed attentionbased alignment led to an more effective adaptation scheme (See comparisons in Section 4.4).

Global-to-local Adaptation Module
With the cross-modality image synthesis, the distribution of the two domains are more likely to be located close together in the feature space. In addition, we propose a group of global-to-local alignment constraints to align the features of the images. These constraints include the outputspace, feature-level, and attention-level consistency learning (denote as L Att. consis ) which is applied on the masks (denote as A Att. ) learned by the two kinds of attention masks (denote as Att. = {P osition, Channel}). Following the existing domain alignment methods [11], we perform adversarial learning for the alignment of features and attention masks.
Different from the purely image-to-image translation task, the cross-domain segmentation task requires the real and fake images to maintain consistent semantic information. This constraints it to produce the same segmentation results. Therefore, for x s and x s→t , we first calculate the loss L s seg and L Syn.s seg using the cross-entropy loss and the generalized dice loss with a class-balance weight of w i = 1/num(x i ). Here, i ∈ {1, ..., c} denote the ith of c classes. Thus, the two losses can be formulated as follows: Then, the consistency for x s and x s→t is achieved by giving them the same ground-truths. The consistency for x t and x t→s is achieved by applying the output consistency constraint L output consis , since they do not have the ground-truth masks in training. This loss can be formulated by where y s denote the ground-truth label for the source image, and Φ (·) denote the overall operation of the abovementioned feature extractor.
In the meanwhile, the attention masks (i.e., m Att. t and m Att. t→s ) of unlabeled images are forced to be closer to the labeled images (i.e., m Att. s and m Att. s→t ). We achieved this domain alignment using adversarial learning. In this learning paradigm, the segmentation network is regarded as the generator to generate segmentation mask for the images from different images in a certain domain, and the discriminator D tries to discriminate the attention masks of the different input images. Therefore, the consistency L Att. consis for the source and target domain can be defined as follows: where A Att. denote the attention masks, where D Att. * denote the feature of discriminators in domain * ∈ {source, target}. Besides, the adversarial loss for the source (i.e., Ls Att. adv ) and target (i.e., Lt Att. adv ) can be defined by where y * is the indicator, where y * = 1 if the mask comes from the same domain. To leverage more information between domains, we also align the features after the attention block for the intra-domain images. This is commonly used as feature-level alignment in other UDA methods, eg, [9]. Similarly, the constraints of consistency loss and adversarial loss on the two domains for features can be defined by

Loss Function
Finally, we formulate the tumor segmentation, consistency learning and adversarial learning into a unified framework based on a UDA strategy. Thus, we can obtain the total loss by a weighted summation of all the previously defined loss functions, which is given by L total = L seg +λ out L output consis + λ syn (L G + L D ) +λ gtl (L F eat. adv + L F eat. consis + L Att. adv + L Att. consis ), (10) where L G and L D are the losses defined in the image synthesis network. The weights of these losses are set to 0.001, 0.1, 0.01 for λ out , λ gtl , and λ syn , respectively.

Implementation Details
Our method is implemented using the open-source framework PyTorch. The experiments are accelerated by four Nvidia Tesla V100 GPUs, with 32 GB memory for each. Note that the proposed framework can be trained end-toend. However, it is not efficient to train the image synthesis module and domain adaptation module simultaneously, as limited by the GPU memory and time. Therefore, in our experiments, we first train the image synthesis module, and then fix it to train the segmentation and domain adaptation module. Unlike the method in [9] which trains the generator after the discriminator becomes too strong, we train the backbone and the discriminators sequentially in each iteration. As the images are distinct from natural images, we do not use the pre-trained models from outside large scale datasets, e.g., ILSVRC, and randomly initialize the network parameters. We use the learning rate of 5 × 10 −3 to train our network, which is decayed by a polynomial policy with a power of 0.75. We train the model over 150 epochs. The learning rate of the discriminator is set to 5e − 5 without learning rate decay. The weights for segmentation consistency, feature consistency, position-and channel-wise attention consistency are set to 0.001, 0.1, 0.1, 0.1, respectively.

Datasets
We use the multi-modal Brain Tumor Segmentation Challenge 2019 (BraTS' 19) [14] dataset to evaluate the effectiveness of the proposed model. This dataset consists of 335 patients with manual delineations of three lesion regions, i.e., the necrotic and non-enhancing tumor core (NCR/NET), peritumoral edema (ED) and GD-enhancing tumor (ET). Each patient has multiple MR images, including T 1 , T 2 , T 1 Gd and T 2 FLAIR with the size of 240 × 240 × 155. These images are acquired from 19 institutions. We perform the experiments on adapting the segmentation network from T 1 to T 2 as our task, i.e., the network is trained on T 1 images and tested on T 2 images. We randomly partition the dataset by 70%,10% and 20% for training, validation and testing, respectively. The challenge evaluates the segmentation performance on three regions, i.e., whole tumor (WT), tumor core (TC), and enhancing tumor (ET). In particular, WT includes the areas of NCR/NET, ED and ET. TC includes the area of NCR/NET and ET. We follow this protocol and report the results in terms of Dice Similarity Coefficient (DSC) and 95% Hausdorff Distance (HD95), as also required by the challenge.

Comparison with State-of-the-Art Methods
We compare against the state-of-the-art unsupervised domain adaptation methods for segmentation. The methods are designed not only for medical images [24], but also for natural images [9], [10]. Specifically, the method in [9] (denoted as Cycada) leverages an unsupervised image-toimage translator to generate a synthesized distribution that is closer to the target domain. The method in [10] (denoted as AdaptSegNet) assumes that the structured outputs of the two domains are similar. Finally, the method in [11] (denoted as SIFA-TMI) combines the strategies of the abovementioned two methods. To determine the lower and upper bound of the UDA methods, we further conduct 1) the "Source Only" method, which is an unadapted method that trains the network on T 1 images and directly applies it to T 2 images, and 2) the "Target Only" method, which is fullysupervised on all the image modalities provided by the dataset (i.e., T1, T1c, T2 and FLAIR). The performance comparison in terms of DSC and HD95 is reported in Table 1 and 2. As can be seen, the domain gap between the T 1 and T 2 images in the brain tumor segmentation task is huge, with the Source Only method only obtaining an average performance of 10.86% in terms of DSC and 62.08 in terms of HD95. Compared with Source Only method, all UDA methods (in the second set of rows) have significantly improved the performance, with over 30% increase in DSC. And compared with AdaptSegNet, the performance of Cycada boosted the performance by 2.17%, 4.82%, and 6.20% for WT, TC and ET, respectively, with 4.39% in average. This suggest the effectiveness of the proposed image synthesis module for firstly reducing the domain gap by transferring the image appearances. Among the previous methods, SIFA network performs best with 60.20% and 17.21 in DSC and HD95, respectively. Compared with this method, BiGL network improves the performance greatly, increasing 9.43% in terms of DSC and decreasing 0.94 in terms of HD95. Besides, the performance of BiGL in terms of DSC consistently outperforms the previously best performing method SIFA in all the three classes. For the performance in HD95, BiGL also outperforms SIFA by decreasing the value from 14.89 and 19.29 to 13.19 and 17.38 for WT and TC, respectively. And it also performing comparable results for ET with 18.23, and finally get a 0.94 decreasing in average.

Visualization Results
We compare the segmentation results by BiGL with those produced by the state-of-the-art methods in Fig. 3. As can be seen, the Source Only method cannot generate segmentation as influenced by the huge domain gap. The AdaptSegNet tend to over-segment on TC, while generating less segmentations for WT. The SIFA (i.e., SIFA-TMI) method performs better in this case. However, it still generate less segmentations in both categories. The proposed method generates more precise results through all three classes.

Ablation Study
In the ablation study, we first evaluate the effectiveness of the proposed consistency learning constraints. The comparison of segmentation results in terms of DSC and HD95 are shown in Table 3 and 4, respectively. In the different rows, the proposed method is equipped with or without output, feature and attention consistencies. From these results, it can be observed that our full model with the output, feature and attention consistencies performs better than all competing methods. Besides, when incorporating more consistency learning constraints (see the third vs. second row in Table  3), the performance of the proposed method is consistently improved. By adding the attention consistency, the performance increases from 65.32% to 69.63% in terms of DSC,   and decreases from 17.04mm to 16.27mm in terms of HD95, which validates the effectiveness of the proposed global-tolocal adaptation strategy. We further evaluate the influence of the weight λ gtl with selected numbers {0.02, 0.1, 0.5}. The results are reported in Table 5. As suggested by the table, the model achieves the best overall performance with a weight of 0.1. Another observation is that, the DSC is not sensitive to the weight λ gtl . By contrast, as an indicator of the unique values in segmentation, HD95 is sensitive to the weight for feature and attention constraints. This reveals the effectiveness of these alignments for local representations.

Evaluation on Cardiac Substructure Segmentation Dataset
The generalization ability of the UDA methods is obviously more important than the fully-supervised methods. Therefore, we employed the Multi-Modality Whole Heart Segmentation (MMWHS) Challenge 2017 dataset for cardiac substructure segmentation as the benchmark dataset for additional evaluation. We use the training dataset which contains 20 MR and 20 CT images, for a fair comparison to SIFA-AAAI. In this dataset, besides the previously mentioned methods, we also involved the method in [22] (denoted as CycleGAN) and [24] (denoted as SIFA-AAAI). CycleGAN uses purely the image translator for domain adaptation. The target images are transferred to the source modality, and then segmented by the network trained in the source domain. SIFA-AAAI is the conference version of the method SIFA-TMI, with the comparable results to its journal version. For fair comparisons, we use the same training and testing data split to SIFA.
The segmentation performance for UDA task of {CT to MR} and {MR to CT} in terms of DSC and ASD are reported in Table 6 and 7, respectively. As suggested by the tables, Source Only performs also worse with a non-adaptation fashion, but is a little better than that in the case of brain tumor segmentation. This indicates the challenges of brain tumor segmentation task. For the task of CT to MR UDA  Moreover, the performance of BiGL on specific classes of AA and LVC is significantly better than previous methods. BiGL outperforms SIFA-TMI by 6.4% for AA in terms of DSC, from 81.3% to 87.7%, and 6.2% for LVC, from 73.8% to 80.0%.
To visualize the performance of BiGL, we also show the segmentation results for two typical cases, as displayed in Fig. 4. According to the figure, Source Only method still generate worse results, with almost wrong predictions in all four classes. Although in an unsupervised setting, BiGL method also performs well through these cases, and generates more complete contours and organ structures with high overlapping to the ground-truth.

CONCLUSION
In this paper, we have proposed an unsupervised attention domain adaptation method for cross-modality brain tumor segmentation. Our method integrates both bidirectional image-to-image transfer and representation alignments from global-to-local perspective, which can obtain better model generalization under the situation of large domain gaps. Specifically, our method leverages synthesized images for both modalities to produce intermediate data distributions between the source and target domains. In addition, we propose an attention adaptation to achieve an efficient adaptation. The experimental results demonstrate the effectiveness of the proposed model over the other state-of-the-art methods. Moreover, our framework is quite flexible and general, and can easily be extended to different UDA tasks for other modalities, such as T 1 and F lair, etc. Although the proposed method has obtained better performance than other methods, there is still significant room for improvement. Therefore, more precise domain alignment algorithms will be developed in future work.