Abstract
Foundational models (FMs) based on advanced neural network architectures have demonstrated improved performance in pathology image analysis across various organs due to their increased generalizability. However, their clinical adoption requires explainability, as their black box nature limits transparency. Understanding the specific features these models learn for a given downstream task is crucial for explainability and integrating FMs into clinical workflows more effectively.
We propose a computational pipeline that enhances explainability by correlating domain-specific handcrafted features (HFs), with hidden features i.e., feature embeddings (FEs) from FMs. We correlate and combine HFs from Detectron 2 DeepLabv3+ segmentation with FEs from Prov-Gigapath (PG) and UNI FMs for improved explainability and performance. In this work, HFs are extracted from segmented functional tissue units, including arteries, tubules, globally sclerotic glomeruli, and non-globally sclerotic glomeruli. FEs are extracted at the tile and slide levels for PG and at the tile level for UNI. We use the Pearson correlation coefficient to identify significant correspondences between these feature sets.
To evaluate our proposed methodology, we use 56 diabetic nephropathy kidney biopsy whole slide images (WSIs) from Seoul National University Hospital. The task is to predict end-stage kidney disease (ESKD) two years post-biopsy using leave-one-out cross-validation on 56 WSIs, with 16 from ESKD patients and 40 from non-ESKD patients. We combine top correlated features from FEs of FMs with HFs and train logistic regression (LR) and nearest neighbor () classifiers. LR model trained on combined feature set improved accuracy, balanced accuracy, Matthew’s correlation coefficient, F1-score, precision, and recall to 0.8393, 0.7938, 0.5993, 0.8377, 0.8367, 0.8393 respectively, when compared to LR and models trained on individual feature sets. PG excelled in specificity (1.000) and AUROC (0.8281), while UNI showed superior AUPRC (0.7813) performance. We also present feature explainability maps corresponding to each feature in FE.
Keywords: Diabetic nephropathy, end stage kidney disease, digital pathology, classification, explainability, feature embeddings, foundation models
1. INTRODUCTION
Foundation models (FMs) are large-scale artificial intelligence (AI) models trained using self-supervised learning (SSL) on a diverse range of data. They represent a significant advancement in AI development, with applications spanning various fields such as radiology,1 genomics,2 coding,3 and mathematics.4 In the domain of digital pathology, several FMs have been developed, including Prov-Gigapath (PG),5 UNI,6 Virchow,7 RudolfV,8 and Hibou.9 These models have been trained on hundreds of thousands of slides from various data sources and organs, enabling them to produce hidden features i.e., feature embeddings (FEs) which are generalizable.
Previous studies have used handcrafted features (HFs),10 neural networks,11 and a combination of neural networks and HFs12 to perform predictions. Providing a physical interpretation to FEs is crucial for helping clinicians to use them in a clinical setting. Popular techniques for visualizing and understanding the decisions made by deep learning models, particularly convolutional neural networks, include class activation mapping13–15 and attention-based methods.16, 17 These techniques enhance clinicians trust in FMs and facilitate their use in clinical settings. However, interpreting the FEs from FMs in digital pathology remains largely unexplored. Our contributions in this paper are summarized as follows:
Propose a computational pipeline for explainability of FEs of FMs by correlating them with HFs.
Propose a methodology to combine FEs and HFs to enhance accuracy.
Apply the proposed methodology to build a computer-assisted diagnosis model that can predict ESKD.
Our research work enables better integration of FMs into clinical settings.
2. METHODS
We predict end-stage kidney disease (ESKD) two years post- biopsy using leave-one-out cross-validation. We used data from 56 participants with type 2 diabetes who were recruited at the Seoul National University (SNU) Hospital to evaluate our methodology. The biopsy WSIs were stained histologically using periodic acid-Schiff (PAS). Of the 56 WSIs, 16 were from patients who developed ESKD, and 40 from those who did not. Data collection followed protocols approved by the Institutional Review Board at the SNU College of Medicine (H-1812-159-998), Seoul, Korea, and all experiments complied with federal guidelines and regulations.
In this work, we develop a methodology for predicting the pathological meaning of the FEs produced by FMs and also propose a computational module to combine useful features from FEs of various FMs with handcrafted features to improve performance on the downstream tasks. Fig. 1 shows the computational pipeline developed in this research work. Our methodology comprises of the following steps:
Fig. 1:

