Evaluation Kidney Layer Segmentation on Whole Slide Imaging using
  Convolutional Neural Networks and Transformers
The segmentation of kidney layer structures, including cortex, outer stripe,
inner stripe, and inner medulla within human kidney whole slide images (WSI)
plays an essential role in automated image analysis in renal pathology.
However, the current manual segmentation process proves labor-intensive and
infeasible for handling the extensive digital pathology images encountered at a
large scale. In response, the realm of digital renal pathology has seen the
emergence of deep learning-based methodologies. However, very few, if any, deep
learning based approaches have been applied to kidney layer structure
segmentation. Addressing this gap, this paper assesses the feasibility of
performing deep learning based approaches on kidney layer structure
segmetnation. This study employs the representative convolutional neural
network (CNN) and Transformer segmentation approaches, including Swin-Unet,
Medical-Transformer, TransUNet, U-Net, PSPNet, and DeepLabv3+. We
quantitatively evaluated six prevalent deep learning models on renal cortex
layer segmentation using mice kidney WSIs. The empirical results stemming from
our approach exhibit compelling advancements, as evidenced by a decent Mean
Intersection over Union (mIoU) index. The results demonstrate that Transformer
models generally outperform CNN-based models. By enabling a quantitative
evaluation of renal cortical structures, deep learning approaches are promising
to empower these medical professionals to make more informed kidney layer
segmentation.
Muhao Liu, Chenyang Qi, Shunxing Bao, Quan Liu, Ruining Deng, Yu Wang, Shilin Zhao, Haichun Yang, Yuankai Huo
Evaluation Kidney Layer Segmentation on Whole Slide Imaging using Convolutional Neural Networks and Transformers

###### Abstract

The segmentation of kidney layer structures, including cortex, outer stripe, inner stripe, and inner medulla within human kidney whole slide images (WSI) plays an essential role in automated image analysis in renal pathology. However, the current manual segmentation process proves labor-intensive and infeasible for handling the extensive digital pathology images encountered at a large scale. In response, the realm of digital renal pathology has seen the emergence of deep learning-based methodologies. However, very few, if any, deep learning based approaches have been applied to kidney layer structure segmentation. Addressing this gap, this paper assesses the feasibility of performing deep learning based approaches on kidney layer structure segmentation. This study employs the representative convolutional neural network (CNN) and Transformer segmentation approaches, including Swin-Unet, Medical-Transformer, TransUNet, U-Net, PSPNet, and DeepLabv3+. We quantitatively evaluated six prevalent deep learning models on renal cortex layer segmentation using mice kidney WSIs. The empirical results stemming from our approach exhibit compelling advancements, as evidenced by a decent Mean Intersection over Union (mIoU) index. The results demonstrate that Transformer models generally outperform CNN-based models. By enabling a quantitative evaluation of renal cortical structures, deep learning approaches are promising to empower these medical professionals to make more informed kidney layer segmentation.

Kidney mice cortex, Segmentation, Deep learning, CNNs, Transformer models Corresponding author: Yuankai Huo: E-mail: yuankai.huo@vanderbilt.edu

## 1 Introduction

Digital pathology has proven its prowess in quantifying digitized tissues using whole slide images (WSIs). It is acknowledged for facilitating remote analysis of diseased tissues, replacing labor-intensive manual pathology assessments[1] with computer-assisted methodologies. Region segmentation is of particular significance[2], a specialized branch of semantic segmentation, vital for precise diagnosis and treatment. Yet, the task of segmenting WSIs, particularly the intricate tissue structure of the kidney layer structures, presents challenges due to cell similarity across distinct regions.

This study aims to bridge this gap by conducting a comparative analysis of three widely used CNN models (U-Net[3], PSPNet[4], DeepLabv3+[5]) and three Transformer models (Swin-Unet[6], TransUNet[7], Medical-Transformer[8]) on kidney layer segmentation task. We compare the widely used approach to offer an overview of the functioning of deep learning in kidney layer segmentation. To our knowledge, we are among the pioneers in evaluating deep learning's segmentation capabilities for kidney layer structures.

