Kidney Tumor Identification β€” EfficientNetB4

Model Description

This model classifies kidney CT scan images into four categories using EfficientNetB4 with transfer learning and a custom classification head. It is part of the Kidney Tumor Identification System β€” a production-ready, explainable AI application for medical image analysis.

⚠️ Medical Disclaimer: This model is intended for research and educational purposes only. It is NOT a clinical diagnostic tool. Always consult a qualified radiologist or physician for medical decisions.


Model Details

Property Value
Architecture EfficientNetB4 + Custom Classification Head
Input Size 380 Γ— 380 Γ— 3
Output Classes 4 (Cyst, Normal, Stone, Tumor)
Pretrained Weights ImageNet
Framework TensorFlow / Keras
Training Strategy Two-phase transfer learning
Preprocessing tf.keras.applications.efficientnet.preprocess_input

Model Architecture

Input (380, 380, 3)
    ↓
EfficientNetB4 (frozen in phase 1, last 4 layers unfrozen in phase 2)
    ↓
GlobalAveragePooling2D
    ↓
BatchNormalization
    ↓
Dropout (0.3)
    ↓
Dense (4, softmax) β†’ [Cyst, Normal, Stone, Tumor]

Training Details

Dataset

  • Name: CT KIDNEY DATASET β€” Normal, Cyst, Tumor and Stone
  • Source: Kaggle
  • Total Images: 12,446
  • Split: 70% train / 15% validation / 15% test
Class Count
Normal 5,077
Cyst 3,709
Tumor 2,283
Stone 1,377

Training Configuration

Parameter Phase 1 Phase 2
Epochs 10 20
Learning Rate 0.001 0.0001
Batch Size 32 32
Base Model Frozen Last 4 layers unfrozen
Optimizer Adam Adam
Loss Categorical Crossentropy Categorical Crossentropy

Data Augmentation (Training only)

  • Random horizontal flip
  • Random rotation (Β±15Β°)
  • Random zoom (Β±10%)
  • Random brightness adjustment (Β±15%)

Hardware

  • GPU: Tesla T4 Γ— 2 (Kaggle Notebooks)
  • Training time: ~1.5 hours (phase 1 + phase 2)

Evaluation Results

Test Set Performance

Metric Value Threshold
Validation Accuracy 99.46% β€”
Test Accuracy 85.36% β€”
Test AUC-ROC 98.38% β‰₯ 90% βœ…
Test Sensitivity 85.36% β‰₯ 85% βœ…
Test Specificity 95.00% β€”
Test F1 Score 85.25% β€”

Evaluation Gate: Model is only pushed to production if AUC-ROC β‰₯ 0.90 AND Sensitivity β‰₯ 0.85. This gate is enforced automatically in the CI/CD pipeline.

MLflow Experiment Tracking

All training runs are logged on DagsHub: πŸ”— https://dagshub.com/himelds/kidney-tumor-identification-system.mlflow


How to Use

Quick inference

from huggingface_hub import hf_hub_download
import tensorflow as tf
import numpy as np
from PIL import Image

# Load model
model_path = hf_hub_download(
    repo_id="Himel000/kidney-tumor-efficientnetb4",
    filename="model.keras"
)
model = tf.keras.models.load_model(model_path)

# Class names (model output order)
CLASS_NAMES = ["Cyst", "Normal", "Stone", "Tumor"]

# Preprocess image
def preprocess(image_path):
    img = Image.open(image_path).convert("RGB").resize((380, 380))
    arr = np.array(img, dtype=np.float32)
    arr = tf.keras.applications.efficientnet.preprocess_input(arr)
    return np.expand_dims(arr, axis=0)

# Predict
image = preprocess("ct_scan.jpg")
predictions = model.predict(image)
predicted_class = CLASS_NAMES[np.argmax(predictions)]
confidence = float(np.max(predictions))

print(f"Prediction: {predicted_class} ({confidence:.2%} confidence)")

Via REST API

import requests

response = requests.post(
    "https://himel000-kidney-tumor-api.hf.space/api/v1/predict",
    files={"file": open("ct_scan.jpg", "rb")}
)

result = response.json()
print(f"Class: {result['predicted_class']}")
print(f"Confidence: {result['confidence']:.2%}")
print(f"Uncertain: {result['is_uncertain']}")
# result also contains: gradcam_base64, probabilities, uncertainty_score

Via Live Demo

πŸ‘‰ https://kidney-tumor-identification-system.streamlit.app/


Explainability

This model is deployed with full explainability support:

  • Grad-CAM β€” highlights regions of the CT scan the model focused on
  • Monte Carlo Dropout β€” runs 20 inference passes to estimate prediction uncertainty
  • Uncertainty flag β€” predictions with uncertainty score > 0.3 are flagged for radiologist review

Limitations

  • Trained on a single public dataset β€” may not generalize to CT scans from all machines or hospitals
  • Not validated in a clinical setting
  • Not FDA/CE cleared
  • Performance may vary on images with different contrast, resolution, or windowing settings
  • Class imbalance in training data (Normal: 5,077 vs Stone: 1,377) may affect performance on underrepresented classes

Intended Use

Appropriate uses

  • Medical AI research
  • Computer vision education
  • Benchmarking kidney CT classification models
  • Prototype for hospital-specific retraining

Inappropriate uses

  • Standalone clinical diagnosis
  • Replacement for radiologist evaluation
  • Any use without appropriate medical supervision

Citation

If you use this model in your research, please cite:

@software{das2026kidney,
  author = {Das, Himel},
  title = {Kidney Tumor Identification System},
  year = {2026},
  url = {https://github.com/himelds/kidney-tumor-identification-system},
  note = {EfficientNetB4-based CT scan classifier with Grad-CAM explainability}
}

Dataset citation:

@dataset{islam2022kidney,
  author = {Islam, Nazmul},
  title = {CT KIDNEY DATASET: Normal-Cyst-Tumor and Stone},
  year = {2022},
  publisher = {Kaggle},
  url = {https://www.kaggle.com/datasets/nazmul0087/ct-kidney-dataset-normal-cyst-tumor-and-stone}
}

Author

Himel Das

LinkedIn GitHub Email


License

MIT License β€” see LICENSE for details.

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

Space using Himel000/kidney-tumor-efficientnetb4 1

Evaluation results