seongun commited on
Commit
f3a2bf4
·
verified ·
1 Parent(s): 7ab9457

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +148 -150
README.md CHANGED
@@ -1,150 +1,148 @@
1
- ---
2
- license: cc-by-nc-sa-4.0
3
- tags:
4
- - medical imaging
5
- - liver tumor
6
- - ct scan
7
- - classification
8
- pretty_name: Liver Tumor Classification (from LiTS)
9
- ---
10
-
11
- # Dataset Card for Liver Tumor Classification (from LiTS)
12
-
13
- ## Dataset Description
14
-
15
- * **Paper (Original LiTS):** The Liver Tumor Segmentation Benchmark (LiTS) (https://doi.org/10.1016/j.media.2022.102680).
16
- * **Contact:** Seongun Kim, seongun@kaist.ac.kr
17
-
18
- **Dataset Summary**
19
-
20
- **Dataset Summary**
21
-
22
- This dataset contains processed instances derived from the Liver Tumor Segmentation Challenge (LiTS) dataset, adapted for a binary **liver tumor classification** task. The original 3D CT scans and segmentation masks have been processed into individual 2D slices.
23
-
24
- Each data instance includes:
25
- * `sample`: The **original CT slice** obtained directly from the 3D scan.
26
- * `w_sample`: The **windowed CT slice**, processed from `sample` to enhance contrast for features relevant to liver tumors. This is the actual input typically used for neural network training/inference.
27
- * `label`: A binary label (Normal / Tumor present) assigned based on the segmentation mask.
28
- * `mask`: The original segmentation mask corresponding to the slice.
29
-
30
- Image data (`sample`, `w_sample`, `mask`) is stored as individual `.png` files, and the corresponding classification label (`label`) along with image paths are stored in a central `metadata.jsonl` file.
31
-
32
- **Example Instance (ID: 960)**
33
-
34
- Below is a visual example of the data provided for a single instance:
35
-
36
- | Original Slice (`sample`) | Windowed Slice (`w_sample`) | Segmentation Mask (`mask`) |
37
- | :-----------------------------------------: | :-------------------------------------------: | :------------------------------------------: |
38
- | ![sample](images/sample/960.png) | ![w_sample](images/w_sample/960.png) | ![mask](images/mask/960.png) |
39
- | `images/sample/960.png` | `images/w_sample/960.png` | `images/mask/960.png` |
40
-
41
- *(Note: Mask values in the PNG are scaled for visualization: 0=Background, 127=Liver, 255=Tumor)*
42
-
43
-
44
- ---
45
-
46
- ## Dataset Structure
47
-
48
- **Data Organization**
49
-
50
- The dataset follows a structure optimized for use with the Hugging Face `datasets` library using image files and a metadata file:
51
-
52
- * **`metadata.jsonl`**: A JSON Lines file where each line is a JSON object representing one data instance. Each object contains paths to the image files and the classification label.
53
- * **`images/`**: A directory containing subdirectories for each image type.
54
- * `images/sample/`: Contains the original CT slice images (e.g., `0.png`, `1.png`, ...).
55
- * `images/w_sample/`: Contains the windowed CT slice images.
56
- * `images/mask/`: Contains the segmentation mask images. **Note:** Mask images store pixel values scaled for visualization (0 for Background, 127 for Liver, 255 for Tumor).
57
-
58
- **Example `metadata.jsonl` entry:**
59
-
60
- ```json
61
- {"sample_path": "images/sample/0.png", "w_sample_path": "images/w_sample/0.png", "mask_path": "images/mask/0.png", "label": 0}
62
- ```
63
-
64
- **Loading with `datasets` library:**
65
-
66
- ```python
67
- from datasets import load_dataset, Features, Image, Value
68
- import os
69
-
70
- # Define features to help the library interpret the data
71
- features = Features({
72
- 'sample_path': Image(decode=True), # Load as PIL Image
73
- 'w_sample_path': Image(decode=True), # Load as PIL Image
74
- 'mask_path': Image(decode=False), # Load mask path as string or raw PIL without decoding colors
75
- 'label': Value(dtype='int64') # Label is integer
76
- })
77
-
78
- # Load from Hugging Face Hub
79
- dataset_dict = load_dataset("seongun/liver-tumor-classification", features=features)
80
-
81
- # Or load from a local directory containing metadata.jsonl and images/
82
- local_data_path = './data/LiverTumor' # Adjust path as needed
83
- dataset_dict = load_dataset('json', data_files={'train': os.path.join(local_data_path, 'metadata.jsonl')}, features=features)
84
-
85
- dataset = dataset_dict['train']
86
- print(dataset[0])
87
- # Example Output (values depend on feature definition):
88
- # {'sample_path': <PIL.PngImagePlugin.PngImageFile image mode=L size=512x512>,
89
- # 'w_sample_path': <PIL.PngImagePlugin.PngImageFile image mode=L size=512x512>,
90
- # 'mask_path': <PIL.PngImagePlugin.PngImageFile image mode=L size=512x512>,
91
- # 'label': 0}
92
- ```
93
-
94
- **Data Fields**
95
-
96
- | Field Name | Description | Data Type (Loaded) | Original Meaning / Notes |
97
- | :-------------- | :------------------------------------------------------------- | :----------------- | :----------------------------------------------------------- |
98
- | `sample_path` | Path to the original CT slice image | `PIL.Image` | Grayscale image (originally `float64` [0,1], saved as `uint8` [0,255]) |
99
- | `w_sample_path` | Path to the windowed CT slice image | `PIL.Image` | Grayscale image (originally `float64` [0,1], saved as `uint8` [0,255]) |
100
- | `mask_path` | Path to the segmentation mask image | `PIL.Image` or `str`| Grayscale image. **Saved values**: 0, 127, 255. **Original labels**: 0, 1, 2. |
101
- | `label` | Binary classification label for the slice | `int64` | `0`: Normal, `1`: Tumor |
102
-
103
- *Note on Masks*: The mask PNG files store scaled values (0, 127, 255) for easier visualization. When loading these masks for training or evaluation, the pixel values need to be mapped back to the original class labels (0, 1, 2). The provided PyTorch `LiverTumorDataset` class handles this conversion.
104
-
105
- ---
106
-
107
- ## Additional Information
108
-
109
- **Dataset Curators**
110
-
111
- Seongun Kim (KAIST)
112
-
113
- **Licensing Information**
114
-
115
- The original LiTS dataset is licensed under **CC-BY-NC-SA-4.0**. As this dataset is a derivative work, it is released under the same **CC-BY-NC-SA-4.0** license. You must give appropriate credit to the original LiTS creators (see Citation section), provide a link to the license, and indicate if changes were made. If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. This dataset is intended for non-commercial research purposes.
116
-
117
- License Deed: [https://creativecommons.org/licenses/by-nc-sa/4.0/](https://creativecommons.org/licenses/by-nc-sa/4.0/)
118
-
119
- **Citation Information**
120
-
121
- If you use this dataset in your research, please consider citing the original LiTS publication and this dataset repository:
122
-
123
- *Original LiTS Publication:*
124
-
125
- ```bibtex
126
- @article{bilic2023liver,
127
- title={The liver tumor segmentation benchmark (lits)},
128
- author={Bilic, Patrick and Christ, Patrick and Li, Hongwei Bran and Vorontsov, Eugene and Ben-Cohen, Avi and Kaissis, Georgios and Szeskin, Adi and Jacobs, Colin and Mamani, Gabriel Efrain Humpire and Chartrand, Gabriel and others},
129
- journal={Medical image analysis},
130
- volume={84},
131
- pages={102680},
132
- year={2023},
133
- publisher={Elsevier}
134
- }
135
- ```
136
-
137
- *This Dataset Repository:*
138
-
139
- ```bibtex
140
- @misc{seongun_liver_2025,
141
- author={Kim, Seongun},
142
- title={Liver Tumor Classification derived from LiTS},
143
- year={2025},
144
- publisher={Hugging Face},
145
- journal={Hugging Face Hub},
146
- howpublished = {\url{https://huggingface.co/datasets/seongun/liver-tumor-classification}}
147
- }
148
- ```
149
-
150
-
 
1
+ ---
2
+ license: cc-by-nc-sa-4.0
3
+ tags:
4
+ - medical imaging
5
+ - liver tumor
6
+ - ct scan
7
+ - classification
8
+ pretty_name: Liver Tumor Classification (from LiTS)
9
+ ---
10
+
11
+ # Dataset Card for Liver Tumor Classification (from LiTS)
12
+
13
+ ## Dataset Description
14
+
15
+ * **Paper (Original LiTS):** The Liver Tumor Segmentation Benchmark (LiTS) (https://doi.org/10.1016/j.media.2022.102680).
16
+ * **Contact:** Seongun Kim, seongun@kaist.ac.kr
17
+
18
+ **Dataset Summary**
19
+
20
+ This dataset contains processed instances derived from the Liver Tumor Segmentation Challenge (LiTS) dataset, adapted for a binary **liver tumor classification** task. The original 3D CT scans and segmentation masks have been processed into individual 2D slices.
21
+
22
+ Each data instance includes:
23
+ * `sample`: The **original CT slice** obtained directly from the 3D scan.
24
+ * `w_sample`: The **windowed CT slice**, processed from `sample` to enhance contrast for features relevant to liver tumors. This is the actual input typically used for neural network training/inference.
25
+ * `label`: A binary label (Normal / Tumor present) assigned based on the segmentation mask.
26
+ * `mask`: The original segmentation mask corresponding to the slice.
27
+
28
+ Image data (`sample`, `w_sample`, `mask`) is stored as individual `.png` files, and the corresponding classification label (`label`) along with image paths are stored in a central `metadata.jsonl` file.
29
+
30
+ **Example Instance (ID: 960)**
31
+
32
+ Below is a visual example of the data provided for a single instance:
33
+
34
+ | Original Slice (`sample`) | Windowed Slice (`w_sample`) | Segmentation Mask (`mask`) |
35
+ | :-----------------------------------------: | :-------------------------------------------: | :------------------------------------------: |
36
+ | ![sample](images/sample/960.png) | ![w_sample](images/w_sample/960.png) | ![mask](images/mask/960.png) |
37
+ | `images/sample/960.png` | `images/w_sample/960.png` | `images/mask/960.png` |
38
+
39
+ *(Note: Mask values in the PNG are scaled for visualization: 0=Background, 127=Liver, 255=Tumor)*
40
+
41
+
42
+ ---
43
+
44
+ ## Dataset Structure
45
+
46
+ **Data Organization**
47
+
48
+ The dataset follows a structure optimized for use with the Hugging Face `datasets` library using image files and a metadata file:
49
+
50
+ * **`metadata.jsonl`**: A JSON Lines file where each line is a JSON object representing one data instance. Each object contains paths to the image files and the classification label.
51
+ * **`images/`**: A directory containing subdirectories for each image type.
52
+ * `images/sample/`: Contains the original CT slice images (e.g., `0.png`, `1.png`, ...).
53
+ * `images/w_sample/`: Contains the windowed CT slice images.
54
+ * `images/mask/`: Contains the segmentation mask images. **Note:** Mask images store pixel values scaled for visualization (0 for Background, 127 for Liver, 255 for Tumor).
55
+
56
+ **Example `metadata.jsonl` entry:**
57
+
58
+ ```json
59
+ {"sample_path": "images/sample/0.png", "w_sample_path": "images/w_sample/0.png", "mask_path": "images/mask/0.png", "label": 0}
60
+ ```
61
+
62
+ **Loading with `datasets` library:**
63
+
64
+ ```python
65
+ from datasets import load_dataset, Features, Image, Value
66
+ import os
67
+
68
+ # Define features to help the library interpret the data
69
+ features = Features({
70
+ 'sample_path': Image(decode=True), # Load as PIL Image
71
+ 'w_sample_path': Image(decode=True), # Load as PIL Image
72
+ 'mask_path': Image(decode=False), # Load mask path as string or raw PIL without decoding colors
73
+ 'label': Value(dtype='int64') # Label is integer
74
+ })
75
+
76
+ # Load from Hugging Face Hub
77
+ dataset_dict = load_dataset("seongun/liver-tumor-classification", features=features)
78
+
79
+ # Or load from a local directory containing metadata.jsonl and images/
80
+ local_data_path = './data/LiverTumor' # Adjust path as needed
81
+ dataset_dict = load_dataset('json', data_files={'train': os.path.join(local_data_path, 'metadata.jsonl')}, features=features)
82
+
83
+ dataset = dataset_dict['train']
84
+ print(dataset[0])
85
+ # Example Output (values depend on feature definition):
86
+ # {'sample_path': <PIL.PngImagePlugin.PngImageFile image mode=L size=512x512>,
87
+ # 'w_sample_path': <PIL.PngImagePlugin.PngImageFile image mode=L size=512x512>,
88
+ # 'mask_path': <PIL.PngImagePlugin.PngImageFile image mode=L size=512x512>,
89
+ # 'label': 0}
90
+ ```
91
+
92
+ **Data Fields**
93
+
94
+ | Field Name | Description | Data Type (Loaded) | Original Meaning / Notes |
95
+ | :-------------- | :------------------------------------------------------------- | :----------------- | :----------------------------------------------------------- |
96
+ | `sample_path` | Path to the original CT slice image | `PIL.Image` | Grayscale image (originally `float64` [0,1], saved as `uint8` [0,255]) |
97
+ | `w_sample_path` | Path to the windowed CT slice image | `PIL.Image` | Grayscale image (originally `float64` [0,1], saved as `uint8` [0,255]) |
98
+ | `mask_path` | Path to the segmentation mask image | `PIL.Image` or `str`| Grayscale image. **Saved values**: 0, 127, 255. **Original labels**: 0, 1, 2. |
99
+ | `label` | Binary classification label for the slice | `int64` | `0`: Normal, `1`: Tumor |
100
+
101
+ *Note on Masks*: The mask PNG files store scaled values (0, 127, 255) for easier visualization. When loading these masks for training or evaluation, the pixel values need to be mapped back to the original class labels (0, 1, 2). The provided PyTorch `LiverTumorDataset` class handles this conversion.
102
+
103
+ ---
104
+
105
+ ## Additional Information
106
+
107
+ **Dataset Curators**
108
+
109
+ Seongun Kim (KAIST)
110
+
111
+ **Licensing Information**
112
+
113
+ The original LiTS dataset is licensed under **CC-BY-NC-SA-4.0**. As this dataset is a derivative work, it is released under the same **CC-BY-NC-SA-4.0** license. You must give appropriate credit to the original LiTS creators (see Citation section), provide a link to the license, and indicate if changes were made. If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. This dataset is intended for non-commercial research purposes.
114
+
115
+ License Deed: [https://creativecommons.org/licenses/by-nc-sa/4.0/](https://creativecommons.org/licenses/by-nc-sa/4.0/)
116
+
117
+ **Citation Information**
118
+
119
+ If you use this dataset in your research, please consider citing the original LiTS publication and this dataset repository:
120
+
121
+ *Original LiTS Publication:*
122
+
123
+ ```bibtex
124
+ @article{bilic2023liver,
125
+ title={The liver tumor segmentation benchmark (lits)},
126
+ author={Bilic, Patrick and Christ, Patrick and Li, Hongwei Bran and Vorontsov, Eugene and Ben-Cohen, Avi and Kaissis, Georgios and Szeskin, Adi and Jacobs, Colin and Mamani, Gabriel Efrain Humpire and Chartrand, Gabriel and others},
127
+ journal={Medical image analysis},
128
+ volume={84},
129
+ pages={102680},
130
+ year={2023},
131
+ publisher={Elsevier}
132
+ }
133
+ ```
134
+
135
+ *This Dataset Repository:*
136
+
137
+ ```bibtex
138
+ @misc{seongun_liver_2025,
139
+ author={Kim, Seongun},
140
+ title={Liver Tumor Classification derived from LiTS},
141
+ year={2025},
142
+ publisher={Hugging Face},
143
+ journal={Hugging Face Hub},
144
+ howpublished = {\url{https://huggingface.co/datasets/seongun/liver-tumor-classification}}
145
+ }
146
+ ```
147
+
148
+