Create README_Brain-Tumor_MedThinkSeg.md
Browse files
Brain-Tumor/README_Brain-Tumor_MedThinkSeg.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Brain-Tumor (Kaggle “Brain Tumor Image DataSet : Semantic Segmentation”) — packaged in `saiteja33/MedThink-Seg/Brain-Tumor`
|
| 2 |
+
|
| 3 |
+
This README documents:
|
| 4 |
+
1) **The original Kaggle Brain Tumor Image DataSet : Semantic Segmentation** (what it contains, size, and original structure), and
|
| 5 |
+
2) **How it is organized inside this Hugging Face repo** (`saiteja33/MedThink-Seg`, under the `Brain-Tumor/` directory).
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## 1) Original dataset (source)
|
| 10 |
+
|
| 11 |
+
**Original Kaggle dataset:**
|
| 12 |
+
https://www.kaggle.com/datasets/pkdarabi/brain-tumor-image-dataset-semantic-segmentation
|
| 13 |
+
|
| 14 |
+
**Creator (as cited in dataset cards mirroring the Kaggle release):** Peyman Darabi (Aug 2023)
|
| 15 |
+
|
| 16 |
+
### What kind of images are included?
|
| 17 |
+
- **Modality:** Brain **MRI** images for tumor region analysis.
|
| 18 |
+
- **Image format & size (commonly reported for this Kaggle release):**
|
| 19 |
+
- **JPEG** images
|
| 20 |
+
- **640 × 640** resolution
|
| 21 |
+
- **Classes:** 2 classes:
|
| 22 |
+
- **Tumor**
|
| 23 |
+
- **Non-tumor / Normal**
|
| 24 |
+
|
| 25 |
+
### Dataset size and counts
|
| 26 |
+
A widely-used mirror of this Kaggle dataset reports:
|
| 27 |
+
- **Total images:** **2,146**
|
| 28 |
+
- **Splits:**
|
| 29 |
+
- **Train:** 1,502
|
| 30 |
+
- **Validation:** 429
|
| 31 |
+
- **Test:** 215
|
| 32 |
+
|
| 33 |
+
> Note: The original Kaggle page is sometimes hard to scrape automatically; the counts above match publicly available mirrors of the Kaggle dataset.
|
| 34 |
+
|
| 35 |
+
### Labels and annotations (original)
|
| 36 |
+
The original release is commonly distributed as **COCO-style annotations**, including:
|
| 37 |
+
- **Bounding boxes** (`bbox`)
|
| 38 |
+
- **Polygon segmentation coordinates** (`segmentation`)
|
| 39 |
+
|
| 40 |
+
Some downstream analyses report that many “segmentations” are effectively **rectangular polygons** (i.e., bounding boxes), so this dataset may behave more like a detection dataset unless masks are rasterized carefully.
|
| 41 |
+
|
| 42 |
+
### Original naming convention (examples)
|
| 43 |
+
Mirrors of the dataset show filenames like:
|
| 44 |
+
- `2256_jpg.rf.<hash>.jpg`
|
| 45 |
+
|
| 46 |
+
(Your copy may preserve these names.)
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
## 2) Organization inside this Hugging Face repo (`saiteja33/MedThink-Seg`)
|
| 51 |
+
|
| 52 |
+
**HF path:** `Brain-Tumor/`
|
| 53 |
+
**Repo UI size (shown in HF browser):** ~**466 MB**
|
| 54 |
+
|
| 55 |
+
This packaging contains **only images and masks** (no separate `normal/` folder).
|
| 56 |
+
|
| 57 |
+
### Directory structure (this repo)
|
| 58 |
+
```
|
| 59 |
+
Brain-Tumor/
|
| 60 |
+
├─ images/ # MRI images
|
| 61 |
+
└─ masks/ # segmentation masks (paired with images/)
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
### Pairing rule
|
| 65 |
+
- Each file in `Brain-Tumor/images/` has a corresponding mask in `Brain-Tumor/masks/`.
|
| 66 |
+
- **Filename matching:** mask filename matches the image filename (same base name).
|
| 67 |
+
Example (conceptual):
|
| 68 |
+
- `images/<name>.jpg` ↔ `masks/<name>.png` (or same extension if you kept it consistent)
|
| 69 |
+
|
| 70 |
+
### Mask format (practical note)
|
| 71 |
+
- If masks were rasterized from COCO polygons, they are typically **binary** masks:
|
| 72 |
+
- background = 0
|
| 73 |
+
- tumor = 1 (or 255)
|
| 74 |
+
- Verify a few masks to confirm pixel values before training.
|
| 75 |
+
|
| 76 |
+
---
|
| 77 |
+
|
| 78 |
+
## How to download / use (recommended)
|
| 79 |
+
|
| 80 |
+
### A) Download only `Brain-Tumor/` from this HF repo
|
| 81 |
+
```python
|
| 82 |
+
from huggingface_hub import snapshot_download
|
| 83 |
+
|
| 84 |
+
local_dir = snapshot_download(
|
| 85 |
+
repo_id="saiteja33/MedThink-Seg",
|
| 86 |
+
repo_type="dataset",
|
| 87 |
+
allow_patterns=["Brain-Tumor/**"], # only pull Brain-Tumor subdir
|
| 88 |
+
)
|
| 89 |
+
print(local_dir)
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
### B) Create (image, mask) pairs
|
| 93 |
+
```python
|
| 94 |
+
from pathlib import Path
|
| 95 |
+
|
| 96 |
+
root = Path(local_dir) / "Brain-Tumor"
|
| 97 |
+
img_dir = root / "images"
|
| 98 |
+
msk_dir = root / "masks"
|
| 99 |
+
|
| 100 |
+
images = sorted(list(img_dir.glob("*")))
|
| 101 |
+
pairs = [(p, msk_dir / p.name) for p in images]
|
| 102 |
+
|
| 103 |
+
missing = [p.name for p, m in pairs if not m.exists()]
|
| 104 |
+
print("num_images:", len(images))
|
| 105 |
+
print("missing_masks:", len(missing))
|
| 106 |
+
print("example_pair:", pairs[0] if pairs else None)
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
### C) Load with 🤗 Datasets (images only)
|
| 110 |
+
```python
|
| 111 |
+
from datasets import load_dataset
|
| 112 |
+
|
| 113 |
+
ds_imgs = load_dataset("imagefolder", data_dir=str(img_dir))
|
| 114 |
+
print(ds_imgs)
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
(For segmentation training, most pipelines keep pairs via the folder structure as in **B**.)
|
| 118 |
+
|
| 119 |
+
---
|
| 120 |
+
|
| 121 |
+
## Citation
|
| 122 |
+
If you use this dataset, cite the Kaggle record:
|
| 123 |
+
|
| 124 |
+
- Peyman Darabi. *Brain Tumor Image DataSet : Semantic Segmentation.* Kaggle Dataset.
|
| 125 |
+
https://www.kaggle.com/datasets/pkdarabi/brain-tumor-image-dataset-semantic-segmentation
|