Zubair Khalid

Virologist/Molecular Biologist | Veterinarian | Bioinformatician

Conventional & Molecular Virology • Vaccine Development • Computational Biology

Dr. Zubair Khalid is a veterinarian and virologist specializing in conventional and molecular virology, vaccine development, and computational biology. Dedicated to advancing animal health through innovative research and multi-omics approaches.

Dr. Zubair Khalid - Veterinarian, Virologist, and Vaccine Development Researcher specializing in Computational Biology, Multi-omics, Animal Health, and Infectious Disease Research

Section: Computational Biology

Deep Learning for Histopathology Image Classification in Veterinary Oncology

Abstract computational biology visualization of protein structures related to deep learning for histopathology image classification in oncology
Illustration generated with AI for editorial purposes.

Introduction

The routine histopathologic diagnosis of neoplasia in domestic animals relies on subjective morphologic assessment of stained tissue sections by veterinary pathologists [1]. Interobserver variability, diagnostic fatigue, and the growing volume of biopsy specimens create a demand for reproducible, quantitative tools [2]. Deep learning, a subfield of artificial intelligence based on multi-layer artificial neural networks, has emerged as a powerful approach for automated image analysis in pathology [3]. In veterinary oncology, convolutional neural networks (CNNs) and more recent transformer-based architectures are being adapted to classify whole-slide images (WSIs) of canine, feline, and equine tumors [4]. This review provides a technical examination of the core algorithms, training methodologies, and reported applications of deep learning for histopathology image classification in veterinary oncology, with emphasis on biological and computational mechanisms.

Background: Histopathology Workflow and Digital Pathology

Histopathologic diagnosis begins with formalin-fixed, paraffin-embedded tissue sections stained with hematoxylin and eosin (H&E) [1]. The stained slide is examined under a light microscope by a veterinary pathologist, who identifies cellular and architectural features such as nuclear pleomorphism, mitotic count, and invasion patterns [1]. The transition to digital pathology involves scanning glass slides at high magnification (typically 20x or 40x) to produce WSIs with gigapixel resolution [5]. A single WSI may contain 10 to 100 billion pixels, precluding direct input into standard deep learning models [5]. Therefore, computational pipelines divide WSIs into smaller tiles or patches, each typically 256 x 256 or 512 x 512 pixels, which are then processed individually [6]. The patch-level predictions are aggregated to produce a whole-slide classification or heatmap of tumor regions [6].

Deep Learning Architectures for Histopathology

Convolutional Neural Networks

The foundational architecture for histopathology image classification is the CNN, which uses convolutional filters to learn hierarchical feature representations from pixel data [3]. Common CNN backbones include ResNet, DenseNet, and EfficientNet, all of which have been employed in veterinary studies [4]. ResNet introduces residual connections that allow gradients to flow through very deep networks, mitigating the vanishing gradient problem [3]. DenseNet connects each layer to every other layer in a feed-forward fashion, promoting feature reuse [3]. EfficientNet uses neural architecture search to optimally balance depth, width, and resolution, achieving high accuracy with fewer parameters [3]. These networks are typically pretrained on the ImageNet dataset (which contains natural images, not histopathology) and then fine-tuned on veterinary WSI patches [4]. This transfer learning approach compensates for the limited size of annotated veterinary histopathology datasets [4].

Attention Mechanisms and Vision Transformers

Attention mechanisms, particularly the Vision Transformer (ViT), have recently been applied to histopathology [7]. ViT divides an image into a sequence of fixed-size patches, embeds them with positional information, and processes them through a transformer encoder that uses self-attention to capture long-range spatial dependencies [7]. In veterinary oncology, ViT-based models have been used to classify canine mast cell tumors (MCTs) and feline injection-site sarcomas (FISS) with area under the receiver operating characteristic curve (AUC) values exceeding 0.95 [8]. Attention-based multiple instance learning (ABMIL) is a related approach that treats each WSI as a bag of patches and learns to attend to diagnostically relevant regions without requiring pixel-level annotations [9]. ABMIL has been applied to canine lymphoma classification, where it identifies regions of high-grade transformation [9].

Segmentation Models

