-
Notifications
You must be signed in to change notification settings - Fork 0
Dataset Setup
motazalqaoud edited this page Jun 26, 2026
·
2 revisions
The project uses the Kaggle Brain Tumor 12K MRI Dataset — 12,000+ T1/T2 weighted 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_/
├── Glioma/
│ ├── T1/
│ │ └── [subtype]/
│ │ ├── image.jpg
│ │ ├── image_mask_consensus.png
│ │ ├── image_bbox.png
│ │ └── image_meta.json
│ ├── T1C+/
│ └── T2/
├── Meningioma/
│ ├── T1/
│ ├── T1C+/
│ └── T2/
└── Pituitary/
├── T1/
├── T1C+/
└── T2/
python scripts/test_model.py --data-root data/raw/Images_Expected output:
Dataset size: XXXX
Image shape: torch.Size([1, 128, 128])
Mask shape: torch.Size([128, 128])
Model output shape: torch.Size([4, 4, 128, 128])
Forward pass OK
To test the pipeline without the dataset:
python scripts/generate_sample_data.py --n 20 --size 128
python scripts/train.py --epochs 5This generates NIfTI volumes in data/samples/ and trains the 2D U-Net on them.
| Property | Value |
|---|---|
| Total images | 12,000+ |
| Tumor classes | Glioma, Meningioma, Pituitary |
| 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 |