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|
+
|
| 3 |
+
This README documents:
|
| 4 |
+
1) **The original BUS-UCLM dataset** (what it contains, image sizes, labels, and original structure), and
|
| 5 |
+
2) **How BUS-UCLM is organized inside this Hugging Face repo** (`saiteja33/MedThink-Seg`, under the `BUS-UCLM/` directory).
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## 1) Original BUS-UCLM dataset (source)
|
| 10 |
+
|
| 11 |
+
**Primary reference (Data Descriptor paper):**
|
| 12 |
+
*“BUS-UCLM: Breast ultrasound lesion segmentation dataset”* (Scientific Data, 2025).
|
| 13 |
+
DOI: `10.1038/s41597-025-04562-3`
|
| 14 |
+
|
| 15 |
+
**Original dataset record (Mendeley Data, Version 3):**
|
| 16 |
+
DOI: `10.17632/7fvgj4jsp7.3`
|
| 17 |
+
|
| 18 |
+
### What images are in BUS-UCLM?
|
| 19 |
+
- **Modality:** breast **ultrasound (BUS)** images (**PNG**)
|
| 20 |
+
- **Clinical origin:** 2022–2023 scans from a hospital cohort (38 patients), acquired on a **Siemens ACUSON S2000** ultrasound system (18L6 HD probe) and later converted from DICOM to PNG.
|
| 21 |
+
- **Image size:** **768 × 1024** pixels (fixed). Pixel spacing varies across the dataset (paper reports the most common as 0.0639205 mm/pixel).
|
| 22 |
+
|
| 23 |
+
### Dataset size and counts
|
| 24 |
+
- **Total images:** **683** (from **38** patients)
|
| 25 |
+
- **Normal:** 419
|
| 26 |
+
- **Benign:** 174
|
| 27 |
+
- **Malignant:** 90
|
| 28 |
+
|
| 29 |
+
### Labels and annotations
|
| 30 |
+
BUS-UCLM provides **pixel-wise segmentation masks** (stored as **RGB PNG** masks):
|
| 31 |
+
- **Malignant lesion:** **red** = (255, 0, 0)
|
| 32 |
+
- **Benign lesion:** **green** = (0, 255, 0)
|
| 33 |
+
- **Background / normal tissue:** **black** = (0, 0, 0)
|
| 34 |
+
|
| 35 |
+
### Original naming convention
|
| 36 |
+
Files use:
|
| 37 |
+
- **4 random letters** (anonymized patient identifier) + `_` + **sequence number** (image index within that patient), e.g.:
|
| 38 |
+
- `ALWI_000.png`, `ALWI_001.png`, …
|
| 39 |
+
|
| 40 |
+
Typical layout:
|
| 41 |
+
```
|
| 42 |
+
BUS-UCLM/
|
| 43 |
+
├─ images/ # ultrasound images (PNG)
|
| 44 |
+
├─ masks/ # RGB segmentation masks (PNG)
|
| 45 |
+
└─ <metadata>.csv # image-level metadata (name/label/resolution/etc.)
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
**License (original):** CC BY 4.0 (per paper and Mendeley record)
|
| 49 |
+
|
| 50 |
+
---
|
| 51 |
+
|
| 52 |
+
## 2) BUS-UCLM inside `saiteja33/MedThink-Seg` (this Hugging Face repo)
|
| 53 |
+
|
| 54 |
+
**Location in repo:** `BUS-UCLM/`
|
| 55 |
+
**Repo UI size (approx):** ~338 MB (as shown in the Hugging Face file browser)
|
| 56 |
+
|
| 57 |
+
### What’s included here?
|
| 58 |
+
This HF packaging organizes samples into:
|
| 59 |
+
- **lesion cases** in `BUS-UCLM/images/` with masks in `BUS-UCLM/masks/`, and
|
| 60 |
+
- **normal cases** in `BUS-UCLM/normal/images/` with masks in `BUS-UCLM/normal/masks/`.
|
| 61 |
+
|
| 62 |
+
### Repo directory structure
|
| 63 |
+
```
|
| 64 |
+
BUS-UCLM/
|
| 65 |
+
├─ images/ # lesion images (benign + malignant), PNG
|
| 66 |
+
├─ masks/ # corresponding masks for images/, PNG (same filenames)
|
| 67 |
+
└─ normal/
|
| 68 |
+
├─ images/ # normal images, PNG
|
| 69 |
+
└─ masks/ # corresponding masks for normal/images/, PNG
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
### Naming convention in this repo
|
| 73 |
+
- Filenames follow the original pattern like: `ALWI_000.png`
|
| 74 |
+
- **Image ↔ mask pairing rule:** the mask has the **exact same filename** as its image, but lives under the parallel `masks/` folder.
|
| 75 |
+
|
| 76 |
+
### Notes about the `normal/` masks
|
| 77 |
+
- The original dataset encodes background/normal tissue as **black** in the RGB mask.
|
| 78 |
+
- In this repo, normal images are stored separately under `normal/images/`, and the corresponding `normal/masks/` are expected to be all-background (black) masks (verify visually if needed).
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
|
| 82 |
+
## 3) How to download / use (recommended)
|
| 83 |
+
|
| 84 |
+
### A) Download only `BUS-UCLM/` from this HF repo
|
| 85 |
+
```python
|
| 86 |
+
from huggingface_hub import snapshot_download
|
| 87 |
+
|
| 88 |
+
local_dir = snapshot_download(
|
| 89 |
+
repo_id="saiteja33/MedThink-Seg",
|
| 90 |
+
repo_type="dataset",
|
| 91 |
+
allow_patterns=["BUS-UCLM/**"], # only pull BUS-UCLM subdir
|
| 92 |
+
)
|
| 93 |
+
print(local_dir)
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
### B) Build (image, mask) pairs from the folder structure
|
| 97 |
+
```python
|
| 98 |
+
from pathlib import Path
|
| 99 |
+
|
| 100 |
+
root = Path(local_dir) / "BUS-UCLM"
|
| 101 |
+
|
| 102 |
+
# lesion (benign+malignant)
|
| 103 |
+
lesion_imgs = sorted((root / "images").glob("*.png"))
|
| 104 |
+
lesion_pairs = [(p, (root / "masks" / p.name)) for p in lesion_imgs]
|
| 105 |
+
|
| 106 |
+
# normal
|
| 107 |
+
normal_imgs = sorted((root / "normal" / "images").glob("*.png"))
|
| 108 |
+
normal_pairs = [(p, (root / "normal" / "masks" / p.name)) for p in normal_imgs]
|
| 109 |
+
|
| 110 |
+
print("lesion pairs:", len(lesion_pairs))
|
| 111 |
+
print("normal pairs:", len(normal_pairs))
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
### C) Load with 🤗 Datasets (two common options)
|
| 115 |
+
|
| 116 |
+
**Option 1 — load just the images as an imagefolder dataset**
|
| 117 |
+
```python
|
| 118 |
+
from datasets import load_dataset
|
| 119 |
+
|
| 120 |
+
ds_imgs = load_dataset("imagefolder", data_dir=str(root / "images"))
|
| 121 |
+
ds_norm = load_dataset("imagefolder", data_dir=str(root / "normal" / "images"))
|
| 122 |
+
|
| 123 |
+
print(ds_imgs)
|
| 124 |
+
print(ds_norm)
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
**Option 2 — use `load_dataset` on the repo (works only if there is a dataset script/config)**
|
| 128 |
+
```python
|
| 129 |
+
from datasets import load_dataset
|
| 130 |
+
ds = load_dataset("saiteja33/MedThink-Seg", data_dir="BUS-UCLM")
|
| 131 |
+
print(ds)
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
---
|
| 135 |
+
|
| 136 |
+
## Citation
|
| 137 |
+
If you use BUS-UCLM, cite the Scientific Data paper and the Mendeley record:
|
| 138 |
+
|
| 139 |
+
- Vallez, N. et al. *BUS-UCLM: Breast ultrasound lesion segmentation dataset.* Scientific Data (2025). DOI: `10.1038/s41597-025-04562-3`
|
| 140 |
+
- BUS-UCLM (Mendeley Data, V3). DOI: `10.17632/7fvgj4jsp7.3`
|