X-Pathology V2.0 (Multi-Organ Diagnostic Model)

Model Description

This is a lightweight, high-performance image classification model built to diagnose histopathological scans of lung and colon tissues. This model was specifically designed for rapid web deployment without sacrificing clinical accuracy.

Instead of a simple binary classification, X-Pathology V2.0 operates as a multi-organ diagnostic tool, classifying microscopic tissue images into one of five distinct categories:

  1. colon_aca: Colon Adenocarcinoma (Malignant)
  2. colon_n: Colon Benign Tissue
  3. lung_aca: Lung Adenocarcinoma (Malignant)
  4. lung_n: Lung Benign Tissue
  5. lung_scc: Lung Squamous Cell Carcinoma (Malignant)

Architecture & Engineering

The model utilizes a MobileNetV2 backbone implemented via the TensorFlow/Keras Functional API, optimized for real-time inference on edge devices and web applications.

To ensure highly robust and realistic confidence scores, the following engineering techniques were applied during training:

  • Hostile Data Augmentation: The training pipeline utilized random flips, rotations, zooming, and contrast shifts to prevent spatial memorization.
  • Label Smoothing (0.1): Applied to the Categorical Crossentropy loss function to mathematically prevent 100% overconfidence, ensuring probability distributions remain realistic (e.g., 85% vs 15% rather than a hard 1.0 vs 0.0).
  • Heavy Regularization: A Dropout(0.5) layer was integrated before the final classification head to force the network to distribute its learning across multiple feature maps.
  • Two-Phase Fine-Tuning: The model was initially trained with a frozen backbone to learn macroscopic edges, followed by a microscopic learning rate (1e-5) unfreeze phase to capture specific cellular textures.

Performance

  • Validation Accuracy: ~98.5%
  • Dataset: LC25000 (25,000 images, 5 classes)
  • Framework: TensorFlow 2.x (.keras format)

How to Use

You can load this model directly into your Python environment or web backend using TensorFlow/Keras:

import tensorflow as tf
import numpy as np

# 1. Load the model
model = tf.keras.models.load_model('xpathology_v2_5class_finetuned.keras')

# 2. Preprocess your image (MobileNetV2 expects 224x224 and pixel scaling)
def preprocess_image(image_path):
    img = tf.keras.utils.load_img(image_path, target_size=(224, 224))
    img_array = tf.keras.utils.img_to_array(img)
    img_array = tf.expand_dims(img_array, 0) # Create a batch
    return tf.keras.applications.mobilenet_v2.preprocess_input(img_array)

# 3. Run Inference
image_tensor = preprocess_image('path_to_your_scan.jpeg')
predictions = model.predict(image_tensor)

classes = ['Colon Adenocarcinoma', 'Colon Benign', 'Lung Adenocarcinoma', 'Lung Benign', 'Lung Squamous Cell Carcinoma']
print(f"Diagnosis: {classes[np.argmax(predictions)]}")
print(f"Confidence: {np.max(predictions) * 100:.2f}%")
Downloads last month
35
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support