
Datasets:
SPIDER-SKIN Dataset
SPIDER is a collection of supervised pathological datasets covering multiple organs, each with comprehensive class coverage. These datasets are professionally annotated by pathologists.
For a detailed description of SPIDER, methodology, and benchmark results, refer to our research paper:
SPIDER: A Comprehensive Multi-Organ Supervised Pathology Dataset and Baseline Models
View on arXiv
This repository contains the SPIDER-skin dataset. To explore datasets for other organs, visit the Hugging Face HistAI page or GitHub. SPIDER is regularly updated with new organs and data, so follow us on Hugging Face to stay updated.
Overview
SPIDER-skin is a supervised dataset of image-class pairs for the skin organ. Each data point consists of:
- A central 224×224 patch with a class label
- 24 surrounding context patches of the same size, forming a composite 1120×1120 region
- Patches are extracted at 20X magnification
We provide a train-test split for consistent benchmarking. The split is done at the slide level, ensuring that patches from the same whole slide image (WSI) do not appear in both training and test sets. Users can also merge and re-split the data as needed.
How to Use
Downloading the Dataset
Option 1: Using huggingface_hub
from huggingface_hub import snapshot_download
snapshot_download(repo_id="histai/SPIDER-skin", repo_type="dataset", local_dir="/local_path")
Option 2: Using git
# Ensure you have Git LFS installed (https://git-lfs.com)
git lfs install
git clone https://huggingface.co/datasets/histai/SPIDER-skin
Extracting the Dataset
The dataset is provided in multiple tar archives. Unpack them using:
cat spider-skin.tar.* | tar -xvf -
Using the Dataset
Once extracted, you will find:
- An
images/
folder - A
metadata.json
file
You can process and use the dataset in two ways:
1. Directly in Code (Recommended for PyTorch Training)
Use the dataset class provided in scripts/spider_dataset.py
. This class takes:
- Path to the dataset (folder containing
metadata.json
andimages/
folder) - Context size:
5
,3
, or1
5
: Full 1120×1120 patches (default)3
: 672×672 patches1
: Only central patches
The dataset class dynamically returns stitched images, making it suitable for direct use in PyTorch training pipelines.
2. Convert to ImageNet Format
To structure the dataset for easy use with standard tools, convert it using scripts/convert_to_imagenet.py
.
The script also supports different context sizes.
This will generate:
<output_dir>/<split>/<class>/<slide>/<image>
You can then use it with:
from datasets import load_dataset
dataset = load_dataset("imagefolder", data_dir="/path/to/folder")
or
torchvision.datasets.ImageFolder
class
Dataset Composition
The SPIDER-skin dataset consists of the following classes:
Class | Central Patches |
---|---|
Actinic keratosis | 4936 |
Apocrine glands | 6739 |
Basal cell carcinoma | 6446 |
Carcinoma in situ | 5478 |
Collagen | 6262 |
Epidermis | 7449 |
Fat | 6525 |
Follicle | 8343 |
Inflammation | 5856 |
Invasive melanoma | 9101 |
Kaposi’s sarcoma | 4778 |
Keratin | 6418 |
Melanoma in situ | 4545 |
Mercel cell carcinoma | 5968 |
Muscle | 6051 |
Necrosis | 6842 |
Nerves | 4735 |
Nevus | 8937 |
Sebaceous gland | 6639 |
Seborrheic keratosis | 10311 |
Solar elastosis | 7613 |
Squamous cell carcinoma | 6051 |
Vessels | 7673 |
Wart | 6158 |
Total Counts:
- 159,854 central patches
- 2,696,987 total patches (including context patches)
- 3,784 total slides used for annotation
License
The dataset is licensed under CC BY-NC 4.0 and is for research use only.
Citation
If you use this dataset in your work, please cite:
@misc{nechaev2025spidercomprehensivemultiorgansupervised,
title={SPIDER: A Comprehensive Multi-Organ Supervised Pathology Dataset and Baseline Models},
author={Dmitry Nechaev and Alexey Pchelnikov and Ekaterina Ivanova},
year={2025},
eprint={2503.02876},
archivePrefix={arXiv},
primaryClass={eess.IV},
url={https://arxiv.org/abs/2503.02876},
}
Contacts
- Authors: Dmitry Nechaev, Alexey Pchelnikov, Ekaterina Ivanova
- Email: dmitry@hist.ai, alex@hist.ai, kate@hist.ai
- Downloads last month
- 17
Models trained or fine-tuned on histai/SPIDER-skin
