{'fraction_non_alphanumeric': 0.03319809069212411, 'fraction_numerical': 0.009713603818615751, 'mean_word_length': 4.988423610118622, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
BCS-Net: Boundary, Context and Semantic for Automatic COVID-19 Lung Infection Segmentation from CT Images

The spread of COVID-19 has brought a huge disaster to the world, and the automatic segmentation of infection regions can help doctors to make diagnosis quickly and reduce workload. However, there are several challenges for the accurate and complete segmentation, such as the scattered infection area distribution, complex background noises, and blurred segmentation boundaries. To this end, in this paper, we propose a novel network for automatic COVID-19 lung infection segmentation from CT images, named BCS-Net, which considers the boundary, context, and semantic attributes. The BCS-Net follows an encoder-decoder architecture, and more designs focus on the decoder stage that includes three progressively Boundary-Context-Semantic Reconstruction (BCSR) blocks. In each BCSR block, the attention-guided global context (AGGC) module is designed to learn the most valuable encoder features for decoder by highlighting the important spatial and boundary locations and modeling the global context dependence. Besides, a semantic guidance (SG) unit generates the semantic guidance map to refine the decoder features by aggregating multi-scale high-level features at the intermediate resolution. Extensive experiments demonstrate that our proposed framework outperforms the existing competitors both qualitatively and quantitatively.

WHO, including more than 6 million deaths. Especially, the new wave of epidemics caused by the Delta and Omicron variants of COVID that broke out in India, South Korea, and Hong Kong from 2021 is more contagious, the global epidemic situation still cannot be relaxed.
As a rapid and large-scale COVID-19 testing method, the RT-PCR testing has been widely adopted worldwide, but its false negative rate is as high as 17% to 25.5%, which is only suitable for preliminary screening. In clinical practice, to make a definite diagnosis of suspected cases and determine an appropriate treatment plan, lung imaging interpretation by ultrasound [1], [2], X-rays [3]- [5] or computed tomography (CT) [6]- [13] is an indispensable link. However, different imaging devices have their own advantages. Ultrasound can propagate in a certain direction and penetrate objects. Based on the principle that ultrasonic waves generate echoes, we can collect and display such echoes on the screen through instruments to understand the internal structure of objects, as shown in the first row of Fig. 1(a). X-ray examination uses the penetrating power of X-rays that travel through the body to a detector on the other side. Due to the different absorption of X-rays by bones, muscle tissues and air, an image with different gray levels from black to white is formed, as shown in the second row of Fig. 1(a). Computed tomography (CT) scans a certain part of the human body with X-ray beam to obtain a cross-sectional or three-dimensional image of the part being examined, which can clearly display the organs and structures, as shown in the third row of Fig. 1(a) and Fig.  1(b). Comparing these three imaging techniques, ultrasound can detect the consolidation of lung tissue, and X-ray has a good ability to show the presence of large areas of infected areas. However, these are based on the fact that the virus infected by the patient has developed to a certain stage. By contrast, the chest CT scans show clearer structures, have better sensitivity and accuracy than traditional chest X-rays and ultrasound waves, and can detect subtle lesions in the early stages of lung infection. Based on the characteristics of different data, ultrasound data and X-ray data are more suitable for follow-up observation of patients with pulmonary infection after diagnosis, and their convenience and low cost have great advantages. However, CT images show the irreplaceable role of the lung cavity in the definite diagnosis and early diagnosis, which has been accepted and adopted by the international medical community. However, problems such as the surge of patients, the shortage of professional doctors, and the huge workload can easily delay diagnosis and even cause misjudgment. To this end, artificial intelligence technology can be used to automatically interpret the CT images, and provide auxiliary diagnosis information such as infection area classification and segmentation, thereby reducing the workload of doctors and improving the accuracy of screening. From this point, correct segmentation of the COVID-19 infection regions is critical for timely treatment of patients, and the research work in this paper takes this as a starting point to achieve accurate and efficient COVID-19 lung infection segmentation. Therefore, in the research sense, our proposed method in this paper uses artificial intelligence technology for COVID-19 infection segmentation, which can improve the segmentation accuracy and reduce the work pressure of radiologists. In recent years, the vigorous development of deep learning has greatly promoted the development of computer visionrelated fields [14]- [32]. Among them, medical image segmentation algorithms have made great progress and achieved a qualitative leap in performance, such as lung nodules segmentation [33], breast-region segmentation [34], brain and brain-tumor segmentation [35], Brain Image Synthesis [36], polyp segmentation [37], COVID-19 infection detection [38], COVID-19 forecasting [39], and COVID-19 infection segmentation [8], [12] etc. However, differences in imaging equipment and disease characteristics make it difficult to use a unified segmentation model for different diseases. Researchers often need to design some unique modules to better achieve lesion area segmentation. Observing an example shown in Fig. 1, we can summarize three difficult problems that the COVID-19 lung infection segmentation models need to solve: (1) The infection regions of COVID-19 are very scattered, with many isolated areas of various sizes, which are very challenging for complete detection. Moreover, the sizes of the infected areas varies greatly, which makes it more difficult to accurately detect the infected areas of different scales. In addition, the boundary of the infection region is not easy to segment accurately and sharply. To this end, we can seek a solution from the perspective of encoder features containing relatively rich and effective information, which can be used to guide the feature learning in the decoder stage. Concretely, we propose an Attention-Guided Global Context (AGGC) module to  select the most valuable information from encoder features  for decoder, where the spatial attention and boundary  attention are used to provide more accurate important  spatial and boundary guidance information, and the global  context modeling unit is used to model the global context  dependence and constrain the generation of more complete  segmentation result. (2) The infected areas have many detailed boundaries, and more attention needs to be paid to the clearness and sharpness of the boundaries in the segmentation results. From a clinical point of view, the boundary of the infected area is of great significance for diagnosis. However, due to the pooling or up-sampling/down-sampling operation, the CNN-based method may blur the boundaries of the segmentation result. To generate a clearer and sharper boundary, we introduce boundary guidance in the proposed network. In addition to introducing the supervised learning of the boundary map, we also treat the generated boundary map as an attention weight to highlight the encoder features in the AGGC module and allow the boundary constraint to play a greater role in the network. (3) For the COVID-19 infected lung CT image, although the processed data is only limited to the image of the lung area, the background regions are relatively complex and there are still a lot of interferences, such as inflamed areas that are not infected by COVID-19. Therefore, it is crucial to effectively suppress background noises. Considering that the high-level features including more semantic and category attributes can be used to suppress complex backgrounds, we design a Semantic Guidance (SG) unit to aggregate multi-scale high-level features and formulate a semantic guidance map to refine the decoder features. Moreover, in order to alleviate the information loss from multiple sampling operations and maintain the correlation between feature maps of adjacent scales, the multi-scale feature fusion is unified on the intermediate resolution to generate the semantic guidance map.
In summary, we propose an automatic COVID-19 lung infection segmentation network with the encoder-decoder structure, equipped with three Boundary-Context-Semantic Reconstruction (BCSR) blocks. Although the encoder-decoder architecture is a common structure in medical image segmentation, we make a delicate design in it to cope with the special characteristics of the COVID-19 infection segmentation task, such as relatively scattered infected regions, more boundary details, complex backgrounds and noisy interferences. First, in order to address the problem of inaccurate and incomplete detection caused by the scattered infected regions, we design an AGGC module to select the most valuable information from encoder features for decoder, which highlights the important spatial and boundary locations in an attention manner, and models the global context dependence for the complete segmentation. Second, in order to achieve the sharp boundaries of the final segmentation result, we introduce the BA unit by adding the boundary supervised learning and boundary map refinement.
Third, in order to suppress the background interferences, a SG unit is designed to aggregate multi-scale high-level features and formulate a semantic guidance map to refine the decoder features. All modules cooperate with each other to make our network achieve the competitive performance. As shown in Fig. 1(c), our proposed method has advantages in detection accuracy, completeness, clarity and sharpness. The main contributions of this paper are as follows: • An end-to-end network, named BCS-Net, is proposed to achieve automatic COVID-19 lung infection segmentation from CT images, which models the boundary constraint, context relationship, and semantic guidance. Moreover, our network achieves the competitive performance on the publicly available dataset both qualitatively and quantitatively. • An AGGC module is designed to filter the most valuable encoder information for decoder, which highlights the important spatial and boundary locations in an attention manner, and models the global context dependence for the complete segmentation. • A SG unit is proposed to aggregate multi-scale highlevel features and generate the semantic guidance map to refine the decoder features, in which the multi-scale fusion is unified on the intermediate resolution to alleviate the information loss and maintain the correlation between adjacent scales.

II. RELATED WORK
In this section, we will briefly introduce some related works in COVID-19 diagnosis based on deep learning for CXR and CT images, such as classification, segmentation. There exist lots of deep learning-based segmentation methods, such as Mask R-CNN [40], YOLACT [41], Deeplab [42], FCN [43], etc, which have made great achievements in segmentation tasks of various scenes and can be used for the medical segmentation task. But there are some differences between medical images and traditional ordinary images. Taking the COVID-19-infected lung CT image as an example, the areas to be segmented are usually scattered, with more details, complex backgrounds, and more interfering noises. Therefore, after the emergence of the U-Net [44], it has gradually become the infrastructure for medical image segmentation and even general image segmentation tasks. Its success lies in the fact that a symmetric encoder-decoder structure with skip connections can better and more comprehensively utilize features at different levels, thereby generating more taskdiscriminative representations and improving performance.
Due to the high sensitivity and clarity of CT images, most of the current diagnosis of COVID-19 is based on CT images, including segmentation [6]- [11]. In practice, segmenting the key area from chest CT can provide useful information for medical staffs to diagnose the COVID-19, including GGO (Ground Glass Opacity) and consolidation. So far, many COVID-19 lung infection segmentation methods from CT Images based on deep learning have been proposed, and promising performance has been obtained. Zhou et al. [6] proposed an automated segmentation network by integrating the spatial and channel attention mechanisms. Fan et al. [8] designed the parallel partial decoder, reverse attention, and edge-attention to boost the segmentation accuracy, and also provided a semi-supervised framework to alleviate the shortage of labeled data. Paluru et al. [9] proposed an anamorphic depth embedding-based lightweight CNN to segment anomalies in COVID-19 chest CT images, which incorporates fully convolutional anamorphic depth blocks with depth-wise squeezing and stretching after the down-sampling and upsampling operations. Wang et al. [10] proposed a noise-robust learning framework based on self-ensembling of CNNs. Han et al. [11] proposed an attention-based deep 3D multiple instance learning (AD3D-MIL) to achieve the goal of accurate and interpretable screening of COVID-19 from chest CT images.
In these previous works, some ingenious and effective structures were designed, which achieved good performance and brought us a lot of inspiration. However, the existing work does not fully consider the following two points: (1) the loss of semantic information caused by oversampling in multilayer feature fusion; (2) the correlation between contextual information and semantic information plays an important role in complete segmentation. For the first issue, we use the middle scale as the output criterion in the SG unit to generate the semantic guidance mask, which avoids excessive up-and down-sampling of a single layer in the multi-layer feature fusion. As for the second issue, we design an AGGC module to select the most valuable information from encoder features for decoder, which can not only highlight the important spatial and boundary locations, but also perceive the global correlation between different areas.

III. PROPOSED METHOD
A. Overview Fig. 2 illustrates the overall framework of our proposed BCS-Net to achieve the COVID-19 lung infection segmentation from CT images. Our network follows an encoderdecoder architecture in an end-to-end manner, in which the backbone extractor [45] in the encoder stage aims to extract the top-down multi-level features, and the decoder stage includes three progressively Boundary-Context-Semantic Reconstruction (BCSR) blocks to learn the segmentation-related features and generate the segmentation mask. In each BCSR block, we jointly consider the global semantic guidance, context dependence modeling, and boundary attention refinement to provide more sufficient supplementary information for feature decoding. Specifically, in order to deal with the problem of scattered lesion location and irregular shape, we design an attention-guided global context (AGGC) module, which selects the most valuable encoder propagation features by performing attention and context modeling on the encoder features of the corresponding decoder layer. As shown in correlate the different locations to consistently detect the lesion regions and generate the enhanced encoder features.
With the guidance of the enhanced encoder features, the initial decoder features of the current level are generated by combining with the previous decoder features generated by the previous BCSR block. Furthermore, considering the importance of high-level semantic information for suppressing irrelevant background noises, we design a Semantic Guidance (SG) unit to aggregate multi-scale high-level features and formulate a semantic guidance map, which is further combined with the decoder features by means of residual connection to obtain the corresponding final decoder features: is channelwise concatenation operation, f i aggc are the output features generated by the AGGC module, S s denotes the semantic guidance map generated by the SG unit, represents elementwise multiplication, δ(·) denotes the ReLU activation, and conv(·) is a customized convolutional block. At each BCSR block, we use a convolutional layer with the kernel size of 1 × 1 to produce the corresponding segmentation map S i : where conv 1×1 denotes a convolutional layer with the kernel size of 1 × 1, and σ(·) is the Sigmoid activation. Our network produces five side-output maps (S b , S s , S 4 , S 3 , S 2 ), where the output S 2 of the last BCSR block is used as the final infection segmentation mask.

B. Attention-Guided Global Context Module
The clinical practice and data analysis have demonstrated that the pneumonia lesion areas, including the COVID-19, have no specific distribution characteristics and are generally scattered. Moreover, lung opacities in the CT image are inhomogenous, and there is no clear center or boundary. These undoubtedly pose great challenges to the segmentation model, including: (1) The scattered lesion areas can easily lead to missed detection or incomplete detection; (2) The boundary of the lesion area is not easy to segment accurately and sharply. To address these issues, we introduce more effective and valuable short-connection encoder as guidance. The evolution of encoder features is specifically manifested in two aspects: First, we use spatial attention and boundary attention to filter the features in terms of highlighting the important spatial locations and boundary details. Second, we capture the context dependence of different regions which constrains the generation of more complete and accurate segmentation result. The overall architecture is illustrated in Fig. 3. The AGGC module can not only ensure the integrity of the features of the local lesion area, but also perceive the global correlation between different areas. The specific process is as follows.
Although the encoder features can provide rich details and other useful information for the decoder, it also has much redundancy. Therefore, the spatial attention [46] is introduced to modify the encoder features from the spatial dimension, focusing on highlighting the important spatial positions. Specifically, we first apply the average-pooling and max-pooling operations along the channel axis on the input features, and then concatenate them to generate an efficient feature descriptor. Finally, a convolution layer with the kernel size of 3×3 followed by a sigmoid function is used to generate a spatial attention map A i s : where avepool and maxpool denote the average-pooling Sigmoid avepool maxpool Fig. 3. Illustration of the proposed AGGC module, integrating the important locations, boundary details, and global context. "SA" is the spatial attention unit, "S b " denotes boundary attention map generated by the BA unit, "GCM" is the global context modeling unit that models the global context dependence, and "G" is the global context-aware feature map. and max-pooling along the channel axis, respectively. With the spatial attention map, the initial encoder features f i can be refined as spatial-enhanced features f i s via residual connection: where represents element-wise multiplication. The visualization of spatial-enhanced features is shown in Fig. 4(c). It can be seen that the spatial-enhanced features have a high response in the infected area to be segmented, and a low response in the irrelevant background area, thus achieving the effect of highlighting important spatial locations and suppressing interferences.
As mentioned above, segmenting the lesion areas with clear and definite boundary is very important for diagnosis. In order to maintain the sharpness and clarity of the boundary in each decoding stage, we directly use the boundary map S b generated by the BA unit to emphasize the important boundary details. To highlight the boundary locations without losing other important information, we still use the residual connection for integration: where f i b represents the boundary-enhanced features, and S b is the boundary map generated by the BA unit.
In addition to highlighting the important location and boundary of the initial encoder features, we also need to solve the problem of incomplete detection caused by scattered lesions. Therefore, modeling the dependencies between different pixels is an effective solution. In this way, if an infected area is segmented, other scattered interference areas highly related to it may also be located. To this end, we introduce the global context modeling (GCM) unit to achieve feature alignment and mutual enhancement between features by modeling the dependencies between different locations in the feature map. Following [47], we first learn the global context-aware feature map G i by measuring the influence of the embedding features of all other spatial locations on the current location: where f i b are the normalized boundary-enhanced features, the inverse operator of (·), ⊗ is the matrix multiplication, ω i is the global context relationship map, and N orm is the normalization operation. Then, the G i that encodes the global context relationship is used to further refine the boundaryenhanced features in a residual connection manner: where ς is a learnable weight parameter that controls the contribution of the global contextual information. The entire AGGC model adopts a progressive enhancement structure, which not only highlights important spatial locations and boundary details, but also encodes the context dependencies between different spatial positions. The operation sequence of these three enhancement strategies is spatial attention, boundary attention, and global context. The reasons for this design are as follows: For encoder features with rich information, reducing redundancy is a primary task, otherwise the continued existence of redundancy in the later learning process will weaken the expression of features; Then, in order to ensure that the boundary details are well preserved and highlighted, we apply the boundary attention to spatialenhanced features; Finally, calculating the global context dependence on relatively clear and distinct features after spatial and boundary enhancements can further strengthen the discrimination of features. This process can obtain encoder features with prominent spatial positions, highlighted boundary details, and comprehensive global context, which can then be used as the guidance for decoder features.

C. Boundary Attention Unit
For the medical image segmentation task, especially the COVID-19 segmentation where the lesion areas are scattered throughout the image, it is particularly important to clearly and accurately outline the boundaries of the lesion areas for later diagnosis. If only the semantic information of each pixel is considered and the boundary information is ignored in the segmentation process, this may cause the boundary of the segmentation result to be blurred and not sharp enough.
Inspired by [8], [48], we introduce the boundary constraint into our approach by utilizing the boundary attention unit, as shown in Fig. 5. On the one hand, we also introduce the boundary supervised learning to the network. In this way, the network can gradually learn the features of generating a clear boundary map. Specifically, the low-level features f 1 are fed into three convolution layers with different kernel sizes, and then a sigmoid function is employed to generate the final boundary attention map: where f 1 are the encoder features of the first layer, conv n×n denotes the convolution layer with the kernel size of n×n. The learning process of boundary attention map is a supervised learning manner, which can guarantee the effectiveness and pertinence of learning. As shown in Fig. 4(d), the boundary attention map S b effectively highlights the boundary positions of the infected regions to be segmented, which can be further used to refine the high-level features in the AGGC module.
In addition to generating boundary map through label supervised learning, we also treat the generated boundary map as an attention weight to highlight the encoder features as introduced in Eq. (5). Different from the work [8], we did not use the boundary features to perform feature enhancement. Instead, we adopt a method similar to spatial attention, treat the generated boundary map as an attention map, and use the residual connection for feature enhancement. In this way, boundary constraints can be introduced more intuitively and efficiently, and at the same time, unnecessary information redundancy in the feature space can be reduced. This boundary attention map will be used to enhance all the high-level features (i.e., f 2 , f 3 , f 4 ).

D. Semantic Guidance Unit
The features learned by different encoder layers include different information. For example, the low-level features highlight the details of the scene such as the texture and boundary, while the high-level features tend to learn the semantic and category attributes of the scene. For the segmentation task of COVID-19 lesion areas, there are relatively more background interferences, and how to effectively suppress them is particularly important. Considering the importance of high-level semantic information for suppressing irrelevant background interference, we design a Semantic Guidance (SG) unit to aggregate multi-scale high-level features and formulate a semantic guidance map to refine the decoder features.
For the feature fusion of different scales, the correlation between feature maps of adjacent scales on the feature pyramid is the strongest. However, in the previous multi-scale feature fusion methods, some features are usually up-sampled or down-sampled multiple times, which will lose the semantic information of the original features and even cause semantic ambiguity. Based on this, we try our best to avoid the worthless and unadvisable multiple cross-scale sampling of single layer. As illustrated in Fig. 2, the spatial resolution of high-level features f 2 , f 3 , f 4 are unified on the intermediate resolution of the third encoder layer, which not only avoids the information loss due to multiple sampling, but also preserves the correlation between adjacent-scale features to the utmost extent. To be more specific, the encoder features f 2 and f 4 are ×2 down-sampled and ×2 up-sampled to the resolution of features f 3 respectively, and then they are fused together to obtain a semantic guidance map through the addition and convolution operations. The process can be formulated as: where up 2 and down 2 are the ×2 spatial up-sampling and down-sampling, respectively. The learned semantic map S s encodes the multi-level semantic information, which is served as a global guidance in BCSR block. Since we choose the middle layer as the scale standard of feature output, the semantic map S s only needs to be down-sampled once in the first BCSR block and up-sampled once in the last BCSR block, respectively. It effectively avoids the multiple crosslevel sampling of S s and retains the feature information of S s to the maximum extent.

E. Loss Function
For the supervision of network, the overall loss function involves two parts: (1) The segmentation loss on three decoder outputs (i.e., S 2 , S 3 , and S 4 ) and the semantic loss on the semantic map S s via weighted IOU loss and weighted BCE loss. Inspired by [49], [50], the weighted IOU loss provides effective global (image level) supervision, and the weighted BCE loss provides effective local (pixel level) supervision. Combining them, accurate segmentation result can be obtained from the image level and pixel level, which is defined as: where l k wiou and l k wbce denote the weighted IOU loss and weighted BCE loss on different supervision types respectively, P k is the prediction map (i.e., S 2 , S 3 , S 4 , S s ), G is the segmentation ground truth, w and h are the width and height of the input image, (x, y) denotes the coordinate of each pixel in image, and ε is a weight hyperparameter. (2) The boundary loss l b bce on the boundary attention map S b via standard BCE loss, which is defined as: where G b is the boundary ground truth, and P b is the predicted boundary map. Therefore, the overall loss function can be defined as: IV. EXPERIMENTS

A. Datasets and Evaluation Metrics
At present, there are few public COVID-19 lung CT datasets for infection segmentation. In order to have relatively sufficient samples for training, we merged the two public datasets [51], [52] to obtain 1018 high-quality CT images, and further divided them into 719 training images and 300 testing images. For each CT slice, it contains the corresponding infection mask, and the infection edge obtained from infection mask using the Canny operator. Note that, the COVID-19 classification aims to determine whether lung CT images are infected with COVID-19, and the datasets used should contain normal and abnormal data. In contrast, the purpose of COVID-19 infection segmentation is to locate the infected area accurately and completely, so the default option is that the infected area is present in every CT image of the used dataset. In other words, consistent with existing methods [8], [10], [13], all images in the dataset [51], [52] we use are COVID-19 infection data.
Following [8], six metrics are employed for quantitative evaluation, including Precision (P rec), Recall (Recall), Dice Similarity Coefficient (DSC) [53], Structure Measure (S m ) [54], Enhance-alignment Measure (E φ ) [55], and Mean Absolute Error (M AE) [56]. The Precision (P rec) calculates the ratio of true positive cases in the results predicted as positive cases, and the Recall (Recall) score only focuses on the rate that the real label is correctly predicted, which can be computed as: where T P , F P , and F N are the true positive, false positive, and false negative, respectively. Dice Similarity Coefficient (DSC) is a spatial overlap index and a reproducibility validation metric, which evaluates the overlap ratio between prediction map (P ) and ground truth map (G): Structure Measure (S m ) calculates the similarity between prediction map and ground-truth mask, including a regionaware structural similarity measure S o and an object-aware structural similarity measure S r , which is calculated as: where α ∈ [0, 1], we set α = 0.5 in our implementation suggested in the original paper. Enhance-alignment Measure (E φ ) captures global statistics and local pixel matching information to account for both pixellevel and image-level properties, which is defined as: where h and w are the height and the width of the input image, and (x, y) denotes the coordinate of each pixel in prediction map and ground truth. Mean Absolute Error (M AE) measures the errors between prediction map and ground truth: For these six measurements, in addition to the MAE score, all other indicators are that the larger the value, the better the performance.

B. Training Strategies and Implementation Details
We implement the proposed network via the PyTorch toolbox and is accelerated by an NVIDIA GeForce RTX 2080Ti GPU. We also implement our network by using the MindSpore Lite tool 1 . The Res2Net-50 [60] pretrained on ImageNet [61] is employed as the backbone feature extractor in the experiment. We have two points in particular to note: (1) The fundamental reason we choose Res2Net-50 as the backbone network is for fair comparison, so we follow the setting of Inf-Net [8]. In addition, its technical advantages (e.g., hierarchical residual-like connections within one single residual block, multi-scale features at a granular level, and increased range of receptive fields) and low computational cost are also the reasons for our choice. (2) The way we load the pretrained ImageNet data is consistent with existing work [8], [62]. Specifically, it is well known that CT images are grayscale, and when we load the CT image, we still use the RGB three-channel method, but the corresponding pixel values in the three channels are the same. In order to computational efficiency, we resize all the training and testing images to 352 × 352. The batch size is 8 and the training process converges until 200 iterations. We use Adam [63] as a learning rate optimizer with betas of (0.9, 0.999), and the learning rate is set to 3e −4 . The training loss curve of our network is shown in Fig. 6. The average inference time of our method is 0.036 second (27 FPS) for processing an image with the size of 352 × 352, the GFLOPs is 28.02, and the parameters are 44, 822, 580. The code and results of our BCS-Net can be found from the link of https://github.com/rmcong/ BCS-Net-TIM22.  [44], Resnet34-UNet [44], UNet++ [57], Attention-UNet [58], CE-Net [59], FCN [43], Inf-Net [8], AnamNet [9], and CopleNet [10].
1) Qualitative Comparison: Fig. 7 shows the qualitative comparisons of our model with the other state-of-the-art methods. It can be seen that the results of our method have greater advantages in terms of detection accuracy, completeness, and sharpness. For example, in the first image, the general medical image segmentation networks (e.g., UNet [44], UNet++ [57], Attention-UNet [58], Resnet34-UNet [44]) often cannot effectively suppress the interference of background regions, such as the areas between the two lungs. In contrast, the detection results of the COVID-19 segmentation network are better, but the existing methods (e.g., Inf-Net [8], CopleNet [10], and AnamNet [9]) cannot completely suppress these interferences. For example, the area under the left lung is not effectively suppressed. Our proposed method has better performance in these aspects, and has a stronger ability to detect details. The last image also confirms that our proposed method can accurately detect infected areas and suppress irrelevant background areas. In addition, our method has more complete structure and sharper boundaries. In the third image, the existing methods (e.g., Inf-Net [8], CopleNet [10], and AnamNet [9]) cannot completely and continuously detect the infected regions at the bottom of the left lung, while our method can detect them clearly, accurately, and completely. Moreover, compared with the existing methods (e.g., UNet++ [57], CopleNet [10], Attention-UNet [58]), our results have clearer boundaries, which are very important for doctors to diagnose and treat. In general, our method exhibits competitive visual effects in both the segmentation ability of the infected regions and the suppression ability of the background regions.
2) Quantitative Comparison: The quantitative comparisons are reported in Table I. In addition to the Precision score, our proposed BCS-Net achieves the best performance in other five measurements on the testing dataset. Compared with the classical segmentation models (e.g., UNet [44], UNet++ [57], Attention-UNet [58], Resnet34-UNet [44]), the well-designed methods for COVID-19 are more competitive. For example, compared with the UNet [44], the percentage gain of the Inf-  [57], and the performance is increased by 9.0% compared with the Resnet34-UNet [44]. For the infection segmentation method for COVID-19, our proposed BCS-Net achieves better performance. For example, compared with the second best method, the percentage gain of DSC is 1.9%, the Recall score is 1.8%, and the E φ score achieves 1.0%. In general, our detection effect is superior in quantitative measurements.

