X-PATHOLOGY
AgenticEra Systems · AI-Assisted Oncology Screening

About X-Pathology

The Engineering Journey
From Proof-of-Concept to Specialist

Building a reliable medical AI requires rigorous iteration. X-Pathology has evolved through three major architectural versions — from a binary VGG16 baseline to a 9-class temperature-calibrated EfficientNetB1 Colon Specialist with external holdout validation.

0
Tissue Classes
0.0%
Internal Accuracy
0.0%
External Holdout
0
Report Modes
Architecture Evolution
Deprecated

Version 1.0: Establishing the Baseline (VGG16)

Our initial proof-of-concept utilized a heavyweight VGG16 architecture focused on a binary classification task (Colon Adenocarcinoma vs. Normal). While this 150MB+ model successfully established our foundational Grad-CAM explainability pipeline and achieved high baseline accuracy, it exhibited a common deep learning phenomenon: network overconfidence.

The massive parameter count acting on a simple binary sigmoid output led to mathematical saturation, resulting in "100% confidence" predictions even on out-of-distribution data. In a clinical setting, nuance is critical. We needed a scalpel, not a sledgehammer.

Superseded

Version 2.0: The Multi-Organ Experiment (MobileNetV2)

We transitioned to a lightweight MobileNetV2 backbone (8.6 MB) and expanded to a 5-class multi-organ model covering both Colon and Lung histopathology. This achieved ~98% accuracy and eliminated the binary overconfidence issue.

However, a critical problem emerged: although the model detected cancer accurately, it sometimes produced organ-mismatched reports — classifying colon tissue with a lung report and vice versa. This cross-organ confusion made the multi-organ approach unreliable for clinical-grade screening and motivated a fundamental rethinking of the model scope.

Cancer detection accurate
17× smaller than VGG16
⚠️ Organ confusion in reports
Current

Version 3.0: The Colon Specialist (EfficientNetB1)

To solve the organ-confusion problem, we adopted a single-organ specialist strategy. The new EfficientNetB1 backbone is trained exclusively on the NCT-CRC-HE-100K dataset and validated on the independent CRC-VAL-HE-7K holdout set — achieving 99.1% internal accuracy and 92.7% on a completely separate external dataset. The model classifies 9 distinct colorectal tissue types with post-training temperature calibration (T=0.5576) for trustworthy confidence values.

Milestone 01

Single-Organ Focus

By focusing exclusively on colorectal tissue, we eliminated the cross-organ confusion that plagued V2. Every prediction now maps to a well-defined colon tissue type with zero ambiguity about organ source.

Milestone 02

9-Class Granularity

From 5 broad classes to 9 fine-grained tissue types (ADI, BACK, DEB, LYM, MUC, MUS, NORM, STR, TUM). This enables precise morphological classification at the patch level, far beyond simple malignant/benign.

Milestone 03

Temperature Calibration

Post-training temperature scaling (T=0.5576) ensures confidence values are statistically calibrated — when the model says 90%, it means 90%. Critical for clinical decision-support systems.

Milestone 04

External Validation

Independently validated on CRC-VAL-HE-7K — a completely separate dataset from different scanning equipment, confirming genuine generalisation. The TUM class achieves F1=0.9558 on holdout.

How It Works
📤
Step 01

Upload H&E Colorectal Patch

Upload a histopathology tissue section image (JPEG/PNG/TIFF). The system accepts standard H&E stained patches from colorectal biopsies at 240×240 resolution.

🧠
Step 02

EfficientNetB1 CNN Inference

The Colon Specialist model classifies the tissue into one of 9 colorectal tissue types: Adipose, Background, Debris, Lymphocytes, Mucus, Smooth Muscle, Normal Mucosa, Cancer-Associated Stroma, or Tumour.

🌡
Step 03

Temperature-Calibrated Confidence

Post-training temperature scaling (T=0.5576) converts raw logits into statistically calibrated probabilities. This ensures confidence scores reflect true predictive uncertainty.

🔥
Step 04

Grad-CAM XAI Heatmap

Gradient-weighted Class Activation Mapping taps the last EfficientNet convolutional block (block7a_project_bn) to generate visual explanations of CNN attention regions.

Step 05

Gemini 2.5 Flash LLM Analysis

Both the original H&E slide and the Grad-CAM overlay are sent to Google's Gemini multimodal model, which generates a dual-persona report with clinical pathology and patient-friendly sections.

📋
Step 06

Dual-Persona Report

The final output includes a structured Clinical Pathology Report for professionals and a compassionate plain-English Patient-Facing Summary, along with a 9-class probability breakdown and visual explanations.

Tech Stack
🧪

TensorFlow / Keras

Deep learning backbone powering the EfficientNetB1 Colon Specialist for 9-class colorectal histopathology classification with temperature-calibrated inference.

FastAPI

High-performance async Python backend handling image preprocessing, CNN inference, Grad-CAM generation, and calibrated probability computation.

⚛️

Next.js 16

React-based frontend framework with App Router, providing the clinical-grade dark UI with server-side rendering.

💎

Gemini 2.5 Flash

Google's multimodal LLM that analyzes both the slide and heatmap to produce dual-persona clinical reports with visual verification.

🔬

Grad-CAM

Explainable AI technique generating visual heatmaps of CNN attention via the final EfficientNet convolutional block, making model decisions interpretable.

🤗

Hugging Face Hub

Cloud-based model hosting at rarfileexe/Xpathology-Colon-Specialist, enabling versioned model downloads with temperature calibration assets.

The Team
Syed Muhammad Hassan

Syed Muhammad Hassan

Lead AI Engineer & Full-Stack Developer

Co-Founder, AgenticEra Systems

A passionate programmer, expert in Deep Learning and Neural Networking. Driving the core AI pipeline — from model architecture to full-stack deployment.

Supercharged by Gemini 3.1 & Antigravity as my AI coding partners.

Built By

AgenticEra Systems

Pioneering the intersection of agentic AI and real-world applications. From intelligent code assistants to medical diagnostics — we build AI systems that augment human expertise with precision and responsibility.

Follow on LinkedIn
9-Class Tissue Classification

The EfficientNetB1 Colon Specialist classifies H&E-stained colorectal tissue patches into 9 distinct tissue categories. Only the TUM class is considered clinically neoplastic (malignant).

ADI · Benign

Adipose Tissue

Fat tissue surrounding the colon
BACK · Benign

Background

Non-tissue background regions
DEB · Benign

Debris / Necrosis

Cellular debris and necrotic tissue
LYM · Benign

Lymphocytes

Immune cell aggregates and infiltrates
MUC · Benign

Mucus

Mucinous secretions and pools
MUS · Benign

Smooth Muscle

Muscularis propria / muscularis mucosae
NORM · Benign

Normal Colon Mucosa

Healthy epithelial glandular tissue
STR · Benign

Cancer-Associated Stroma

Desmoplastic stromal reaction tissue
TUM · Malignant

Colorectal Adenocarcinoma

Tumour epithelium — neoplastic