To underscore the validation aspect of this research, we conducted a comprehensive series of experiments, each designed with precision and thoroughness, including: comprehensive evaluations of different models, comparing CNNs and Transformer models, testing against varying complexities within the dataset. By comparing the effectiveness of CNNs and Transformer models and applying them to mice kidney cortex segmentation, our study not only opens avenues for future research in this realm but also provides references for upcoming researchers grappling with model selection in kidney layer segmentation applications.
## 2 Method

### Overall framework

Fig.1 shows the overall framework of this study, including five main steps: (1) Annotations are imported onto the tissue image, exported as labels in GeoJSON format, and simultaneously, tissue images are exported in JPG format. (2) The exported labels are assigned different pixel values. Both labels and whole slide images (WSIs) are then downsampled by a factor of 3. Subsequently, the view is segmented into patches of 1024\(\times\)1024 pixels, using a half-step sliding window for smoother results. Patches with no pixel information are discarded, and incomplete patches are resized to maintain uniformity. (3) The page patches and label patches are matched and collated. (4) The collated patches are fed into various models for training, with temporary best-performing models saved every 10 epochs for potential later use. (5) The top-performing model is then used for prediction on new patches of size 1024\(\times\)1024, downsampled by a factor of 1. The model's predictions are overlaid and merged, yielding the final predicted WSIs.

\begin{table}
\begin{tabular}{l c c c c} \hline \hline Model & Acronym & Year & Backbone & Download URL \\ \hline U-Net[3] & U-Net & 2015 & VGG[9] & Link \\ \hline DeepLabv3+[5] & v3+ & 2018 & MobileNetV2[10] & Link \\ \hline Pyramid Scene Parsing Net[4] & PSPNet & 2016 & ResNet50[11] & Link \\ \hline \hline \end{tabular}
\end{table}
Table 1: CNN-Based Models

\begin{table}
\begin{tabular}{l c c c c} \hline \hline Model & Acronym & Year & Backbone & Download URL \\ \hline TransUNet[7] & TUnet & 2021 & Vision Transformer[12] & Link \\ \hline Swin-Unet[6] & SUnet & 2021 & Swin Transformer[13] & Link \\ \hline Medical- & MedT & 2021 & Gated Axial-Attention[8] & Link \\ Transformer[8] & & & & \\ \hline \hline \end{tabular}
\end{table}
Table 2: Transformer-Based Models

Figure 1: This figure shows general steps of the experiment. The WSIs are first tiled into patches. Then, six prevalent deep learning segmentation approaches are applied to all patches. Last, the patch-level results are assembled to WSI-level.
### CNN-Based methods

Three CNNs based models and three Transformer based models, which open-source code is available, are utilized in this study:

1. **U-Net3**: This network has a U-shaped design that uses convolutions, pooling, and up-convolutions. While it can handle segmentation tasks and learn from few labeled images, it requires a lot of computing power and can be expensive.
2. **PSPNet4**: This network uses a pyramid pooling module for segmentation, which may enhance performance under complex conditions. It excels at grasping the overall context without overlooking important details as it processes various regions of the image. However, it demands significant computational resources, which can increase memory usage and slow down processing.
3. **DeepLabv3+5**: It employs atrous convolutions and atrous spatial pyramid pooling (ASPP) to grasp the image context across various scales. Atrous convolution enables effectively capturing a broader context without adding computational demands. While ASPP integrates different scales, this increases the computational load, balancing out the benefits of using atrous convolution.

### Transformer-Based methods

1. **TransUNet7**: This framework uses a mix of CNN-Transformer architecture, blending the global contextualization benefits of transformers with the high-resolution spatial information strengths of CNNs.

