iKidney CT classifier (EfficientNetB0, 4 classes)

Four-class kidney CT image classifier from iKidney, my final year project: an end-to-end research prototype that combines CT classification, tumor segmentation, Grad-CAM explainability, reporting and 3D/VR visualization.

Classes: Cyst, Normal, Stone, Tumor.

Not a medical device. This is an academic research prototype. It is not clinically validated and must not be used for diagnosis or patient care.

Model

Architecture EfficientNetB0 backbone (ImageNet initialization), 4-class softmax head
Framework TensorFlow / Keras (best_phase2.keras, two-phase fine-tuning)
Input 224 x 224 RGB, CT slice windowed with a kidney window (level 40 HU, width 400 HU)
Calibration temperature scaling, T = 0.3 (temperature.txt)
Companion model ikidney-tumor-segmentation-unet25d for tumor-positive cases

Results (project held-out test split)

Metric Value
Test accuracy 99.92%
Macro ROC AUC 1.0000
F1 Cyst / Normal / Stone / Tumor 0.9987 / 1.0000 / 0.9964 / 1.0000
Best validation accuracy (phase 1 / phase 2) 0.9979 / 1.0000

These numbers come from the project's curated held-out split of the public Kaggle dataset CT Kidney Dataset: Normal-Cyst-Tumor and Stone (nazmul0087). They are not external or hospital validation. Images from one public dataset can share acquisition characteristics, so expect lower performance on scans from other scanners or sites. The preserved evidence does not fully establish whether the headline accuracy came from the raw network or an earlier feature-space ensemble; treat it as the iKidney v4 project result.

How to use

import numpy as np, cv2, tensorflow as tf
from huggingface_hub import hf_hub_download

path = hf_hub_download("Hussnain1/ikidney-ct-classifier-efficientnetb0", "best_phase2.keras")
model = tf.keras.models.load_model(path)
CLASSES = ["Cyst", "Normal", "Stone", "Tumor"]

def window(hu, level=40, width=400):
    lo, hi = level - width / 2, level + width / 2
    return ((np.clip(hu, lo, hi) - lo) / (hi - lo) * 255).astype(np.uint8)

# hu_slice: 2D CT slice in Hounsfield units
img = cv2.cvtColor(window(hu_slice), cv2.COLOR_GRAY2RGB)
x = cv2.resize(img, (224, 224)).astype("float32")[None]
probs = model.predict(x)[0]
T = 0.3
calibrated = np.exp(np.log(np.clip(probs, 1e-7, 1)) / T); calibrated /= calibrated.sum()
print(dict(zip(CLASSES, calibrated.round(4))))

ikidney_unified.py in this repo is the full Streamlit demo (classifier + Grad-CAM + segmenter + 3D mask export) with the exact preprocessing used in the project.

Pipeline context

CT input β†’ windowing and preprocessing β†’ this classifier β†’ if tumor evidence, a 2.5D U-Net segments the tumor β†’ masks feed Grad-CAM overlays, the report and a 3D/VR view (kidney surface + tumor mesh).

Limitations

  • Research prototype, single public dataset, internal split only.
  • Image-level classification; it does not localize lesions (use the segmentation model for that).
  • Grad-CAM and calibrated confidence are interpretation aids, not proof that a prediction is correct.
  • The license covers these weights for non-commercial research; check the training dataset's own terms before any other use.

Author

Muhammad Hussnain Jamil Β· GitHub Β· LinkedIn Β· Portfolio

Downloads last month
36
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support