KMH158 commited on
Commit
a56b097
·
verified ·
1 Parent(s): db076b4

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +212 -45
README.md CHANGED
@@ -1,47 +1,214 @@
1
  ---
2
- dataset_info:
3
- features:
4
- - name: patient_id
5
- dtype: int32
6
- - name: report_number
7
- dtype: string
8
- - name: report
9
- dtype: string
10
- - name: slice_index
11
- dtype: int32
12
- - name: frame_index
13
- dtype: int32
14
- - name: is_optimal
15
- dtype: bool
16
- - name: optimal_slice
17
- dtype: int32
18
- - name: image_t1
19
- dtype: image
20
- - name: image_t1ce
21
- dtype: image
22
- - name: image_t2
23
- dtype: image
24
- - name: image_flair
25
- dtype: image
26
- splits:
27
- - name: train
28
- num_bytes: 155018602.0
29
- num_examples: 1660
30
- - name: validation
31
- num_bytes: 19795441.0
32
- num_examples: 210
33
- - name: test
34
- num_bytes: 18848991.0
35
- num_examples: 210
36
- download_size: 192849980
37
- dataset_size: 193663034.0
38
- configs:
39
- - config_name: default
40
- data_files:
41
- - split: train
42
- path: data/train-*
43
- - split: validation
44
- path: data/validation-*
45
- - split: test
46
- path: data/test-*
47
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: cc-by-nc-4.0
3
+ task_categories:
4
+ - image-to-text
5
+ - text-generation
6
+ tags:
7
+ - medical
8
+ - radiology
9
+ - brain-tumor
10
+ - mri
11
+ - report-generation
12
+ pretty_name: BraTS 2020 Radiology Reports
13
+ size_categories:
14
+ - 1K<n<10K
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  ---
16
+
17
+ # BraTS 2020 - Brain Tumor Radiology Report Generation Dataset
18
+
19
+ ## Dataset Description
20
+
21
+ This dataset contains paired brain MRI scans and radiology reports for training image-to-text models for automated radiology report generation.
22
+
23
+ ### Dataset Summary
24
+
25
+ - **Total Patients:** 166
26
+ - **Total Images:** 2080
27
+ - **Modalities:** T1, T1ce, T2, FLAIR (4 modalities per frame)
28
+ - **Frames per Patient:** 10 (optimal slice ± neighbors)
29
+ - **Image Size:** 224x224
30
+ - **Source:** BraTS 2020 Challenge
31
+
32
+ ### Splits
33
+
34
+ | Split | Patients | Images |
35
+ |-------|----------|--------|
36
+ | Train | 166 | 1660 |
37
+ | Validation | 21 | 210 |
38
+ | Test | 21 | 210 |
39
+
40
+ ## Dataset Structure
41
+
42
+ ### Data Fields
43
+
44
+ - `patient_id` (int): Unique patient identifier
45
+ - `report_number` (str): Original report number (TR001, TR002, etc.)
46
+ - `report` (str): Full radiology report text
47
+ - `slice_index` (int): Axial slice index in the MRI volume
48
+ - `frame_index` (int): Frame number (0-9, where frame ~5 is optimal)
49
+ - `is_optimal` (bool): Whether this is the optimal slice for this patient
50
+ - `optimal_slice` (int): The optimal slice index for this patient
51
+ - `image_t1` (Image): T1-weighted MRI image
52
+ - `image_t1ce` (Image): T1 contrast-enhanced MRI image
53
+ - `image_t2` (Image): T2-weighted MRI image
54
+ - `image_flair` (Image): FLAIR MRI image
55
+
56
+ ### Data Sample
57
+
58
+ ```python
59
+ from datasets import load_dataset
60
+
61
+ dataset = load_dataset("KMH158/brats2020_shagufta")
62
+
63
+ # Access a sample
64
+ sample = dataset['train'][0]
65
+
66
+ print("Patient ID:", sample['patient_id'])
67
+ print("Report:", sample['report'][:200])
68
+ print("Modalities available:", ['t1', 't1ce', 't2', 'flair'])
69
+
70
+ # Display images
71
+ from PIL import Image
72
+ import matplotlib.pyplot as plt
73
+
74
+ fig, axes = plt.subplots(1, 4, figsize=(16, 4))
75
+ for idx, modality in enumerate(['t1', 't1ce', 't2', 'flair']):
76
+ axes[idx].imshow(sample[f'image_{modality}'], cmap='gray')
77
+ axes[idx].set_title(modality.upper())
78
+ axes[idx].axis('off')
79
+ plt.show()
80
+ ```
81
+
82
+ ## Methodology
83
+
84
+ ### Slice Selection
85
+
86
+ The optimal slice for each patient was determined using a trained regression model that:
87
+ 1. Predicts tumor burden based on image features
88
+ 2. Uses weighted scoring: 3×Necrotic + 2×Edema + 1×Enhancing
89
+ 3. Selects the slice with maximum tumor burden
90
+
91
+ Then, 5 slices before and 4 slices after the optimal slice are extracted for data augmentation.
92
+
93
+ ### Image Preprocessing
94
+
95
+ 1. **Normalization:** Global min-max normalization to [0, 255]
96
+ 2. **CLAHE:** Contrast Limited Adaptive Histogram Equalization
97
+ 3. **Resizing:** Bicubic interpolation to 224x224
98
+ 4. **Format:** RGB (3-channel grayscale)
99
+
100
+ ### Report Mapping
101
+
102
+ Reports were mapped from the original CSV using the "Number" column (TR001, TR002, etc.) to BraTS patient IDs.
103
+
104
+ ## Intended Use
105
+
106
+ ### Primary Use Case
107
+
108
+ Training vision-language models for:
109
+ - Automated radiology report generation
110
+ - Medical image captioning
111
+ - Clinical decision support
112
+
113
+ ### Example Models
114
+
115
+ - BLIP (Salesforce/blip-image-captioning-base)
116
+ - GIT (microsoft/git-base)
117
+ - ViT + GPT-2
118
+ - Custom vision-language architectures
119
+
120
+ ### Example Training Code
121
+
122
+ ```python
123
+ from datasets import load_dataset
124
+ from transformers import BlipProcessor, BlipForConditionalGeneration
125
+ from torch.utils.data import DataLoader
126
+
127
+ # Load dataset
128
+ dataset = load_dataset("KMH158/brats2020_shagufta")
129
+
130
+ # Initialize model
131
+ processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
132
+ model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")
133
+
134
+ # Create dataloader
135
+ def collate_fn(batch):
136
+ # Use T1ce modality (or any other)
137
+ images = [item['image_t1ce'] for item in batch]
138
+ texts = [item['report'] for item in batch]
139
+
140
+ return processor(images=images, text=texts, return_tensors="pt", padding=True)
141
+
142
+ train_loader = DataLoader(dataset['train'], batch_size=8, collate_fn=collate_fn)
143
+
144
+ # Training loop
145
+ for batch in train_loader:
146
+ outputs = model(**batch, labels=batch['input_ids'])
147
+ loss = outputs.loss
148
+ # ... training code
149
+ ```
150
+
151
+ ## Multi-Modal Usage
152
+
153
+ This dataset includes all 4 MRI modalities. You can:
154
+
155
+ 1. **Single modality:** Use T1ce (shows enhancement best)
156
+ 2. **Multi-modal:** Concatenate or ensemble all 4 modalities
157
+ 3. **Modality-specific:** Train separate models per modality
158
+
159
+ ```python
160
+ # Example: Multi-modal input
161
+ sample = dataset['train'][0]
162
+
163
+ # Stack all modalities
164
+ import numpy as np
165
+ multi_modal = np.stack([
166
+ np.array(sample['image_t1']),
167
+ np.array(sample['image_t1ce']),
168
+ np.array(sample['image_t2']),
169
+ np.array(sample['image_flair'])
170
+ ], axis=-1) # Shape: (224, 224, 12) - 4 modalities × 3 RGB channels
171
+ ```
172
+
173
+ ## Limitations
174
+
175
+ - Dataset size: 166 patients (relatively small for deep learning)
176
+ - Single institution/protocol
177
+ - Expert annotations needed for validation
178
+ - Bias towards GBM cases in BraTS dataset
179
+ - English reports only
180
+
181
+ ## Citation
182
+
183
+ If you use this dataset, please cite:
184
+
185
+ ```bibtex
186
+ @dataset{brats_radiology_reports_2024,
187
+ title={BraTS 2020 Radiology Report Generation Dataset},
188
+ author={Your Name},
189
+ year={2024},
190
+ publisher={HuggingFace},
191
+ howpublished={\url{https://huggingface.co/datasets/KMH158/brats2020_shagufta}}
192
+ }
193
+
194
+ @article{menze2015multimodal,
195
+ title={The multimodal brain tumor image segmentation benchmark (BRATS)},
196
+ author={Menze, Bjoern H and Jakab, Andras and Bauer, Stefan and others},
197
+ journal={IEEE transactions on medical imaging},
198
+ volume={34},
199
+ number={10},
200
+ pages={1993--2024},
201
+ year={2015},
202
+ publisher={IEEE}
203
+ }
204
+ ```
205
+
206
+ ## License
207
+
208
+ CC-BY-NC 4.0 (Non-commercial use only)
209
+
210
+ ## Acknowledgments
211
+
212
+ - BraTS Challenge organizers
213
+ - Original report annotators
214
+ - HuggingFace for dataset hosting