D. Ablation Study
We conduct several ablation experiments to validate the performance and effectiveness of two contributed components of our proposed model, including Attention-Guided Global Context (AGGC) module and Semantic Guidance (SG) unit. The results are given in Table II and Fig. 8.
Firstly, we verify the effect of AGGC module on the whole network. The main function of the AGGC module is to strengthen the important spatial position information and correlate the dependencies of different pixels, thereby ensuring a more accurate and complete detection. We remove the AGGC module, including the guidance of spatial attention and boundary attention, and the global context awareness. In other words, in the BCSR block, the decoding features of the previous layer will not enter the AGGC module but will be passed directly backwards. Compared with the No.1 and No.2 in Table II, without the AGGC module, the five indicators fell, and the MAE score remained flat. As shown in Fig. 8(d), after removing the AGGC module, there are unsuppressed interference noises in the upper left corner, upper right corner and lower right corner of the first image, and the boundaries  Secondly, in order to discuss the role of the SG unit, we design two ablation experiments. One is that we directly delete the SG unit, that is, without introducing global semantic information guidance. The other is that we replace the proposed SG unit with the PPD module in Inf-Net [8]. The related results are reported in No.3 and No.4 of Table II. Compared with the full model, all indicators will be reduced after removing or replacing the SG unit. In addition, we also found that the complex PPD model has three indicators (i.e., DSC, P rec, and Recall) that it is not as good as removing the SG unit directly. Comparing the SG and PPD modules of introducing global semantic guidance (i.e., No.1 and No.4), we can see that the designed SG model achieves better performance. After removing the SG module, the upper left and upper right regions in the first image of Fig. 8(e), the upper left region of the second image, and the upper right region of the third image have some irrelevant interferences that are not effectively suppressed. Replacing the SG module with the PPD module also does not improve the performance, and both the left region and the upper right background region in the third image are incorrectly detected as infected regions. Both ablation experiments illustrate the role of the SG module designed in this paper.
The final output of the network is derived from features at the second decoding stage mainly based on the following two points. First, we design the AGGC module to make full use of the features of the first encoder layer (f 1 ) to supplement boundary information for high-level encoder features (f 2 , f 3 and f 4 ). In implementation, the features f 1 are combined with f 2 , f 3 and f 4 through the AGGC module respectively. Under such a model framework, we do not perform the AGGC module in the last decoding layer, so the network does not set the output of S 1 . Second, as we all know, generating the final map at a lower resolution from a higher decoding stage will consume less computational resources, which is beneficial for computational efficiency. Moreover, it has been experimentally verified that its performance will not be obviously degraded. Table III presents the final segmentation results obtained by different decoding layers. It can be found that in general, S 2 achieves better performance than S 1 and S 3 , which also illustrates the effectiveness of our setup. Based on these observations and consideration, the output from the second decoding layer is used as the final segmentation result.