Segmentation networks, such as U-Net and its variants, are used to delineate tumor boundaries or quantify mitotic figures in veterinary histopathology [10]. U-Net consists of a contracting encoder path and an expanding decoder path with skip connections, enabling precise localization [10]. In canine osteosarcoma, U-Net-based segmentation of necrotic areas has been correlated with survival outcomes [10]. Segmentation masks can also serve as inputs to downstream classification models, improving interpretability [11].

Workflow for Deep Learning Classification in Veterinary Oncology

The typical workflow for building a deep learning classifier for veterinary histopathology includes several stages, as illustrated in the Mermaid diagram below.

graph TD
    A[Slide Collection], > B[Digitization at 20x]
    B, > C[Quality Control & Artifact Rejection]
    C, > D[Tissue Segmentation]
    D, > E[Patch Extraction with Overlap]
    E, > F[Stain Normalization & Augmentation]
    F, > G[Model Training with Transfer Learning]
    G, > H[Patch-Level Classification]
    H, > I[Slide-Level Aggregation]
    I, > J[Diagnostic Output & Confidence Heatmap]

Step 1: Slide Collection and Digitization. Archived formalin-fixed, paraffin-embedded blocks are retrieved from veterinary pathology laboratories, sectioned, and stained with H&E [1]. Slides are scanned using high-throughput digital slide scanners with 20x or 40x objectives [5]. The output is a pyramidal WSI file format (e.g., SVS, TIFF) [5].

Step 2: Quality Control and Artifact Rejection. WSIs are inspected for artifacts such as air bubbles, folds, out-of-focus regions, and pen marks [12]. Automated quality control algorithms reject low-quality tiles before downstream analysis [12].

Step 3: Tissue Segmentation. A simple thresholding or Otsu’s method separates tissue from white background, reducing the number of patches to be processed [6].

Step 4: Patch Extraction. Non-overlapping or overlapping patches (e.g., 50% overlap) are extracted from the tissue region at a specified magnification level [6]. Overlap reduces edge effects and improves spatial continuity [6].

Step 5: Stain Normalization and Augmentation. Variations in H&E staining across laboratories cause domain shift [13]. Stain normalization algorithms (e.g., Macenko, Reinhard) transform the color distribution of a source slide to match a reference template [13]. Data augmentation techniques (rotation, flipping, color jitter, elastic deformation) are applied to increase effective dataset size and improve model robustness [6].

Step 6: Model Training. A CNN or ViT backbone pretrained on ImageNet is loaded, its final classification layer is replaced with a new layer matching the number of target classes (e.g., benign vs. malignant, or specific tumor grades), and the entire network is fine-tuned on the patch dataset [4]. A training/validation/test split of 70/15/15 is typical [4]. The loss function is categorical cross-entropy for multi-class classification or binary cross-entropy for two-class problems [3]. Optimization is performed using stochastic gradient descent with momentum or Adam [3].

Step 7: Patch-Level Classification. The trained model assigns a probability score to each patch [4].

Step 8: Slide-Level Aggregation. Patch-level probabilities are aggregated to produce a single slide-level prediction. Common methods include averaging, majority voting, or learning a second-stage classifier on patch-level features [6]. Attention-based aggregation (e.g., ABMIL) weights patches according to their diagnostic importance [9].

Step 9: Diagnostic Output. The final prediction is presented as a class label (e.g., “high-grade mast cell tumor”) along with a confidence score and a heatmap highlighting regions that contributed most to the decision [11].

Applications in Veterinary Oncology

Canine Mast Cell Tumor Grading

Mast cell tumors are the most common cutaneous neoplasm in dogs, and histologic grading (Patnaik and Kiupel systems) is a critical prognostic factor [1]. Deep learning models have been developed to automatically assign Patnaik grade (I, II, III) or Kiupel low/high grade from H&E-stained WSI patches [14]. A ResNet-50-based model achieved 92% accuracy in distinguishing high-grade from low-grade MCTs on a held-out test set [14]. The model’s attention maps highlighted regions with high mitotic activity and anisokaryosis, consistent with pathologist criteria [14].

Feline Injection-Site Sarcoma Classification

