Update README.md
Browse files
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 |
-
**
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
* `
|
| 26 |
-
* `
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
| 37 |
-
|
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
*
|
| 53 |
-
*
|
| 54 |
-
* `images/
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
```
|
| 61 |
-
|
| 62 |
-
``
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
#
|
| 71 |
-
|
| 72 |
-
'
|
| 73 |
-
'
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
#
|
| 88 |
-
#
|
| 89 |
-
# '
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
| 97 |
-
|
|
| 98 |
-
| `
|
| 99 |
-
| `
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
**
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 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 |
+
|  |  |  |
|
| 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 |
+
|
|
|
|
|
|