A schematic diagram that illustrates the proposed computational pipeline for obtaining explainable features from histopathology FMs. HFs and FEs are extracted from the segmentation pipeline and the FMs respectively. Thereafter, a feature ranking module is used to rank the FEs using HFs via correlation analysis. Then we fuse the top features in FEs with HFs for the downstream analysis.
Preparation and Preprocessing:
First, we utilize Otsu thresholding technique18 to segment the WSIs into foreground and background, divide them into non-overlapping tiles, and filter out those with more than 90% background. These tiles are passed through FMs. UNI and PG FMs take a tile of size 224 × 224 and 256 × 256 respectively.
Foundation Model Embeddings:
Thereafter, FEs are derived from the pre-trained FMs PG and UNI, which provide robust representations of the WSIs. For the PG model, tile-level embeddings (TLE) are obtained from the last_layer_embed layer, with each tile embedding having dimensions of 1536 × 1. These embeddings are averaged to obtain a single representation of a WSI at the tile level. Additionally, we obtain slide-level embeddings (SLE), using slide-level encoder based on the LongNet architecture, which generates contextualized 768 × 1 embeddings from TLE. For the UNI model, we can only obtain TLE as there is no slide level encoder. Each 1024 × 1 TLE from UNI is averaged to obtain a single representation of a WSI.
Tissue Segmentation and Histomorphometry Features:
We utilize a multi-compartment segmentation algorithm, as detailed in our previous work,19 to segment different functional tissue units (FTUs) including arteries, renal tubules, globally sclerotic glomeruli, and non-globally sclerotic glomeruli in the PAS stained WSIs. Our approach employs the DeepLabv3 model,20 pre-trained on a large dataset of renal tissue biopsy WSIs, to achieve precise segmentation of FTUs. The multi-compartment segmentation algorithm is based on a panoptic model which provides a robust framework for segmenting various FTUs providing generally high performance, enabling effective feature extraction.21 From each segmented FTU, we extract a set of 72 HFs, encompassing various morphological, textural, and intensity-based characteristics as discussed in our prior work.22 A total of 288 features derived from the four different FTUs provide a comprehensive dataset for downstream analysis. Fig. 2 shows the physical interpretation of the two of the handcrafted features.
Fig. 2:

Illustrative figure for histomorphometry of selected handcrafted features
(a) Max. distance transform represents the maximum of the distances between a PAS + ve pixel and the closest non PAS + ve pixel
(b) Luminal Space Area is the space occupied by the lumen inside an FTU, and PAS + ve area is the area occupied by the purple region inside an FTU
Feature Selection:
Let , and denote the set of embeddings obtained from the PG FM at the slide level, tile level, and from the UNI FM, respectively. Let represent the set of HFs.
Correlation Calculation:
FEs obtained from the FMs and the HFs are informative for predicting the target outcome. For each feature in the FEs, we calculate the Pearson correlation with the HFs using the scipy.stats library. We calculate the correlation matrices as follows:
| (1) |
| (2) |
| (3) |
where corr(⋅,⋅) denotes the correlation.
Sparsification of Correlation Matrices:
To ensure that only the most relevant features are selected, we apply a threshold of and for selecting the most effective correlation coefficients statistically in the correlation matrix, thus sparsifying the correlation matrices and enhancing the robustness of the feature selection process. Let , and denote the sparsified correlation matrices obtained from , and correlation matrices respectively.
Top Feature Extraction:
We assume that the top features selected from the correlation matrices capture the most significant relationships between the embeddings and the HFs. Extract the top features from each sparsified correlation matrix. We took a value of , since these are the number of HFs present.
| (4) |
| (5) |
| (6) |
Concatenation of Top Features:
The selected top features from each FE are concatenated with handcrafted features to form a feature set of size .
| (7) |
is used for the downstream tasks.
3. EXPERIMENTS AND RESULTS:
Our model aims to predict the development of ESKD two years post-biopsy, relying on features from FMs and HFs. Linear and probing was done separately on an individual set of FE. On the combined set of features and HFs we train logistic regression and classifers. The models were evaluated using leave-one-out cross-validation (LOO-CV). For training the classifiers, a grid search was conducted to determine the optimal number of neighbors. PG’s TLE performed better compared to it’s SLE, UNI TLE, and HFs if we consider an individual set of features. Overall, results show that combining features from different FEs (PG, UNI) and HFs improves performance across various metrics such as accuracy, balanced accuracy, Matthew’s correlation coefficient (MCC), F1 score, precision, and recall, indicating the benefit of combining multiple feature representations for the prediction task. Table 1 shows the results obtained on various FEs, HFs and combined set of features. Fig. 3a shows the interpretation of the top FEs indices clustered based on the feature type, showing that major features types learned are based on color and texture. Fig. 3b shows the interpretation of the top FEs indices clustered based on the FTUs, suggesting that features are mainly learned form arteries and tubules.
Table 1:
Classification metrics for ESKD prediction in DN
| Prov-Gigapath | UNI | H. F. | C. F. | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Metrics | SLE-LP | SLE-KP | TLE-LP | TLE-KP | TLE-LP | TLE-KP | LR | LR | ||
| Accuracy | 0.8035 | 0.7321 | 0.8214 | 0.7679 | 0.8035 | 0.7500 | 0.6428 | 0.7321 | 0.8393 | 0.7321 |
| B.A. | 0.7322 | 0.5313 | 0.7438 | 0.5938 | 0.7313 | 0.6375 | 0.5438 | 0.6063 | 0.7938 | 0.5500 |
| MCC | 0.4948 | 0.2132 | 0.5367 | 0.3762 | 0.4948 | 0.3244 | 0.0912 | 0.2614 | 0.5993 | 0.2006 |
| F1 score | 0.7969 | 0.6351 | 0.8129 | 0.7047 | 0.7969 | 0.7299 | 0.6353 | 0.7054 | 0.8377 | 0.6593 |
| Precision | 0.7958 | 0.8052 | 0.8149 | 0.8248 | 0.7958 | 0.7304 | 0.6295 | 0.7058 | 0.8367 | 0.7161 |
| Recall | 0.8035 | 0.7321 | 0.8214 | 0.7679 | 0.8035 | 0.7500 | 0.6428 | 0.7321 | 0.8393 | 0.7321 |
| Specificity | 0.9000 | 1.0000 | 0.9250 | 1.0000 | 0.9000 | 0.9000 | 0.7750 | 0.9000 | 0.9000 | 0.9750 |
| AUROC | 0.8219 | 0.5625 | 0.8281 | 0.7008 | 0.8313 | 0.6375 | 0.6781 | 0.6063 | 0.8266 | 0.6844 |
| AUPRC | 0.6136 | 0.4405 | 0.7654 | 0.5987 | 0.7813 | 0.5768 | 0.3793 | 0.5322 | 0.6913 | 0.5327 |
Fig. 3:

