Add comprehensive dataset card with FL usage instructions
Browse files
README.md
CHANGED
|
@@ -1,44 +1,120 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 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 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- image-classification
|
| 5 |
+
tags:
|
| 6 |
+
- medmnist
|
| 7 |
+
- medical-imaging
|
| 8 |
+
- skin-cancer
|
| 9 |
+
- federated-learning
|
| 10 |
+
- healthcare
|
| 11 |
+
size_categories:
|
| 12 |
+
- 10K<n<100K
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# DermaMNIST Dataset for Federated Learning
|
| 16 |
+
|
| 17 |
+
## Dataset Description
|
| 18 |
+
|
| 19 |
+
**DermaMNIST** is a multi-class dataset of dermatoscopic images for skin lesion classification. It is part of the [MedMNIST v2](https://medmnist.com/) collection, a set of standardized biomedical image datasets for machine learning. This version of the dataset has been prepared for easy use in federated learning simulations, particularly with the [Flower](https://flower.dev/) framework.
|
| 20 |
+
|
| 21 |
+
The dataset is based on the [HAM10000](https://doi.org/10.1038/sdata.2018.161) dataset, a large collection of multi-source dermatoscopic images of common pigmented skin lesions. The images are 28x28 pixels and resized from their original 600x450 resolution.
|
| 22 |
+
|
| 23 |
+
### Classes
|
| 24 |
+
The dataset contains 7 classes of skin lesions:
|
| 25 |
+
- **0**: `actinic keratoses and intraepithelial carcinoma`
|
| 26 |
+
- **1**: `basal cell carcinoma`
|
| 27 |
+
- **2**: `benign keratosis-like lesions`
|
| 28 |
+
- **3**: `dermatofibroma`
|
| 29 |
+
- **4**: `melanoma`
|
| 30 |
+
- **5**: `melanocytic nevi`
|
| 31 |
+
- **6**: `vascular lesions`
|
| 32 |
+
|
| 33 |
+
### Dataset Statistics
|
| 34 |
+
- **Number of classes**: 7
|
| 35 |
+
- **Training samples**: 7,007
|
| 36 |
+
- **Test samples**: 2,005
|
| 37 |
+
- **Total samples**: 9,012
|
| 38 |
+
|
| 39 |
+
## Dataset Structure
|
| 40 |
+
|
| 41 |
+
### Data Fields
|
| 42 |
+
- `image`: A PIL Image object of size 28x28.
|
| 43 |
+
- `label`: The integer class ID.
|
| 44 |
+
- `label_name`: The string name of the class label.
|
| 45 |
+
|
| 46 |
+
### Data Splits
|
| 47 |
+
- **Train**: 7,007 samples
|
| 48 |
+
- **Test**: 2,005 samples
|
| 49 |
+
|
| 50 |
+
## Usage with Flower Datasets 🌸
|
| 51 |
+
|
| 52 |
+
This dataset is ideal for federated learning simulations where data is distributed across multiple clients (e.g., hospitals). Here's how to use it with [Flower Datasets](https://flower.dev/docs/datasets/):
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from flwr_datasets import FederatedDataset
|
| 56 |
+
|
| 57 |
+
# Define the number of clients (e.g., simulating 10 hospitals)
|
| 58 |
+
NUM_CLIENTS = 10
|
| 59 |
+
|
| 60 |
+
# Load the dataset and partition it into 10 clients
|
| 61 |
+
fds = FederatedDataset(dataset="your-username/dermamnist-fl", partitioners={"train": NUM_CLIENTS})
|
| 62 |
+
|
| 63 |
+
# Get the data for a specific client
|
| 64 |
+
client_data = fds.load_partition(0, "train")
|
| 65 |
+
|
| 66 |
+
# You can now use this client_data with your standard PyTorch or TensorFlow data loaders.
|
| 67 |
+
# For example, to set the format for PyTorch:
|
| 68 |
+
# client_data.set_format(type="torch", columns=["image", "label"])
|
| 69 |
+
```
|
| 70 |
+
## Citation
|
| 71 |
+
If you use this dataset in your research, please cite the following paper:
|
| 72 |
+
|
| 73 |
+
```
|
| 74 |
+
@article{medmnistv2,
|
| 75 |
+
title={MedMNIST v2: A Large-Scale Lightweight Benchmark for 2D and 3D Biomedical Image Classification},
|
| 76 |
+
author={Jiancheng Yang and Rui Shi and Donglai Wei and Zequan Liu and Lin Zhao and Bilian Ke and Hanspeter Pfister and Bingbing Ni},
|
| 77 |
+
journal={Scientific Data},
|
| 78 |
+
year={2023},
|
| 79 |
+
volume={10},
|
| 80 |
+
number={1},
|
| 81 |
+
pages={41},
|
| 82 |
+
doi={10.1038/s41597-022-01721-8}
|
| 83 |
+
}
|
| 84 |
+
```
|
| 85 |
+
## Citation
|
| 86 |
+
```bibtex
|
| 87 |
+
@article{medmnistv2,
|
| 88 |
+
title={MedMNIST v2: A Large-Scale Lightweight Benchmark for 2D and 3D Biomedical Image Classification},
|
| 89 |
+
author={Jiancheng Yang and Rui Shi and Donglai Wei and Zequan Liu and Lin Zhao and Bilian Ke and Hanspeter Pfister and Bingbing Ni},
|
| 90 |
+
journal={Scientific Data},
|
| 91 |
+
year={2023},
|
| 92 |
+
volume={10},
|
| 93 |
+
number={1},
|
| 94 |
+
pages={41},
|
| 95 |
+
doi={10.1038/s41597-022-01721-8}
|
| 96 |
+
}
|
| 97 |
+
```
|
| 98 |
+
## Example Usage with datasets
|
| 99 |
+
```python
|
| 100 |
+
from datasets import load_dataset
|
| 101 |
+
from PIL import Image
|
| 102 |
+
|
| 103 |
+
# Load the dataset
|
| 104 |
+
dataset = load_dataset("your-username/dermamnist-fl")
|
| 105 |
+
|
| 106 |
+
# Access the training split
|
| 107 |
+
train_data = dataset["train"]
|
| 108 |
+
print(f"Number of training samples: {len(train_data)}")
|
| 109 |
+
|
| 110 |
+
# Access a sample
|
| 111 |
+
sample = train_data[100]
|
| 112 |
+
image: Image = sample['image']
|
| 113 |
+
print(f"Image size: {image.size}")
|
| 114 |
+
print(f"Label: {sample['label']}")
|
| 115 |
+
print(f"Label name: {sample['label_name']}")
|
| 116 |
+
|
| 117 |
+
# To display the image
|
| 118 |
+
# image.show()
|
| 119 |
+
```
|
| 120 |
+
|