Prostate cancer grading relies on the Gleason scoring system, in which a specialist pathologist examines tissue under a microscope and assigns a score based on how abnormal the cancer cells appear. A higher Gleason score reflects more aggressive, disorganized cancer architecture and predicts worse outcomes. The ISUP grade group system (1 through 5) is a closely related standardized classification that combines Gleason scores into clinical risk categories.
Despite the central importance of Gleason grading in treatment decisions, it suffers from a known problem: significant inter-observer variability. Studies have found that different pathologists disagree on Gleason scores in 30% to 50% of cases. Deep learning algorithms have the potential to standardize and automate this process, but they require large quantities of carefully annotated training data -- precisely the bottleneck that limits progress in the field.
Several prostate cancer histopathology datasets have been released in recent years, including the prominent PANDA challenge dataset. However, the field continues to benefit from additional independent datasets that use different patient populations, different scanning equipment, and different annotation protocols. Each new dataset enables researchers to test model generalizability and identify failure modes not visible in any single collection.
This paper introduces DiagSet, a large-scale publicly available prostate histopathology dataset from a Polish clinical laboratory, together with a complete machine learning pipeline for tissue classification. The dataset includes over 2.6 million annotated image patches from 430 fully-labeled whole slide images (WSIs), plus 4,675 additional scans with binary cancer/non-cancer diagnoses, and 46 scans independently reviewed by nine expert pathologists for direct human-AI comparison.
DiagSet-A is the fully annotated component of the dataset, consisting of 430 whole slide images (WSIs) of prostate biopsy tissue. Three expert pathologists independently annotated each scan, assigning tissue regions to one of nine categories: scan background, tissue background, normal tissue, acquisition artifacts, and Gleason grades 1 through 5. All scans were acquired with a Hamamatsu C12000-22 digital slide scanner at 40x magnification (0.25 micrometers per pixel). More than 2.6 million image patches of size 256x256 pixels were extracted from these scans across four magnification levels (40x, 20x, 10x, and 5x).
DiagSet-B provides a much larger collection of 4,675 WSI scans with binary cancer/non-cancer labels derived from routine clinical diagnostic records. Of these, 2,090 were diagnosed as containing cancerous tissue and 2,585 were not. This component of the dataset reflects real-world clinical practice more closely than highly controlled research annotation, as labels were based on the actual written diagnoses produced by pathologists during standard patient care -- sometimes informed by additional immunohistochemistry tests beyond the slide image alone.
DiagSet-C is the smallest but most valuable component for evaluating AI against human performance. It consists of 46 WSI scans that were independently evaluated by nine expert histopathologists, each of whom assigned one of three labels: cancerous (C), not cancerous (NC), or uncertain and requiring further immunohistochemical examination (IHC). The IHC option reflects the real clinical reality that WSI images alone are sometimes insufficient to make a definitive diagnosis.
The annotation protocol used the maximum-severity labeling rule for multi-magnification patch assignment: when a larger image patch contains sub-patches with different Gleason grades, the overall patch receives the label of the most severe (highest grade) sub-patch. This ensures that lower-resolution models are trained to recognize the worst-case tissue present in any given region, which is clinically most important for cancer grading decisions.
The machine learning pipeline consists of three sequential steps. First, a preprocessing step uses a fully convolutional neural network to segment valid tissue regions from background, eliminating the large fraction of scan area that contains no tissue and would otherwise add unnecessary computational overhead to classification. Second, the valid tissue is divided into 224x224 pixel patches that are independently classified by one or more pre-trained deep neural networks. Third, scan-level diagnosis is generated by aggregating patch-level predictions across the entire slide.
Six neural network architectures were evaluated for patch classification: AlexNet, VGG16, VGG19, ResNet50, InceptionV3, and ViT-B/32 (a Vision Transformer). All models were initialized with weights pre-trained on ImageNet, a standard practice that transfers visual feature knowledge from natural image recognition to histopathology classification. The Vision Transformer showed the weakest performance, particularly on imbalanced classes -- a known limitation of transformer architectures when training data is scarce or unevenly distributed across classes.
A key insight driving the ensemble strategy is that different magnification levels reveal different aspects of tissue pathology. High magnification (40x) captures fine cellular detail -- individual cell nuclei, gland architecture -- while lower magnifications capture tissue-level organization patterns. By training separate models on each magnification level and combining their predictions through probability averaging, the ensemble gains complementary information that no single-scale model can access alone. Combining architectures and magnifications together produced the best results.
An additional spatial smoothing step applied median filtering to the patch-level probability maps before making final predictions. Because cancerous tissue typically forms contiguous clusters rather than isolated single patches, a patch classified as cancerous surrounded entirely by non-cancerous predictions is more likely to be a false positive than a true finding. Median filtering suppresses these isolated outliers, improving overall accuracy while reducing the number of models needed in the ensemble to achieve a given performance level.
The best-performing configuration was an ensemble of VGG19 models trained at 40x, 20x, 10x, and 5x magnifications, achieving 94.58% accuracy in binary (cancer vs. no cancer) patch classification on the test set. This configuration also achieved 94.70% average accuracy, indicating that performance was balanced rather than driven by dominance on one class. Accuracy decreased as the classification task became more granular -- 92.7% for the four-class setting distinguishing Gleason grades 3, 4, and 5 separately, and 69.4% for the full nine-class setting that also distinguishes between tissue background, healthy tissue, and artifacts.
For scan-level diagnosis using the DiagSet-B dataset, the researchers implemented an abstaining classifier with two adjustable thresholds. A scan was diagnosed as cancerous if more than an upper percentage threshold of its tissue patches were classified as cancerous, as non-cancerous if below a lower threshold, and the system abstained from making a decision if the proportion fell in the uncertain middle range. By setting the thresholds to 0.5% and 7%, the system achieved 99.04% accuracy on 73.16% of scans, deliberately deferring judgment on the ambiguous 27% to human review.
This abstaining framework has important clinical significance. Rather than forcing a binary decision on every case regardless of certainty, the model can flag ambiguous cases for human pathologist review, concentrating clinical expert attention where it is most needed. In settings where high accuracy matters more than throughput, the thresholds can be tightened to process only the clearest cases. In settings where coverage matters more, they can be relaxed.
The model struggled with the lowest Gleason grades (1 and 2), frequently misclassifying them as either healthy tissue or Gleason 3-4. This reflects a real challenge in prostate pathology -- low-grade cancers are visually similar to benign hyperplastic tissue, and even expert pathologists disagree substantially on their recognition. The model's errors in this category mirror human expert disagreement, suggesting the confusion reflects genuine visual ambiguity rather than a modeling failure.
The most clinically significant experiment in the study compared the AI system directly to nine expert histopathologists evaluating the same 46 WSI scans. The Spearman correlation between the AI system (DCNN) and each individual human expert ranged from 0.74 to 0.83. The correlations between pairs of human experts ranged from 0.64 to 0.99. Crucially, the AI's correlations with human experts fall within the range of human-to-human correlation in all but one case.
This result is significant because it demonstrates that the AI's disagreements with any given human expert are no more frequent than the disagreements among human experts themselves. Prostate cancer histopathology is inherently subjective, particularly for borderline cases and low-grade disease. An AI that can match the consistency of an expert pathologist -- not exceeding it, but performing within the same range of natural variability -- is potentially ready for clinical support roles.
The cases where both humans and the AI system struggled were characterized by very small percentages of cancerous tissue on the scan (below 5%). In these ambiguous cases, some human experts voted for cancer, some for no cancer, and some requested further testing. The AI system similarly expressed uncertainty in the low-percentage range, correctly identifying these as the most diagnostically challenging cases rather than making overconfident false calls in either direction.
The experiment also highlighted the value of the IHC abstaining option. In real pathology practice, WSI slides alone are often insufficient and immunohistochemistry (additional chemical staining for specific proteins) is needed to confirm borderline diagnoses. Including this option in the human comparison study revealed that the most difficult cases -- those where human experts most frequently requested IHC -- were also the cases where the AI system's confidence was lowest, confirming appropriate calibration of the AI's uncertainty.
The primary contribution of this paper is the DiagSet dataset itself, available at github.com/michalkoziarski/DiagSet. By releasing over 2.6 million annotated patches from 430 fully labeled WSIs together with a baseline deep learning pipeline, the authors provide a resource that other researchers can use to train, validate, and compare new prostate cancer AI systems against a consistent benchmark.
The dataset's diversity -- seven magnification levels, multiple annotation types (pixel-level, binary, and multi-expert consensus), and a real-world clinical label component in DiagSet-B -- makes it more versatile than single-format datasets. The multi-expert DiagSet-C component is particularly valuable for calibration studies, since it provides a measure of human inter-observer variability against which AI uncertainty estimates can be directly benchmarked.
The study's finding that VGG-based architectures outperformed both more recent CNN architectures (ResNet, Inception) and Vision Transformers on this dataset has practical implications. Vision Transformers typically require more training data to reach their potential, and their weaker performance here reflects both the class imbalance challenge in histopathology and the specific characteristics of this dataset. Future work with larger datasets or specialized transformer architectures may change this ranking.
Future directions identified by the authors include testing the DiagSet-trained models on other prostate cancer datasets to assess cross-dataset generalizability, incorporating attention mechanisms and newer Vision Transformer variants, and potentially integrating cribriform pattern detection methods that identify specific Gleason grade 4 architectural patterns important for clinical decision-making. The dataset and code infrastructure are positioned as a lasting contribution to the computational pathology community.