Top 20 features from FM correlated with the top 20 handcrafted features
(a) Maximum of absolute correlations of top 20 features clustered based on feature type for PG TLE
(b) Maximum of absolute correlation of top 20 features clustered based on functional tissue unit for PG TLE
Table 1 shows the classification results obtained after doing linear and probing on the FEs obtained from the PG and UNI FMs. B.A. refers to Balanced Accuracy. SLE, TLE, represent the slide level embeddings, tile level embeddings respectively. LP and KP refers to linear probing and probing respectively. H.F., C.F. represent the handcrafted features and combined features respectively.
4. CONCLUSIONS
We demonstrate that we can interpret the FEs from FMs with HFs using correlation analysis. We also present the potential of combining FEs from FMs, specifically PG and UNI, with HFs to predict end stage kidney disease (ESKD) in subjects with DN. First, we perform linear and probing on the FEs from FMs and also train a logistic regression and classifier on the HFs. Next, we combine the most relevant features from the FEs with HFs and train logistic regression and model using these combined feature set. Furthermore, we present a set of FEs ranked by their level of explainability and significance in ESKD risk prediction. Our findings suggest that the integration of HFs with FEs can enhance the interpretability and performance of predictive models in computational pathology. The proposed method provides a framework for utilizing FMs in clinical settings, offering a balance between predictive accuracy and explainability. Future work will focus on validating our approach on larger datasets and exploring the application of this method to other pathological conditions.
ACKNOWLEDGEMENTS
This work was supported by the National Institutes of Health [NIH/NIDDK R01 DK114485, and NIH/NIDDK R01 AR080668].
REFERENCES
- [1].Tu T, Azizi S, Driess D, Schaekermann M, Amin M, Chang P-C, Carroll A, Lau C, Tanno R, Ktena I, et al. , “Towards generalist biomedical ai,” NEJM AI 1(3), AIoa2300138 (2024). [Google Scholar]
- [2].Zvyagin M, Brace A, Hippe K, Deng Y, Zhang B, Bohorquez CO, Clyde A, Kale B, Perez-Rivera D, Ma H, et al. , “Genslms: Genome-scale language models reveal sars-cov-2 evolutionary dynamics,” The International Journal of High Performance Computing Applications 37(6), 683–705 (2023). [Google Scholar]
- [3].Li R, Allal LB, Zi Y, Muennighoff N, Kocetkov D, Mou C, Marone M, Akiki C, Li J, Chim J, et al. , “Starcoder: may the source be with you!,” arXiv preprint arXiv:2305.06161 (2023). [Google Scholar]
- [4].Azerbayev Z, Schoelkopf H, Paster K, Santos MD, McAleer S, Jiang AQ, Deng J, Biderman S, and Welleck S, “Llemma: An open language model for mathematics,” arXiv preprint arXiv:2310.10631 (2023). [Google Scholar]
- [5].Xu H, Usuyama N, Bagga J, Zhang S, Rao R, Naumann T, Wong C, Gero Z, González J, Gu Y, et al. , “A whole-slide foundation model for digital pathology from real-world data,” Nature, 1–8 (2024). [Google Scholar]
- [6].Chen RJ, Ding T, Lu MY, Williamson DF, Jaume G, Song AH, Chen B, Zhang A, Shao D, Shaban M, et al. , “Towards a general-purpose foundation model for computational pathology,” Nature Medicine 30(3), 850–862 (2024). [Google Scholar]
- [7].Vorontsov E, Bozkurt A, Casson A, Shaikovski G, Zelechowski M, Liu S, Mathieu P, van Eck A, Lee D, Viret J, et al. , “Virchow: a million-slide digital pathology foundation model,” arXiv preprint arXiv:2309.07778 (2023). [Google Scholar]
- [8].Dippel J, Feulner B, Winterhoff T, Schallenberg S, Dernbach G, Kunft A, Tietz S, Jurmeister P, Horst D, Ruff L, et al. , “Rudolfv: a foundation model by pathologists for pathologists,” arXiv preprint arXiv:2401.04079 (2024). [Google Scholar]
- [9].Nechaev D, Pchelnikov A, and Ivanova E, “Hibou: A family of foundational vision transformers for pathology,” arXiv preprint arXiv:2406.05074 (2024). [Google Scholar]
- [10].Sigirci IO, Albayrak A, and Bilgin G, “Detection of mitotic cells in breast cancer histopathological images using deep versus handcrafted features,” Multimedia Tools and Applications 81(10), 13179–13202 (2022). [Google Scholar]
- [11].Echle A, Rindtorff NT, Brinker TJ, Luedde T, Pearson AT, and Kather JN, “Deep learning in cancer pathology: a new generation of clinical biomarkers,” British journal of cancer 124(4), 686–696 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- [12].Wang H, Cruz-Roa A, Basavanhally A, Gilmore H, Shih N, Feldman M, Tomaszewski J, Gonzalez F, and Madabhushi A, “Mitosis detection in breast cancer pathology images by combining handcrafted and convolutional neural network features,” Journal of Medical Imaging 1(3), 034003–034003 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
- [13].Selvaraju RR, Cogswell M, Das A, Vedantam R, Parikh D, and Batra D, “Grad-cam: Visual explanations from deep networks via gradient-based localization,” in [Proceedings of the IEEE international conference on computer vision], 618–626 (2017). [Google Scholar]
- [14].Kasireddy HR, Kallam UR, Mantrala SKS, Kongara H, Shivhare A, Saita J, Vijay S, Prasad R, Raman R, and Seelamantula CS, “Deep-learning-based visualization and volumetric analysis of fluid regions in optical coherence tomography scans,” Diagnostics 13(16), 2659 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- [15].Chattopadhay A, Sarkar A, Howlader P, and Balasubramanian VN, “Grad-cam++: Generalized gradient-based visual explanations for deep convolutional networks,” in [2018 IEEE winter conference on applications of computer vision (WACV)], 839–847, IEEE; (2018). [Google Scholar]
- [16].Chen P, Dong W, Wang J, Lu X, Kaymak U, and Huang Z, “Interpretable clinical prediction via attention-based neural network,” BMC Medical Informatics and Decision Making 20, 1–9 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- [17].Barić D, Fumić P, Horvatić D, and Lipic T, “Benchmarking attention-based interpretability of deep learning in multivariate time series predictions,” Entropy 23(2), 143 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- [18].Otsu N et al. , “A threshold selection method from gray-level histograms,” Automatica 11(285–296), 23–27 (1975). [Google Scholar]
- [19].Mimar S, Paul AS, Lucarelli N, Border S, Naglah A, Barisoni L, Hodgin J, Rosenberg AZ, Clapp W, and Sarder P, “Compreps: an automated cloud-based image analysis tool to democratize ai in digital pathology,” in [Medical Imaging 2024: Digital and Computational Pathology], 12933, 245–251, SPIE; (2024). [Google Scholar]
- [20].Chen L-C, Papandreou G, Schroff F, and Adam H, “Rethinking atrous convolution for semantic image segmentation,” arXiv preprint arXiv:1706.05587 (2017). [Google Scholar]
- [21].Lucarelli N, Ginley B, Zee J, Mimar S, Paul AS, Jain S, Han SS, Rodrigues L, Ozrazgat-Baslanti T, Wong ML, et al. , “Correlating deep learning-based automated reference kidney histomorphometry with patient demographics and creatinine,” Kidney360, 10–34067 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- [22].Lutnick B, Manthey D, Becker JU, Ginley B, Moos K, Zuckerman JE, Rodrigues L, Gallan AJ, Barisoni L, Alpers CE, et al. , “A user-friendly tool for cloud-based whole slide image segmentation with examples from renal histopathology,” Communications medicine 2(1), 105 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