Footnote 7: [https://github.com/faceface/](https://github.com/faceface/)
over 100 epochs, during which the entire set of approximately 4000 training patches were fed into the network in batches of 8. After each epoch, the total loss (Total_Loss) and validation loss (Val_Loss) were calculated, with the model achieving the lowest validation loss being saved for later evaluation. The performance of this model was then assessed against the complete test dataset using the mean Intersection over Union (mIoU) metric, as defined in Equation 1. Alongside mIoU, it is equally imperative to consider the Dice Similarity Coefficient (DSC), a critical metric to evaluate the spatial overlap accuracy between the predicted segmentation and the manual segmentation, ensuring a comprehensive evaluation of the model's performance. This score would further provide a robust assessment of the segmentation accuracy. Furthermore, to corroborate the robustness of each model, tests were conducted on a unseen dataset of 20 whole slide images (WSIs). The DSC indices generated from these WSIs for each model were employed to calculate descriptive statistical measures, including mean, median, and standard deviation, shown in the Table 3. These measures furnished a nuanced understanding of the performance consistency and reliability exhibited by each model. All relevant data have been tabulated and will be discussed in the following sections.

\[\text{mIoU}=\frac{1}{n}\sum\frac{A\cap B}{A\cup B} \tag{1}\]

where \(n\) is the number of classes. \(A\) is the area of prediction for a given class. \(B\) is the area of the manual segmentation for that class. \(\cap\) represents intersection (common area between prediction and manual segmentation). \(\cup\) represents union (total area covered by both prediction and manual segmentation). \(\sum\) represents the sum over all classes[14]. mIoU index is often used as a standard of performance by models in semantic segmentation, given its ability to take both false positives and false negatives into account, providing a comprehensive view of the model's performance. We compared the above three CNNs with these three transformer models.

## 4 Results

The performance metrics of each of the selected models for kidney layer segmentation are presented in Table 1 and Table 2. Each mIoU index displayed in Table 3 reported represents an average across all ten test slides. The DSC of six models is visualized in Fig. 3. Additionally, Fig. 2 provides a comparison of the predicted WSIs against their corresponding manual segmentation for four selected test slides. Based on mIoU index values, three Transformer models in this study generally outperform three CNN models. Among transformer models, Swin-Unet exhibits the best performance with an accuracy of 92.2%. This superior performance may be attributed to the model's unique architecture which effectively combines the benefits of the Transformer's global attention mechanism with the strong local feature extraction ability of U-Net. Moreover, Trans-Unet has the most stable performance as indicated by the standard deviation of 12.8. During the training process, Trans-Unet could have reached a better, more stable region in the solution space, leading to more consistent results. It's also possible that the specific features of the kidney mice cortex dataset are particularly well-suited to the Trans-Unet model, leading to more consistent performance. Furthermore, while Swin-Unet is purely Transformer-based network, Trans-Unet employs a hybrid CNN-Transformer architecture. It means that whether hybrid or purely Transformer-based architectures is not a single influential factor in the model's performance.

\begin{table}
\begin{tabular}{l c c c c} \hline Model & mIoU & median DSC & mean DSC & standard deviation DSC \\ \hline U-Net & 83.7 & 65.5 & 61.8 & 14.2 \\ \hline PSPNet & 83.7 & 71.0 & 67.5 & 15.9 \\ \hline DeepLabv3+ & 81.6 & 61.9 & 60.9 & 14.9 \\ \hline MedT & 88.5 & 72.3 & 70.1 & 17.0 \\ \hline Swin-Unet & **92.2** & **81.0** & **77.4** & 14.1 \\ \hline Trans-Unet & 91.9 & 80.1 & 76.0 & **12.8** \\ \hline \end{tabular}
\end{table}
Table 3: Comparison of Model Performances (%)
## 5 Conclusions

This research conducts a comparison between prevalent CNN and Transformer-based segmentation algorithms for kidney layer segmentation. The outcomes reveal that Transformer Models generally outperform CNNs in terms of performance. Notably, the Swin-Unet model attains the highest overall accuracy. This investigation underscores the significance of selecting appropriate models when handling complex datasets, showcasing the promising capabilities of Transformer models. It is anticipated that this study will serve as a point of reference for forthcoming research on the novel task of kidney layer segmentation, thus providing valuable assistance to future endeavors in this domain.

Figure 3: This figure shows mIoU scores on 20 WSIs of all six models

Figure 2: This figure shows comparisons between manual segmentation and predictions.
## 6 Acknowledgments

This work has not been submitted for publication or presentation elsewhere. This work is supported in part by NIH R01DK135597(Huo), DoD HT9425-23-1-0003(HCY), and NIH NIDDK DK56942(ABF).
