|
|
--- |
|
|
license: mit |
|
|
tags: |
|
|
- medical |
|
|
--- |
|
|
# π§ Brain CT Classification with Keras (InceptionResNetV2) |
|
|
|
|
|
This repository contains a fine-tuned **TensorFlow/Keras** image classification model for classifying Brain CT scans into three categories: |
|
|
|
|
|
- Aneurysm |
|
|
- Cancer |
|
|
- Tumor |
|
|
|
|
|
The model is developed using the **color-enhanced medical imaging dataset**. It leverages pretrained CNN architectures such as **InceptionResNetV2** in **TensorFlow/Keras**, fine-tuned for medical image classification tasks. |
|
|
|
|
|
The objective of this work is to demonstrate how colorization of grayscale CT scans can aid in improving model performance and interpretability in the field of medical diagnostics. |
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
## π Dataset Information |
|
|
|
|
|
- **Original Dataset Name**: Computed Tomography (CT) of the Brain - Medical Imaging (CT-Xray) Colorization New Dataset |
|
|
- **Source**: [Shuvo Kumar Basak - Kaggle](https://www.kaggle.com/datasets/shuvokumarbasakbd/brain-ct-medical-imaging-colorized-dataset) |
|
|
- **Note**: This dataset is publicly available for non-commercial research and educational purposes. The model does not include or redistribute the dataset. |
|
|
|
|
|
--- |
|
|
|
|
|
## π§ Model Architecture |
|
|
|
|
|
- **Framework**: TensorFlow + Keras |
|
|
- **Model Type**: InceptionResNetV2 (with ImageNet weights) |
|
|
- **Input Size**: 299x299 (for InceptionResNetV2) |
|
|
- **Number of Classes**: 3 |
|
|
- **Training Strategy**: |
|
|
- Global Average Pooling |
|
|
- Dense layers with ReLU and Dropout |
|
|
- Final output layer with softmax activation |
|
|
|
|
|
--- |
|
|
|
|
|
## π Training Summary |
|
|
|
|
|
### π Preprocessing |
|
|
|
|
|
- Images resized to `299x299` depending on the model |
|
|
- Normalized to [0, 1] range |
|
|
|
|
|
### π§ͺ Training Details |
|
|
|
|
|
- **Loss Function**: Categorical Crossentropy |
|
|
- **Optimizer**: Adam |
|
|
- **Batch Size**: 32 |
|
|
- **Epochs**: 30 (early stopping used) |
|
|
|
|
|
--- |
|
|
|
|
|
## π Intended Use |
|
|
|
|
|
This model is built for: |
|
|
|
|
|
- Educational projects in deep learning and medical imaging |
|
|
- Research on CT-based brain abnormality classification |
|
|
- Model interpretability using Grad-CAM++ visualization |
|
|
|
|
|
> β οΈ **Not intended for clinical diagnosis or deployment without extensive validation and regulatory approval.** |
|
|
|
|
|
--- |
|
|
|
|
|
## π Inference Example (Python - TensorFlow) |
|
|
|
|
|
```python |
|
|
from tensorflow.keras.models import load_model |
|
|
from tensorflow.keras.preprocessing import image |
|
|
import numpy as np |
|
|
|
|
|
# Load model |
|
|
model = load_model("brain_ct_classifier.h5") |
|
|
|
|
|
# Preprocess |
|
|
img = image.load_img("example_brain_ct.jpg", target_size=(299, 299)) |
|
|
img_array = image.img_to_array(img) / 255.0 |
|
|
img_array = np.expand_dims(img_array, axis=0) |
|
|
|
|
|
# Predict |
|
|
pred = model.predict(img_array) |
|
|
class_idx = np.argmax(pred) |
|
|
class_names = ["Aneurysm", "Cancer", "Tumor"] |
|
|
|
|
|
print("Predicted class:", class_names[class_idx]) |