|
|
--- |
|
|
license: apache-2.0 |
|
|
language: |
|
|
- en |
|
|
tags: |
|
|
- medical-imaging |
|
|
- kidney-disease |
|
|
- ct-scan |
|
|
- image-classification |
|
|
- pytorch |
|
|
- efficientnet |
|
|
- custom-cnn |
|
|
metrics: |
|
|
- accuracy |
|
|
- f1 |
|
|
library_name: pytorch |
|
|
pipeline_tag: image-classification |
|
|
datasets: |
|
|
- nazmul0087/ct-kidney-dataset-normal-cyst-tumor-and-stone |
|
|
--- |
|
|
|
|
|
# Kidney Ct Classifier Efficientnet |
|
|
|
|
|
## Model Description |
|
|
|
|
|
Custom EfficientNet-style CNN for kidney CT scan classification (101M params, 95%+ accuracy) |
|
|
|
|
|
This is a custom EfficientNet-style CNN trained from scratch for kidney CT scan classification. The model classifies kidney CT images into 4 categories: Cyst, Normal, Stone, and Tumor. |
|
|
|
|
|
## Model Details |
|
|
|
|
|
- **Model Type:** Custom EfficientNet-style Convolutional Neural Network |
|
|
- **Architecture:** 101M parameters, 7 stages with MBConv blocks |
|
|
- **Input Resolution:** 384x384x3 RGB images |
|
|
- **Number of Classes:** 4 (Cyst, Normal, Stone, Tumor) |
|
|
- **Framework:** PyTorch 2.0+ |
|
|
- **Training Precision:** BF16 mixed precision on NVIDIA A100 |
|
|
- **No Pretrained Weights:** Trained from scratch on medical imaging data |
|
|
|
|
|
## Performance |
|
|
|
|
|
### Test Set Results |
|
|
|
|
|
- **Accuracy:** 95.00% |
|
|
- **F1-Score:** 0.9400 |
|
|
|
|
|
### Per-Class Performance |
|
|
|
|
|
| Class | Precision | Recall | F1-Score | |
|
|
|---|---|---|---| |
|
|
| Cyst | High | High | High | |
|
|
| Normal | High | High | High | |
|
|
| Stone | Good | Good | Good | |
|
|
| Tumor | Good | Good | Good | |
|
|
|
|
|
## Training Details |
|
|
|
|
|
|
|
|
The model was trained on the CT Kidney Dataset with the following approach: |
|
|
|
|
|
- Custom EfficientNet-style architecture built from scratch |
|
|
- 101 million trainable parameters |
|
|
- Width multiplier: 1.4, Depth multiplier: 1.4 |
|
|
- Input resolution: 384x384 pixels |
|
|
- BF16 mixed precision training on NVIDIA A100 |
|
|
- AdamW optimizer with OneCycleLR scheduler |
|
|
- Extensive data augmentation (5x multiplication) |
|
|
- No data leakage: splits created before augmentation |
|
|
- Training time: 10.5 hours on A100 40GB |
|
|
|
|
|
|
|
|
### Training Configuration |
|
|
|
|
|
- **Epochs:** 40 |
|
|
- **Batch Size:** 48 |
|
|
- **Optimizer:** AdamW (lr=2e-3, weight_decay=2e-4) |
|
|
- **Scheduler:** OneCycleLR with cosine annealing |
|
|
- **Loss Function:** CrossEntropyLoss with label smoothing (0.1) |
|
|
- **Regularization:** Dropout (0.35), Stochastic Depth (0-0.2) |
|
|
- **Data Augmentation:** Extensive augmentation including rotation, flip, brightness/contrast, CLAHE |
|
|
- **Hardware:** NVIDIA A100 40GB with BF16 precision |
|
|
- **Training Time:** ~10.5 hours for 40 epochs |
|
|
|
|
|
### Data Split |
|
|
|
|
|
- **Training:** 80% (augmented to ~78,000 images) |
|
|
- **Validation:** 10% (original, no augmentation) |
|
|
- **Testing:** 10% (original, no augmentation) |
|
|
- **No Data Leakage:** Splits created before augmentation |
|
|
|
|
|
## Intended Use |
|
|
|
|
|
### Primary Use Cases |
|
|
|
|
|
- Medical research and educational purposes |
|
|
- Kidney disease classification from CT scans |
|
|
- Computer-aided diagnosis (CAD) system development |
|
|
- Medical imaging research |
|
|
|
|
|
### Limitations |
|
|
|
|
|
- Model trained on specific dataset distribution |
|
|
- Should not be used as sole diagnostic tool |
|
|
- Requires clinical validation before medical use |
|
|
- Performance may vary on images from different scanners or protocols |
|
|
|
|
|
## How to Use |
|
|
|
|
|
### Installation |
|
|
|
|
|
```bash |
|
|
pip install torch torchvision pillow |
|
|
``` |
|
|
### Inference Example |
|
|
```python |
|
|
import torch |
|
|
from PIL import Image |
|
|
from torchvision import transforms |
|
|
|
|
|
# Load model |
|
|
model = torch.load('model.pth') |
|
|
model.eval() |
|
|
|
|
|
# Prepare image |
|
|
transform = transforms.Compose([ |
|
|
transforms.Resize((384, 384)), |
|
|
transforms.ToTensor(), |
|
|
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]) |
|
|
]) |
|
|
|
|
|
# Predict |
|
|
image = Image.open('kidney_ct.jpg').convert('RGB') |
|
|
image_tensor = transform(image).unsqueeze(0) |
|
|
|
|
|
with torch.no_grad(): |
|
|
output = model(image_tensor) |
|
|
probs = torch.softmax(output, dim=1) |
|
|
pred = output.argmax(1).item() |
|
|
|
|
|
classes = ['Cyst', 'Normal', 'Stone', 'Tumor'] |
|
|
print(f"Prediction: {classes[pred]} ({probs[0][pred].item()*100:.1f}% confidence)") |
|
|
``` |
|
|
## Dataset |
|
|
|
|
|
**Name:** nazmul0087/ct-kidney-dataset-normal-cyst-tumor-and-stone |
|
|
|
|
|
The model was trained on the CT Kidney Dataset containing 12,446 CT scan images across 4 classes. The dataset consists of coronal and axial cuts from PACS systems, verified by medical professionals. |
|
|
|
|
|
## Ethical Considerations |
|
|
|
|
|
- This model is for research and educational purposes only |
|
|
- Not FDA approved or clinically validated |
|
|
- Should not replace professional medical diagnosis |
|
|
- Requires human oversight and clinical validation |
|
|
- May have biases from training data distribution |
|
|
|
|
|
## Citation |
|
|
|
|
|
If you use this model in your research, please cite: |
|
|
```bibtex |
|
|
@misc{kidneyctclassifierefficientnet, |
|
|
author = {Arko007}, |
|
|
title = {Kidney Ct Classifier Efficientnet}, |
|
|
year = {2025}, |
|
|
publisher = {Hugging Face}, |
|
|
howpublished = {\url{[https://huggingface.co/](https://huggingface.co/)Arko007/Kidney Ct Classifier Efficientnet}} |
|
|
} |
|
|
``` |
|
|
## License |
|
|
|
|
|
Apache License 2.0 - See LICENSE file for details |
|
|
|
|
|
## Contact |
|
|
|
|
|
For questions or issues, please open an issue on the model repository. |
|
|
|
|
|
## Acknowledgments |
|
|
|
|
|
- Dataset: nazmul0087/ct-kidney-dataset-normal-cyst-tumor-and-stone |
|
|
- Training infrastructure: NVIDIA A100 GPU |
|
|
- Framework: PyTorch |
|
|
|