Create Readme_BUS_UCLM.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140# BUS-UCLM (Breast Ultrasound Lesion Segmentation Dataset) β packaged in `saiteja33/MedThink-Seg/BUS-UCLM`
This README documents:1) **The original BUS-UCLM dataset** (what it contains, image sizes, labels, and original structure), and 2) **How BUS-UCLM is organized inside this Hugging Face repo** (`saiteja33/MedThink-Seg`, under the `BUS-UCLM/` directory).
---
## 1) Original BUS-UCLM dataset (source)
**Primary reference (Data Descriptor paper):** *βBUS-UCLM: Breast ultrasound lesion segmentation datasetβ* (Scientific Data, 2025). DOI: `10.1038/s41597-025-04562-3`
**Original dataset record (Mendeley Data, Version 3):** DOI: `10.17632/7fvgj4jsp7.3`
### What images are in BUS-UCLM?- **Modality:** breast **ultrasound (BUS)** images (**PNG**)- **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.- **Image size:** **768 Γ 1024** pixels (fixed). Pixel spacing varies across the dataset (paper reports the most common as 0.0639205 mm/pixel).
### Dataset size and counts- **Total images:** **683** (from **38** patients) - **Normal:** 419 - **Benign:** 174 - **Malignant:** 90
### Labels and annotationsBUS-UCLM provides **pixel-wise segmentation masks** (stored as **RGB PNG** masks):- **Malignant lesion:** **red** = (255, 0, 0)- **Benign lesion:** **green** = (0, 255, 0)- **Background / normal tissue:** **black** = (0, 0, 0)
### Original naming conventionFiles use:- **4 random letters** (anonymized patient identifier) + `_` + **sequence number** (image index within that patient), e.g.: - `ALWI_000.png`, `ALWI_001.png`, β¦
Typical layout:```BUS-UCLM/ββ images/ # ultrasound images (PNG)ββ masks/ # RGB segmentation masks (PNG)ββ <metadata>.csv # image-level metadata (name/label/resolution/etc.)```
**License (original):** CC BY 4.0 (per paper and Mendeley record)
---
## 2) BUS-UCLM inside `saiteja33/MedThink-Seg` (this Hugging Face repo)
**Location in repo:** `BUS-UCLM/` **Repo UI size (approx):** ~338 MB (as shown in the Hugging Face file browser)
### Whatβs included here?This HF packaging organizes samples into:- **lesion cases** in `BUS-UCLM/images/` with masks in `BUS-UCLM/masks/`, and- **normal cases** in `BUS-UCLM/normal/images/` with masks in `BUS-UCLM/normal/masks/`.
### Repo directory structure```BUS-UCLM/ββ images/ # lesion images (benign + malignant), PNGββ masks/ # corresponding masks for images/, PNG (same filenames)ββ normal/ ββ images/ # normal images, PNG ββ masks/ # corresponding masks for normal/images/, PNG```
### Naming convention in this repo- Filenames follow the original pattern like: `ALWI_000.png`- **Image β mask pairing rule:** the mask has the **exact same filename** as its image, but lives under the parallel `masks/` folder.
### Notes about the `normal/` masks- The original dataset encodes background/normal tissue as **black** in the RGB mask.- 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).
---
## 3) How to download / use (recommended)
### A) Download only `BUS-UCLM/` from this HF repo```pythonfrom huggingface_hub import snapshot_download
local_dir = snapshot_download( repo_id="saiteja33/MedThink-Seg", repo_type="dataset", allow_patterns=["BUS-UCLM/**"], # only pull BUS-UCLM subdir)print(local_dir)```
### B) Build (image, mask) pairs from the folder structure```pythonfrom pathlib import Path
root = Path(local_dir) / "BUS-UCLM"
# lesion (benign+malignant)lesion_imgs = sorted((root / "images").glob("*.png"))lesion_pairs = [(p, (root / "masks" / p.name)) for p in lesion_imgs]
# normalnormal_imgs = sorted((root / "normal" / "images").glob("*.png"))normal_pairs = [(p, (root / "normal" / "masks" / p.name)) for p in normal_imgs]
print("lesion pairs:", len(lesion_pairs))print("normal pairs:", len(normal_pairs))```
### C) Load with π€ Datasets (two common options)
**Option 1 β load just the images as an imagefolder dataset**```pythonfrom datasets import load_dataset
ds_imgs = load_dataset("imagefolder", data_dir=str(root / "images"))ds_norm = load_dataset("imagefolder", data_dir=str(root / "normal" / "images"))
print(ds_imgs)print(ds_norm)```
**Option 2 β use `load_dataset` on the repo (works only if there is a dataset script/config)**```pythonfrom datasets import load_datasetds = load_dataset("saiteja33/MedThink-Seg", data_dir="BUS-UCLM")print(ds)```
---
## CitationIf you use BUS-UCLM, cite the Scientific Data paper and the Mendeley record:
- Vallez, N. et al. *BUS-UCLM: Breast ultrasound lesion segmentation dataset.* Scientific Data (2025). DOI: `10.1038/s41597-025-04562-3`- BUS-UCLM (Mendeley Data, V3). DOI: `10.17632/7fvgj4jsp7.3`BUS-UCLM/Readme_BUS_UCLM.mdAdded+140