---
title: SPIDER-breast
canonical_url: "https://www.modelscope.cn/datasets/histai/SPIDER-breast"
md_url: "https://www.modelscope.cn/datasets/histai/SPIDER-breast.md"
repository: histai/SPIDER-breast
last_updated: 2025-05-15
license: "Apache License 2.0"
storage_size: "80 GB"
downloads: 1144
stars: 0
---

# SPIDER-breast

> SPIDER-breast - histai 在 ModelScope 开源的数据集。SPIDER-BREAST Dataset

histai/SPIDER-breast 是 ModelScope 魔搭社区上的数据集，存储大小 80 GB，采用 Apache License 2.0 许可。

- **Repository**: histai/SPIDER-breast
- **License**: Apache License 2.0
- **Storage size**: 80 GB
- **Downloads**: 1144
- **Stars**: 0
- **Last updated**: 2025-05-15

Source: https://www.modelscope.cn/datasets/histai/SPIDER-breast

---

# SPIDER-BREAST Dataset

SPIDER is a collection of supervised pathological datasets covering multiple organs, each with comprehensive class coverage. These datasets are professionally annotated by pathologists.

If you would like to support, sponsor, or obtain a commercial license for the SPIDER data and models, please contact us at models@hist.ai.

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](https://arxiv.org/abs/2503.02876)

This repository contains the **SPIDER-breast** dataset. To explore datasets for other organs, visit the [Hugging Face HistAI page](https://huggingface.co/histai) or [GitHub](https://github.com/HistAI/SPIDER). SPIDER is regularly updated with new organs and data, so follow us on Hugging Face to stay updated.

---

### Overview
SPIDER-breast is a supervised dataset of image-class pairs for the breast 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`
```python
from huggingface_hub import snapshot_download

snapshot_download(repo_id="histai/SPIDER-breast", repo_type="dataset", local_dir="/local_path")
```

#### Option 2: Using `git`
```bash
# Ensure you have Git LFS installed (https://git-lfs.com)
git lfs install
git clone https://huggingface.co/datasets/histai/SPIDER-breast
```

### Extracting the Dataset
The dataset is provided in multiple tar archives. Unpack them using:
```bash
cat spider-breast.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` and `images/` folder)
- Context size: `5`, `3`, or `1`
  - `5`: Full **1120×1120** patches (default)
  - `3`: **672×672** patches
  - `1`: 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:
```python
from datasets import load_dataset

dataset = load_dataset("imagefolder", data_dir="/path/to/folder")
```
or

`torchvision.datasets.ImageFolder` class

---

### Dataset Composition
The SPIDER-breast dataset consists of the following classes:

| Class                                 | Total Patches |
|--------------------------------------|---------------|
| Adenosis                              | 2899          |
| Benign phyllodes tumor               | 4526          |
| Ductal carcinoma in situ (high-grade)| 5632          |
| Ductal carcinoma in situ (low-grade) | 5017          |
| Fat                                  | 6286          |
| Fibroadenoma                         | 5243          |
| Fibrocystic changes                  | 5027          |
| Fibrosis                             | 6260          |
| Invasive non-special type carcinoma  | 6142          |
| Lipogranuloma                        | 4941          |
| Lobular invasive carcinoma           | 5102          |
| Malignant phyllodes tumor           | 5271          |
| Necrosis                             | 5396          |
| Normal ducts                         | 4891          |
| Normal lobules                       | 5821          |
| Sclerosing adenosis                  | 3423          |
| Typical ductal hyperplasia           | 5546          |
| Vessels                              | 5469          |

**Total Counts:**
- **92,892** central patches
- **984,924** total patches (including context patches)
- **921** 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:
```bibtex
@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
