Datasets:
id stringlengths 11 11 | image unknown | inst unknown | type unknown | fold int8 1 1 | tissue stringclasses 19
values |
|---|---|---|---|---|---|
fold1_00000 | [
137,
80,
78,
71,
13,
10,
26,
10,
0,
0,
0,
13,
73,
72,
68,
82,
0,
0,
1,
0,
0,
0,
1,
0,
8,
2,
0,
0,
0,
211,
16,
63,
49,
0,
1,
0,
0,
73,
68,
65,
84,
120,
156,
236,
253,
217,
146,
92,
89,
150,
36,
138,
237,
249,
... | [
137,
80,
78,
71,
13,
10,
26,
10,
0,
0,
0,
13,
73,
72,
68,
82,
0,
0,
1,
0,
0,
0,
1,
0,
16,
0,
0,
0,
0,
41,
137,
43,
249,
0,
0,
5,
36,
73,
68,
65,
84,
120,
156,
237,
221,
235,
82,
227,
56,
16,
6,
80,
199,
155,
... | [
137,
80,
78,
71,
13,
10,
26,
10,
0,
0,
0,
13,
73,
72,
68,
82,
0,
0,
1,
0,
0,
0,
1,
0,
8,
0,
0,
0,
0,
121,
25,
247,
186,
0,
0,
3,
232,
73,
68,
65,
84,
120,
156,
237,
221,
235,
114,
155,
48,
20,
4,
224,
61,
11,
... | 1 | Breast |
fold1_00001 | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nOz92ZIkabalh+msambuHpGZVXVOowkILigUXPBZ+TK(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAEAAAAAApiSv5AAAFuklEQVR4nO3d63IbNxCE0VlKtMW8/7PGkChqXQmtMkviZS9YoGf(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAEeUlEQVR4nO2d4ZLbIAyEV3t+/zdu1Ol12snlLokNEjZovx9tUyM(...TRUNCATED) | 1 | Breast |
fold1_00002 | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nOz9SZMkWZaliTHzezyIiKq5e2RmZVGjewki9P/f4Wd(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAEAAAAAApiSv5AAAG7ElEQVR4nO2di1LbMBBFN45Defz/pzalJECHKdA0iRPJkWTt3nM(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAFf0lEQVR4nO2d67KjIBCEe5q8/xtbs7XZOntyUSNGYKD5fiVGwW6(...TRUNCATED) | 1 | Breast |
fold1_00003 | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nOz9aZIkWXati2mvambuEZEF4N4HoQgHzKlwHpzH+0G(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAEAAAAAApiSv5AAAHaklEQVR4nO2dbXfSQBCFF9IC9f//Vim0azx4rGKOkGwys/Ny7/O(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAFzklEQVR4nO2d3bbrKgiFJ3P4/q/MGWOfdbF+kqoRFSTfXVsDMoO(...TRUNCATED) | 1 | Breast |
fold1_00004 | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nGz9jZIjSZKsi8V/BIDMrOqe2d3D+7B8Fb4FH4aUK+S(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAEAAAAAApiSv5AAAEXElEQVR4nO3d4XLSUBAG0ASwvv/jioY6dayOtNgS7k12957zx7F(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAADiklEQVR4nO3c22KbMBBF0TMD///HtvrQtE1cXwSMBNLs9ZRgRUj(...TRUNCATED) | 1 | Breast |
fold1_00005 | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nGz96ZYbWZKlC+oZdAJgRtIjMnt19/s/Sj9F/+mqysj(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAEAAAAAApiSv5AAAFFUlEQVR4nO3d0W7bRhBAUdKxnP//3FpxEhiNAEWWIoqcpXZ2znl(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAEB0lEQVR4nO2c0ZLrKAxEW635/z9WvLV192H2ThLbGRuEWudlxkA(...TRUNCATED) | 1 | Breast |
fold1_00006 | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nFz9CZobWZKsidpwbALgTjIiM+tW9357I28hbzfvq3t(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAEAAAAAApiSv5AAAGAklEQVR4nO2d61bbSBAGW16xdt7/YW1vjLyHBYLxAtZlLt39VeU(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAEoklEQVR4nO2d63KjOhCEe1q8/xsLbdU52dpdx7GR0WVu35/YMEj(...TRUNCATED) | 1 | Breast |
fold1_00007 | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nHT9+3YcSdLsi+X9UgWQ7J45Z2vpRfVK+kdvpaVz9v7(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAEAAAAAApiSv5AAAGgklEQVR4nO2d7XbaOBRFhW1g0vd/1jKJHTwraTKhgL+vLF2dvX+(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAFE0lEQVR4nO2d6ZakKhCEI6N8/zeuk/ecnuVOd7kAgqZEfj9mupU(...TRUNCATED) | 1 | Breast |
fold1_00008 | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nOz96ZIkSZaliQlvsqiaeURk1qAbDfwAaEAE/MFL4ln(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAEAAAAAApiSv5AAAGw0lEQVR4nO2d7XbiOBAFG8LgmLz/ow4Ykmz2ZJfNMhw+bMuSWn2(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAFEElEQVR4nO2d23ajMAxFj4/y/3+sZtaaTqdpCgEbx5It7ZcQGrC(...TRUNCATED) | 1 | Breast |
fold1_00009 | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nOz9aZMcaZaliem+mJkDiIisqu4ZYZPC//8/+IEi/AG(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAEAAAAAApiSv5AAAGQUlEQVR4nO2d23baSBBFWyIaxSH5/w/1wFjBSmZl2azYXCR0aXV(...TRUNCATED) | "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAFDklEQVR4nO2d65qrKBBFN7v6/d+Y4XyTuXQn7V2Bgl3rTyfRKLU(...TRUNCATED) | 1 | Breast |
PanNuke
Overview
PanNuke contains 7,901 H&E-stained tissue images from 19 tissue categories, with masks marking individual nuclei and five cell types. Each image is 256 × 256 pixels. You can use it to train models to find nuclei and identify their types across different tissues.
License: CC BY-NC-SA 4.0. Use is noncommercial: credit the creators, describe changes, and share adapted data under the same license.
Files and splits
The files keep the original three folds. Use these when comparing with published PanNuke results.
| Split | File | Images |
|---|---|---|
fold1 |
fold_1.parquet |
2,656 |
fold2 |
fold_2.parquet |
2,523 |
fold3 |
fold_3.parquet |
2,722 |
The authors give these training, validation and test arrangements:
| Arrangement | Training | Validation | Testing |
|---|---|---|---|
| 1 | Fold 1 | Fold 2 | Fold 3 |
| 2 | Fold 2 | Fold 1 | Fold 3 |
| 3 | Fold 3 | Fold 2 | Fold 1 |
Fields
Each row contains one image and its masks, stored as PNG bytes. Images are 256 × 256 pixels with three colour channels; masks are 256 × 256 arrays.
| Field | Contents |
|---|---|
id |
Image name, such as fold1_00000 |
image |
RGB colour image; uint8 values from 0 to 255 |
inst |
Numbered nucleus mask; each nucleus has its own number, stored as uint16 |
type |
Cell-type mask using the numbers below, stored as uint8 |
fold |
Original fold number: 1, 2 or 3 |
tissue |
Tissue category for the whole image |
Zero means background in both masks. Nucleus numbers start at 1 in each image and do not identify the same object across images.
Labels
The type mask uses these class numbers:
| Value | Class |
|---|---|
| 0 | background |
| 1 | neoplastic |
| 2 | inflammatory |
| 3 | connective |
| 4 | dead |
| 5 | epithelial |
Download and read a sample
from io import BytesIO
import numpy as np
import polars as pl
from huggingface_hub import hf_hub_download
from PIL import Image
def read_png(data: bytes) -> np.ndarray:
"""Decode RGB pixels or integer labels without reducing mask bit depth."""
with Image.open(BytesIO(data)) as image:
return np.array(image)
path = hf_hub_download(
repo_id="csmp-hub/pannuke",
repo_type="dataset",
filename="fold_1.parquet",
)
row = pl.read_parquet(path, n_rows=1).row(0, named=True)
image = read_png(row["image"])
instances = read_png(row["inst"])
cell_types = read_png(row["type"])
Use the filenames above to load a different split.
Plot examples
Continue from the loading example.
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from skimage.segmentation import find_boundaries
sample_ids = ["fold1_00017", "fold1_00738", "fold1_02422"]
samples = pl.scan_parquet(path).filter(pl.col("id").is_in(sample_ids)).collect()
nucleus_names = ["Neoplastic", "Inflammatory", "Connective", "Dead", "Epithelial"]
nucleus_colors = (
np.array(
[
[0, 0, 0],
[230, 75, 53],
[54, 140, 204],
[0, 160, 135],
[243, 155, 60],
[144, 102, 190],
]
)
/ 255
)
fig, axes = plt.subplots(3, 2, figsize=(5.5, 8))
for row_axes, sample in zip(axes, samples.iter_rows(named=True)):
image = read_png(sample["image"])
instances = read_png(sample["inst"])
cell_types = read_png(sample["type"])
foreground = instances > 0
overlay = image / 255
overlay[foreground] = (
0.65 * overlay[foreground] + 0.35 * nucleus_colors[cell_types[foreground]]
)
edges = find_boundaries(instances, mode="inner") & foreground
overlay[edges] = nucleus_colors[cell_types[edges]]
for ax, pixels in zip(row_axes, (image, overlay)):
ax.imshow(pixels)
ax.set_axis_off()
row_axes[0].text(
0, 1.01, sample["tissue"], transform=row_axes[0].transAxes, fontsize=8
)
for ax, title in zip(axes[0], ["RGB image", "Nucleus annotations"]):
ax.set_title(title, pad=16, fontsize=9)
fig.legend(
handles=[
Patch(facecolor=c, label=n) for c, n in zip(nucleus_colors[1:], nucleus_names)
],
loc="lower center",
bbox_to_anchor=(0.5, 0.005),
ncol=5,
frameon=False,
fontsize=7,
title="Nuclei",
)
fig.subplots_adjust(
left=0.01, right=0.99, top=0.95, bottom=0.09, hspace=0.14, wspace=0.025
)
plt.show()
Each row shows the colour image and its marked nuclei.
Two examples without the image underneath. Black marks background; bright instance colours distinguish objects, not cell types. Class colours match the overlay examples above.
from skimage.color import label2rgb
instance_colors = [
(1, 0.85, 0.2),
(0.2, 1, 1),
(1, 0.3, 0.8),
(0.5, 1, 0.2),
(0.65, 0.55, 1),
]
mask_samples = samples.to_dicts()
mask_samples = [mask_samples[0], mask_samples[-1]]
mask_layers = [("inst", "Nucleus instances"), ("type", "Nucleus classes")]
mask_fig, mask_axes = plt.subplots(2, 2, figsize=(6.4, 8))
for row_axes, sample in zip(mask_axes, mask_samples):
for column, (ax, (key, title)) in enumerate(zip(row_axes, mask_layers)):
labels = read_png(sample[key])
if key == "type":
pixels = nucleus_colors[labels]
else:
pixels = label2rgb(
labels, colors=instance_colors, bg_label=0, bg_color=(0, 0, 0)
)
ax.imshow(pixels, interpolation="nearest")
ax.set_axis_off()
label = sample["id"]
row_axes[0].text(0, 1.02, label, transform=row_axes[0].transAxes, fontsize=8)
for ax, (_, title) in zip(mask_axes[0], mask_layers):
ax.set_title(title, fontsize=10, pad=18)
mask_fig.subplots_adjust(
left=0.01, right=0.99, bottom=0.02, top=0.94, hspace=0.16, wspace=0.03
)
plt.show()
Preparation and validation
The original PanNuke masks store each cell class separately. These were combined into inst and type, keeping every nucleus and assigning new nucleus numbers within each image. Where source masks overlap, the lower class number wins. Image size and colour values are unchanged.
The files use Parquet storage. Further conversion details are in manifest.json.
Limitations
PanNuke marks nuclei only. It has no whole-cell, cytoplasm or tissue-region masks. tissue names the tissue category for an image; it does not label individual pixels. Match class names before combining these masks with another dataset.
License and citation
The data use CC BY-NC-SA 4.0. When sharing them, credit the creators, link to the license, describe changes, and follow its noncommercial and share-alike terms. This version changes storage and combines the source mask channels as described above.
Please cite both PanNuke papers:
- Downloads last month
- 108

