Epithelial cells classification with graph neural networks

Aim

At the cell-level, the distinction between normal and malignant epithelial cells is challenging due to the high morphologic heterogeneity of malignant cells. These cells vary a lot in shape, size and sometimes resemble normal epithelial cells. For that reason, common computer vision methods struggle to correctly differentiate epithelial cells into normal or malignant. In this project, we propose a new method based on the aggregation of local and global tissue features to take advantage of the surrounding gland morphology to accurately learn to distinguish these two epithelial classes.

Epithelial graphs were built to capture the epithelial tissue structure. Nodes were individual epithelial cells connected to their closest neighbours using Delaunay triangulation. Hidden embeddings extracted from a trained ResNet were used as node features. Graph Neural Networks (GNNs) were trained for node(cell) classification (normal vs malignant epithelial cell). A final post-processing step (graph clustering and median filtering) is applied to smooth predictions inside individual glands. The different classification steps can be visualized in the Figure below.

Graph-based classification significantly improved the classification F1 score compared to computer vision models, achieving 97.8% F1 score on TCGA test set (versus 91.7% using ResNet). This new method shows that the structural context that is captured by graphs is an important feature for the cell classification. The proposed model can be applied on top of any other method detecting epithelial cells and results in an accurate estimation of the epithelial cell composition for downstream analyses.

Methods

A subset of the Lizard dataset containing exclusively normal or malignant epithelial cells was used alongside additional 1000×1000 px colorectal tissue patches from the Institute cohort and TCGA, which were manually annotated by experts. PanNuke (a subset of Lizard) and TCGA patches were reserved as held-out test sets, while the remaining data were used for training and validation. All images were extracted at 20× magnification (0.5 µm/pixel), yielding 66,034 normal and 119,013 malignant epithelial cells for training/validation, and 12,751 normal and 17,717 malignant cells for testing.

For baseline classification, 128×128 px image tiles centred on epithelial cell centroids were extracted. ResNet18 and ViT16 models were trained for binary normal versus malignant epithelial cell classification. ResNet18 achieved superior performance on the TCGA test set and was selected as the feature extractor for subsequent graph-based modelling.

Cell graphs were generated from epithelial cell detections, where each node represented a single epithelial cell. Node features were obtained from the final hidden layer of the pre-trained ResNet18 to encode cellular morphology. Spatial relationships between neighbouring cells were modelled using Delaunay triangulation with an optimised edge-length threshold.

Graph Neural Networks (GNNs) were trained for node-level classification of epithelial cells. Model optimisation was performed using 5-fold cross-validation by evaluating multiple message passing architectures (GCN, GraphSAGE, GIN, and GATv2), varying the number of layers (2–4) and hidden dimensions (64–512). Following classification, a post-processing step was applied based on the assumption that epithelial glands consist of cells of a single class. Gland subgraphs were isolated using a short edge threshold of 30 px (15 µm), and final cell labels were assigned using median filtering across each gland.

Results

Graph-based classification significantly outperformed standard CNN-based approaches (p < 0.05). The optimal architecture consisted of four GATv2 message passing layers with a hidden size of 256. On the PanNuke test set, the GAT model with post-processing achieved a weighted F1 score of 100%, while on the TCGA test set it achieved 97.85%, compared with 91.72% for the baseline ResNet18 model.

Performance improvements were most evident in densely packed epithelial regions, such as crypt bases, where CNN-only approaches frequently misclassified normal cells as malignant. Incorporating spatial neighbourhood information through graph edges improved classification of these ambiguous regions, while the gland-level post-processing further reduced isolated prediction errors.

Model PanNuke TCGA
ViT16 99.10% 89.47%
ResNet18 99.04% 91.72%
GAT 99.42% 95.07%
GAT + post-processing 100.0% 97.85%

These findings demonstrate that incorporating tissue structural context through cell graphs substantially improves epithelial cell classification performance beyond morphology-based CNN approaches alone.

Members

Ana Leni Frei

Inti Zlobec

Andreas Fischer

Publications

Ana Leni Frei, Amjad Khan, Philipp Zens, Alessandro Lugli, Inti Zlobec, Andreas Fischer, GammaFocus: An image augmentation method to focus model attention for classification, Medical Imaging with Deep Learning (MIDL), 2023

Ana Leni Frei, Amjad Khan, Linda Studer, Philipp Zens, Alessandro Lugli, Andreas Fischer, Inti Zlobec, Local and global feature aggregation for accurate epithelial cell classification using graph attention mechanisms in histopathology image, Medical Imaging with Deep Learning (MIDL), 2023

Frei, A. L., Garcia-Baroja, J., Rau, T., Neppl, C., Lugli, A., Solass, W., Wartenberg, M., Fischer, A., & Zlobec, I.: GrEp: Graph-based epithelial cell classification refinement in histopathology H&amp;E images. Pattern Recognition, 171, 112197, 2026. https://doi.org/10.1016/j.patcog.2025.112197