-
Notifications
You must be signed in to change notification settings - Fork 0
Dataset Setup
motazalqaoud edited this page Jun 28, 2026
·
2 revisions
The project uses the Kaggle Brain Tumor 12K MRI Dataset — 12,643 MRI slices with consensus segmentation masks, bounding boxes, and JSON metadata.
pip install kaggle- Go to kaggle.com → Account → API → Create New Token
- This downloads
kaggle.json - Place it at
~/.kaggle/kaggle.json - Set permissions:
chmod 600 ~/.kaggle/kaggle.json
kaggle datasets download -d fernando2rad/brain-tumor-12k-mri-images-w-masks-meta-and-bbox
unzip brain-tumor-12k-mri-images-w-masks-meta-and-bbox.zip -d data/raw/After extraction, data/raw/ should look like this:
data/raw/
└── Images_/
├── Gliomas/
│ ├── T1/
│ │ └── [subtype]/
│ │ ├── image.jpg
│ │ ├── image_mask_consensus.png
│ │ ├── image_bbox.png
│ │ └── image_meta.json
│ ├── T1C+/
│ └── T2/
├── Meningothelial Tumors/
├── Nerve Sheath Tumors/
├── Embryonic Tumors/
├── Mixed Neuronal and Neuronal-Glial Tumors/
├── Mesenchymal (Non-Meningothelial Tumors)/
├── Germ Cell Tumors/
└── Normal/
python scripts/test_model.py --data-root data/raw/Images_Expected output:
Dataset size: XXXX
Image shape: torch.Size([1, 64, 64])
Mask shape: torch.Size([64, 64])
Model output shape: torch.Size([4, 8, 64, 64])
Forward pass OK
| Property | Value |
|---|---|
| Total images | 12,643 |
| Tumor categories | 7 WHO categories + Normal (see class mapping below) |
| MRI modalities | T1, T1C+ (contrast), T2 |
| Mask format | PNG (consensus segmentation) |
| Metadata | JSON (bounding box, tumor subtype) |
| Image format | JPG (MRI slices) |
| License | CC BY-NC-SA 4.0 |
| Folder | Class ID | Description |
|---|---|---|
| Normal | 0 | Background only — no tumor pixels |
| Gliomas | 1 | Astrocytoma, Glioblastoma, Oligodendroglioma |
| Meningothelial Tumors | 2 | Meningioma subtypes |
| Nerve Sheath Tumors | 3 | Schwannoma, Neurocytoma |
| Embryonic Tumors | 4 | Medulloblastoma, DNET |
| Mixed Neuronal and Neuronal-Glial Tumors | 5 | Ependymoma, Ganglioglioma |
| Mesenchymal (Non-Meningothelial Tumors) | 6 | Hemangiopericytoma |
| Germ Cell Tumors | 7 | Germinoma |
Pseudo-labels are assigned at the folder level: all tumor pixels in an image from the Gliomas/ folder receive class ID 1. This is weakly-supervised segmentation — we leverage binary masks and folder-level category labels together.