Upload folder using huggingface_hub
Browse files- .gitignore +1 -0
- README.md +90 -0
- best_model.pth +3 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
checkpoints
|
README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
tags:
|
| 5 |
+
- medical-segmentation
|
| 6 |
+
- pytorch
|
| 7 |
+
- brats
|
| 8 |
+
- unet
|
| 9 |
+
- mri
|
| 10 |
+
- brain-tumor
|
| 11 |
+
license: mit
|
| 12 |
+
metrics:
|
| 13 |
+
- val_loss: 0.012861
|
| 14 |
+
model-index:
|
| 15 |
+
- name: PicoUNet
|
| 16 |
+
results: []
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# PicoUNet for BraTS 2020 Tumor Segmentation
|
| 20 |
+
|
| 21 |
+
This model is a deep learning model for 3D/2D brain tumor segmentation, trained on the **BraTS 2020** dataset. It uses a **PicoUNet** architecture (a lightweight variant of U-Net) to segment brain tumors from MRI scans.
|
| 22 |
+
|
| 23 |
+
## Model Description
|
| 24 |
+
|
| 25 |
+
- **Architecture**: PicoUNet (Encoder-Decoder with Skip Connections)
|
| 26 |
+
- **Input Modalities**: 2 Channels (FLAIR, T1Ce) -> *Note: Standard BraTS has 4 (T1, T1Ce, T2, FLAIR), this model uses a subset.*
|
| 27 |
+
- **Output Classes**: 4 classes (mapped from BraTS labels)
|
| 28 |
+
- **Class 0**: Background
|
| 29 |
+
- **Class 1**: Necrotic and Non-Enhancing Tumor Core (NCR/NET) - *BraTS label 1*
|
| 30 |
+
- **Class 2**: Edema (ED) - *BraTS label 2*
|
| 31 |
+
- **Class 3**: Enhancing Tumor (ET) - *BraTS label 4* (Label 4 is mapped to 3)
|
| 32 |
+
|
| 33 |
+
## Dataset
|
| 34 |
+
|
| 35 |
+
The model fits on the **MICCAI BraTS 2020 Challenge Data**.
|
| 36 |
+
The dataset consists of multimodal MRI scans of glioblastoma (GBM/HGG) and lower-grade glioma (LGG).
|
| 37 |
+
All volumes are registered to the same template space (SRI24) and interpolated to the same resolution ($1 mm^3$).
|
| 38 |
+
|
| 39 |
+
### Preprocessing
|
| 40 |
+
- **Slicing**: 2D axial slices were extracted.
|
| 41 |
+
- **Resizing**: Images were resized to 128x128.
|
| 42 |
+
- **Normalization**: Min-Max normalization per slice.
|
| 43 |
+
|
| 44 |
+
## Training Configuration
|
| 45 |
+
|
| 46 |
+
Auto-generated from the model checkpoint:
|
| 47 |
+
- **Epochs Trained**: 20
|
| 48 |
+
- **Validation Loss**: 0.012861
|
| 49 |
+
- **Experiment Name**: Brats-UNet
|
| 50 |
+
- **Batch Size**: 64
|
| 51 |
+
- **Learning Rate**: 0.03
|
| 52 |
+
- **Seed**: 42
|
| 53 |
+
- **Optimizer**: SGD (Momentum 0.9)
|
| 54 |
+
- **Loss Function**: CrossEntropyLoss (or DiceLoss depending on experiment)
|
| 55 |
+
|
| 56 |
+
## Usage
|
| 57 |
+
|
| 58 |
+
To use this model, you need to preprocess your input image similarly to the training pipeline (extract 2 channels: FLAIR and T1Ce, resize to 128x128).
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
import torch
|
| 62 |
+
from miccai_brats.models.unet.unet import PicoUNet
|
| 63 |
+
|
| 64 |
+
# 1. Instantiate Model
|
| 65 |
+
model = PicoUNet(in_channels=2, num_classes=4)
|
| 66 |
+
|
| 67 |
+
# 2. Load Checkpoint
|
| 68 |
+
checkpoint = torch.load("best_model.pth", map_location="cpu")
|
| 69 |
+
model.load_state_dict(checkpoint['model_state_dict'])
|
| 70 |
+
|
| 71 |
+
model.eval()
|
| 72 |
+
|
| 73 |
+
# 3. Inference
|
| 74 |
+
input_tensor = torch.randn(1, 2, 128, 128) # Fake Batch of [FLAIR, T1Ce]
|
| 75 |
+
with torch.no_grad():
|
| 76 |
+
output = model(input_tensor)
|
| 77 |
+
prediction = torch.argmax(output, dim=1)
|
| 78 |
+
|
| 79 |
+
print("Predicted shape:", prediction.shape) # [1, 128, 128]
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## Intended Use & Limitations
|
| 83 |
+
- **Research Use Only**: This model is for educational and research purposes. It is not intended for clinical use.
|
| 84 |
+
- **Performance**: This is a "Pico" variant, optimized for speed and low compute, not for state-of-the-art accuracy.
|
| 85 |
+
|
| 86 |
+
## Citations
|
| 87 |
+
If you use the BraTS dataset, please cite:
|
| 88 |
+
1. Menze et al. "The Multimodal Brain Tumor Image Segmentation Benchmark (BRATS)", IEEE TMI 2015.
|
| 89 |
+
2. Bakas et al. "Advancing The Cancer Genome Atlas glioma MRI collections with expert segmentation labels and radiomic features", Nature Scientific Data 2017.
|
| 90 |
+
3. Bakas et al. "Identifying the Best Machine Learning Algorithms for Brain Tumor Segmentation, Progression Assessment, and Overall Survival Prediction in the BRATS Challenge", arXiv 2018.
|
best_model.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c104ee3df1be31240f9acc793dc884f84f51e45ffd2955ff6242ac7ccd190724
|
| 3 |
+
size 62109621
|