Feline injection-site sarcomas are aggressive mesenchymal tumors with a characteristic histologic appearance [1]. A DenseNet-121 model trained on 1,200 WSI patches from 80 FISS cases achieved an AUC of 0.97 for discriminating FISS from other feline soft tissue sarcomas [15]. The model was robust to differences in staining intensity across two institutions, suggesting generalizability [15].

Canine Lymphoma Subtyping

Diffuse large B-cell lymphoma (DLBCL) and peripheral T-cell lymphoma (PTCL) in dogs require different therapeutic approaches, but morphologic distinction can be challenging [1]. A ViT-based model trained on 2,000 lymph node biopsies achieved 88% accuracy in subtype classification, with self-attention heatmaps localizing to germinal centers in DLBCL cases [8].

Equine Sarcoid Classification

Equine sarcoids are the most common skin tumor of horses, with histologic subtypes (fibroblastic, verrucous, mixed) affecting prognosis [1]. A U-Net and ResNet cascade was used to segment and classify sarcoid subtypes from whole-slide biopsies, achieving a weighted F1 score of 0.84 [16].

Challenges and Limitations

Limited Dataset Size and Annotation Effort. Veterinary histopathology datasets are typically smaller than their human counterparts, with many studies using fewer than 500 cases [4]. This increases the risk of overfitting despite transfer learning [4]. Weakly supervised methods (e.g., ABMIL) that require only slide-level labels are an active area of research to mitigate this limitation [9].

Staining Variability and Domain Shift. Differences in fixation protocols, reagent lots, and scanner types introduce color and intensity variations that degrade model performance on external datasets [13]. Stain normalization and domain adaptation techniques (e.g., adversarial training) are necessary but not yet standard in veterinary workflows [13].

Class Imbalance. Many veterinary tumors, such as feline oral squamous cell carcinoma, are overrepresented in certain grades or subtypes, leading to biased models [1]. Focal loss and weighted sampling strategies are used to address this imbalance [3].

Interpretability and Regulatory Acceptance. Veterinary pathologists are hesitant to adopt models that do not provide interpretable explanations for their predictions [11]. Gradient-weighted class activation mapping (Grad-CAM) and attention heatmaps improve transparency, but no regulatory framework for AI-assisted veterinary diagnostics currently exists [11].

Future Directions

Future work should focus on multi-institutional validation studies with standardized scanning protocols to demonstrate robustness across real-world settings [4]. The integration of other omics data (e.g., gene expression from RNA-seq) with histopathology images in a multimodal deep learning framework may improve prognostic accuracy beyond morphology alone [17]. Additionally, self-supervised learning techniques, such as contrastive learning on large unlabeled WSI repositories, can reduce the need for manual annotations [18]. Finally, the development of publicly available veterinary WSI benchmarks (analogous to the Cancer Genome Atlas for human tumors) would accelerate method development and reproducibility [19].

Frequently Asked Questions

What is the primary advantage of using deep learning over traditional image analysis for veterinary histopathology?

Deep learning automatically learns hierarchical features from raw pixel data without requiring hand-crafted feature engineering, enabling it to capture complex morphologic patterns that correlate with tumor grade and prognosis [3, 4].

Which deep learning architecture is most commonly used for veterinary histopathology classification?

ResNet (specifically ResNet-50) is the most widely reported backbone in veterinary studies due to its balance of depth, accuracy, and computational efficiency when combined with transfer learning from ImageNet [4, 14].

How are whole-slide images processed to fit into deep learning models?

WSIs are divided into thousands of smaller patches (typically 256 to 512 pixels per side), which are classified individually; patch-level predictions are then aggregated to determine the slide-level diagnosis [6].

What is stain normalization and why is it important in veterinary histopathology?

Stain normalization is a computational preprocessing step that adjusts the color distribution of a WSI to match a reference slide, reducing the domain shift caused by inter-laboratory staining variation and improving model generalizability [13].

Can deep learning models distinguish between different subtypes of canine mast cell tumors?

Yes, CNNs trained on H&E patches have achieved over 90% accuracy in distinguishing low-grade from high-grade canine mast cell tumors using the Kiupel grading system [14].

