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
|
| 9 |
+
- mri
|
| 10 |
+
library_name: pytorch
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Brain Tumor Segmentation — DeepLabv3+ (ResNet-34 + ASPP + WBCE)
|
| 14 |
+
|
| 15 |
+
An implementation of the architecture and training recipe described in
|
| 16 |
+
Soomro et al., *"Boosting Brain Tumor Detection Accuracy in MRI Using
|
| 17 |
+
Transfer Learning and Fine-Tuned DeepLabv3+"* (IEEE Open Journal of the
|
| 18 |
+
Computer Society, 2026), trained on the CE-MRI brain tumor dataset
|
| 19 |
+
(Cheng et al., 233 patients, 3,064 T1-weighted contrast-enhanced axial
|
| 20 |
+
slices: glioma, meningioma, pituitary tumors).
|
| 21 |
+
|
| 22 |
+
This is a personal/academic reproduction project — **not the original
|
| 23 |
+
authors' model, not clinically validated, and not for medical use.**
|
| 24 |
+
See [Honest results](#honest-results-vs-the-paper) below before using
|
| 25 |
+
this for anything beyond learning/experimentation.
|
| 26 |
+
|
| 27 |
+
## Model architecture
|
| 28 |
+
|
| 29 |
+
- ResNet-34 encoder, initialized from ImageNet-pretrained weights
|
| 30 |
+
- Atrous Spatial Pyramid Pooling (ASPP), rates 12/16/18 + global image pooling
|
| 31 |
+
- Lightweight decoder fusing low-level and ASPP features (DeepLabv3+ design)
|
| 32 |
+
- Binary output: tumor vs. background, per pixel
|
| 33 |
+
- Trained with Weighted Binary Cross-Entropy (WBCE) loss, with per-slice
|
| 34 |
+
adaptive class-imbalance weighting
|
| 35 |
+
|
| 36 |
+
## Training setup
|
| 37 |
+
|
| 38 |
+
- 100 epochs, Adam optimizer (β1=0.9, β2=0.999, weight decay 1e-5),
|
| 39 |
+
initial LR 1e-4 with `ReduceLROnPlateau`
|
| 40 |
+
- Patient-wise 70/15/15 train/val/test split (163/35/35 patients) —
|
| 41 |
+
no patient's slices appear in more than one split, avoiding data leakage
|
| 42 |
+
- Image size 512×512, batch size 8
|
| 43 |
+
- Trained on a single Kaggle GPU session (T4×2)
|
| 44 |
+
|
| 45 |
+
Full training/evaluation code: **[link to your GitHub repo here]**
|
| 46 |
+
|
| 47 |
+
## Honest results vs. the paper
|
| 48 |
+
|
| 49 |
+
The paper reports ~98% DSC and ~99.3% sensitivity. This reproduction
|
| 50 |
+
falls meaningfully short of that on the two metrics that matter most for
|
| 51 |
+
segmentation quality (DSC, sensitivity), while matching closely on
|
| 52 |
+
accuracy/specificity — which is expected, since ~98% of pixels in these
|
| 53 |
+
images are background, so accuracy/specificity are dominated by the easy
|
| 54 |
+
majority class rather than tumor-finding ability.
|
| 55 |
+
|
| 56 |
+
| Metric | This model (test set, 35 held-out patients) | Paper |
|
| 57 |
+
|---|---:|---:|
|
| 58 |
+
| DSC (overall) | **75.6%** | 98.0% |
|
| 59 |
+
| Sensitivity | 88.95% | 99.3% |
|
| 60 |
+
| Specificity | 99.34% | 98.99% |
|
| 61 |
+
| Accuracy | 99.11% | 99.1% |
|
| 62 |
+
|
| 63 |
+
Per-tumor-type DSC: glioma 70.2%, meningioma 85.5%, pituitary 74.6% —
|
| 64 |
+
the same relative ordering (meningioma easiest, glioma hardest) as the
|
| 65 |
+
paper reports, which is a useful internal consistency check even though
|
| 66 |
+
absolute numbers differ.
|
| 67 |
+
|
| 68 |
+
**Why the gap likely exists** (in rough order of suspected impact):
|
| 69 |
+
1. The paper doesn't fully specify some architectural details (exact
|
| 70 |
+
decoder channel widths, output stride choice, precise augmentation
|
| 71 |
+
policy) — this implementation fills those gaps with standard
|
| 72 |
+
DeepLabv3+ conventions, which may not match the authors' exact setup.
|
| 73 |
+
2. Training was extended from 40 to 100 epochs and DSC barely moved
|
| 74 |
+
(74.3% → 75.6%), suggesting the model has converged for this
|
| 75 |
+
configuration — the remaining gap is not simply "needs more training."
|
| 76 |
+
3. Possible differences in preprocessing intensity (the paper mentions
|
| 77 |
+
CLAHE contrast enhancement; exact parameters aren't given) or data
|
| 78 |
+
augmentation strength.
|
| 79 |
+
|
| 80 |
+
This gap is reported transparently rather than hidden — reproducing a
|
| 81 |
+
paper's exact numbers without the authors' full implementation details
|
| 82 |
+
is a known hard problem in ML research, and getting a rigorous, honest
|
| 83 |
+
measurement of *how far off* a reproduction is is itself the useful
|
| 84 |
+
skill being demonstrated here.
|
| 85 |
+
|
| 86 |
+
## Intended use
|
| 87 |
+
|
| 88 |
+
- Educational / portfolio demonstration of a segmentation pipeline
|
| 89 |
+
(transfer learning, class-imbalance-aware loss, patient-wise
|
| 90 |
+
evaluation discipline)
|
| 91 |
+
- Starting point for further experimentation (e.g. testing architectural
|
| 92 |
+
variants, better augmentation, longer training with a different LR
|
| 93 |
+
schedule)
|
| 94 |
+
|
| 95 |
+
## Out of scope / not suitable for
|
| 96 |
+
|
| 97 |
+
- Any clinical, diagnostic, or medical decision-making use
|
| 98 |
+
- Deployment without independent validation on a properly consented,
|
| 99 |
+
IRB-approved clinical dataset
|
| 100 |
+
- Use as a certified medical device (it is not one, and has not been
|
| 101 |
+
evaluated as one)
|
| 102 |
+
|
| 103 |
+
## How to use
|
| 104 |
+
|
| 105 |
+
```python
|
| 106 |
+
import torch
|
| 107 |
+
from model import DeepLabV3Plus # from this repo's model.py
|
| 108 |
+
|
| 109 |
+
model = DeepLabV3Plus(num_classes=1, use_imagenet_init=False)
|
| 110 |
+
state = torch.load("pytorch_model.pt", map_location="cpu", weights_only=False)
|
| 111 |
+
model.load_state_dict(state)
|
| 112 |
+
model.eval()
|
| 113 |
+
|
| 114 |
+
# image: torch.Tensor, shape (1, 3, 512, 512), ImageNet-normalized
|
| 115 |
+
with torch.no_grad():
|
| 116 |
+
logits = model(image)
|
| 117 |
+
mask = (torch.sigmoid(logits) > 0.5).float()
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
See the [GitHub repo](#) for the full `dataset.py` preprocessing pipeline
|
| 121 |
+
(CLAHE + ImageNet normalization) needed to prepare inputs correctly.
|
| 122 |
+
|
| 123 |
+
## Dataset
|
| 124 |
+
|
| 125 |
+
Trained on the CE-MRI brain tumor dataset (Cheng et al., 2017,
|
| 126 |
+
*"Enhanced performance of brain tumor classification via tumor region
|
| 127 |
+
augmentation and partition,"* PLoS ONE). This repository does not
|
| 128 |
+
redistribute the dataset — see the original publication for access.
|
| 129 |
+
|
| 130 |
+
## Citation
|
| 131 |
+
|
| 132 |
+
If referencing the original paper this reproduces:
|
| 133 |
+
|
| 134 |
+
```
|
| 135 |
+
Soomro et al., "Boosting Brain Tumor Detection Accuracy in MRI Using
|
| 136 |
+
Transfer Learning and Fine-Tuned DeepLabv3+," IEEE Open Journal of the
|
| 137 |
+
Computer Society, vol. 7, 2026.
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
This repository is an independent reproduction and is not affiliated
|
| 141 |
+
with the original authors.
|