Downloads · 30 days
6
9% of all-time downloads
rarfileexe/XPathology-CNN_2.0_advance
XPathology-CNN_2.0_advance is a image classification model from rarfileexe. Use it when you need a label for an image. It is set up for keras. The card lists the license as mit.
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…
Downloads · 30 days
6
9% of all-time downloads
All-time downloads
66
Public
Repo size
24.6 MB
Likes
1
Public
Click a slice to open those files.
.keras24.6 MB · 100%
From the Hugging Face model README
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:
colon_aca: Colon Adenocarcinoma (Malignant)colon_n: Colon Benign Tissuelung_aca: Lung Adenocarcinoma (Malignant)lung_n: Lung Benign Tissuelung_scc: Lung Squamous Cell Carcinoma (Malignant)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:
Dropout(0.5) layer was integrated before the final classification head to force the network to distribute its learning across multiple feature maps.1e-5) unfreeze phase to capture specific cellular textures.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}%")