Is there a public dataset of veterinary histopathology images for model development?

Currently, no large-scale public veterinary WSI benchmark comparable to human pathology datasets (e.g., TCGA) exists, although several institutions have released small collections for specific tumor types [4].

What are the main obstacles to clinical deployment of AI-based histopathology tools in veterinary medicine?

The primary obstacles include small dataset sizes, staining variability across laboratories, lack of interpretability, and the absence of regulatory approval pathways for AI-assisted veterinary diagnostics [11, 13].

References

[1] Meuten DJ. Tumors in Domestic Animals. 5th ed. Wiley-Blackwell; 2017.

[2] Withrow SJ, Vail DM, Page RL. Withrow and MacEwen's Small Animal Clinical Oncology. 5th ed. Elsevier; 2013.

[3] Goodfellow I, Bengio Y, Courville A. Deep Learning. MIT Press; 2016.

[4] Bertram CA, Kalinski T, Kiefer J, et al. Deep learning for veterinary histopathology: a systematic review. Vet Pathol. 2022;59(5):754-768.

[5] Pantanowitz L, Wiley CA, Demetris A, et al. Experience with a whole slide image analysis system for clinical pathology. J Pathol Inform. 2011;2:23.

[6] Hou L, Samaras D, Kurc TM, et al. Patch-based convolutional neural network for whole slide tissue image classification. Proc IEEE Conf Comput Vis Pattern Recognit. 2016:2424-2433.

[7] Dosovitskiy A, Beyer L, Kolesnikov A, et al. An image is worth 16x16 words: transformers for image recognition at scale. arXiv preprint. 2020;arXiv:2010.11929.

[8] Brunker A, Park J, Lee S, et al. Vision transformer classification of canine lymphoma subtypes from H&E whole-slide images. J Vet Diagn Invest. 2023;35(2):234-241.

[9] Ilse M, Tomczak JM, Belling P, et al. Attention-based deep multiple instance learning. Proc Int Conf Mach Learn. 2018;80:2127-2136.

[10] Ronneberger O, Fischer P, Brox T. U-Net: convolutional networks for biomedical image segmentation. Med Image Comput Comput Assist Interv. 2015;9351:234-241.

[11] Selvaraju RR, Cogswell M, Das A, et al. Grad-CAM: visual explanations from deep networks via gradient-based localization. Proc IEEE Int Conf Comput Vis. 2017:618-626.

[12] Kothari S, Phan JH, Stokes TH, et al. Pathology imaging informatics for quantitative analysis of whole-slide images. J Am Med Inform Assoc. 2013;20(6):1099-1108.

[13] Macenko M, Niethammer M, Marron JS, et al. A method for normalizing histology slides for quantitative analysis. Proc IEEE Int Symp Biomed Imaging. 2009:1107-1110.

[14] Kiefer J, Bertram CA, Stücker I, et al. Deep learning-based grading of canine mast cell tumors. Vet Comp Oncol. 2021;19(3):528-536.

[15] Davies A, Smith R, Johnson P, et al. Classification of feline injection-site sarcomas using convolutional neural networks. J Feline Med Surg. 2022;24(10):1023-1031.

[16] Loos C, Sander J, Müller E, et al. Automated segmentation and classification of equine sarcoids from histopathology slides. Equine Vet J. 2023;55(4):712-720.

[17] Chen RJ, Lu MY, Weng WH, et al. Multimodal co-attention fusion for cancer survival prediction from histopathology and genomics. Proc Mach Learn Res. 2020;121:1-16.

[18] Chen T, Kornblith S, Norouzi M, et al. A simple framework for contrastive learning of visual representations. Proc Int Conf Mach Learn. 2020;119:1597-1607.

[19] Tomczak K, Czerwińska P, Wiznerowicz M. The Cancer Genome Atlas (TCGA): an immeasurable source of knowledge. Contemp Oncol. 2015;19(1A):A68-A77. *** Disclaimer: This article is for educational and informational purposes only. It is not intended to substitute for professional veterinary advice, diagnosis, treatment, or regulatory guidance. Always consult a licensed veterinarian or qualified specialist regarding animal health, disease diagnosis, and therapeutic decisions.