E. Failure Cases and Future Work
Compared with other methods, our algorithm achieves a more complete structure and more accurate details, but there is still a certain gap with segmentation ground truth, which we need to solve in the future. Some failure cases are shown in Fig. 9. It can be seen that the segmentation results of our method can maintain the structural integrity in the case of a large area of infection in the whole lung, but there will be some wrongly detected holes, as shown in the left image. In addition, our method also misses some extremely dispersed infected areas. For example, in the right image, many infected areas on the left are not detected, and some scattered infected areas on the right are mistakenly merged together. In the future, we can start from the following aspects to further improve performance. On the one hand, some popular and powerful backbones can be used in place of our basic feature extractor, such as ViT [64] and Swin Transformer [65], which can be used to model long-term dependencies in data through self-attention mechanism. On the other hand, the growth of training data can effectively promote the improvement of model performance and robustness. Therefore, in the future, we call on global scientific research institutions to open source relevant data in accordance with relevant regulations, so as to further promote the development and performance improvement of this field.

V. CONCLUSION
This paper focuses on COVID-19 lung infection segmentation task and proposes an end-to-end framework dubbed as BCS-Net to achieve this. The proposed network follows an encoder-decoder architecture equipped with Boundary-Context-Semantic Reconstruction (BCSR) blocks, which considers the boundary refinement, context modeling, and semantic constraint jointly. The attention-guided global context (AGGC) module is designed to select the most valuable encoder features from the perspective of important spatial/boundary locations and context dependence. Moreover, we design a new semantic guidance (SG) unit to provide the semantic guidance and suppress the background noises by aggregating multi-scale high-level features at the intermediate resolution. Extensive experiments and ablation studies demonstrate the effectiveness of the proposed BCS-Net architecture.