Contents
What you will do
This tutorial takes about 30 minutes. You will look through the hosted DSB2018 nuclei set, label nuclei on a few of your own images with the same conventions, and export the result in a format a segmentation model can train on.
Dataset · datatorch/nuclei-segmentation-dsb2018 · 670 files
Nuclei Segmentation (DSB2018)
Nuclei segmentation dataset from the 2018 Data Science Bowl (BBBC038v1, Broad Bioimage Benchmark Collection). 670 microscopy images with 29,442 individually segmented nuclei as polygon annotations, converted from the official per-nucleus masks. Spans fluorescence and brightfield/histology imagery across multiple organisms and staining protocols. License: CC0 1.0 (public domain). Source: https://bbbc.broadinstitute.org/BBBC038. Please cite: Caicedo et al., Nucleus segmentation across imaging experiments: the 2018 Data Science Bowl. Nature Methods 16, 1247-1253 (2019).
Open →
Step 1: learn the conventions from DSB2018
Open the hosted copy and page through ten or twenty images before you label anything. The set mixes fluorescence and histology stains, magnifications and illumination quality on purpose, so it shows you the hard cases fast.

Look for three things:
- One shape per nucleus. Every nucleus is its own polygon, even when two touch.
- No overlaps. In the source masks no pixel belongs to two nuclei. Where nuclei touch, the boundary is split between them.
- Edge nuclei count. A nucleus cut off by the image border is still labeled.
DSB2018 has known label noise. Some small or faint nuclei are missing and some boundaries are loose. Treat it as a guide to conventions, not as ground truth to copy pixel by pixel.
Step 2: set up your project and label
- 1
Create a project
Create a project and upload a few of your own microscopy images. Five is enough to learn the workflow.
- 2
Create one label
Go to Ontologies in the sidebar, click New label and name it nucleus. Use a single label. Separate classes for nucleus types are a later decision.
- 3
Outline each nucleus with the polygon tool
Open an image, pick the nucleus label and choose the polygon tool. Click around the boundary of one nucleus and close the shape on its first point. Repeat for every nucleus, including the ones on the border.
- 4
Split touching nuclei
Where two nuclei touch, draw each one up to the shared boundary. Do not draw one shape around both.
- 5
Review before you export
Zoom out and check each image for missed nuclei. Missing labels teach a model that a nucleus is background, which does more harm than a slightly loose outline.


Step 3: export to COCO
Go to Exports in the sidebar and click New schema. COCO is the default format, so name the schema and save it. Open it, click Run export, and when the run finishes use the download button on the Exports list to get the JSON file. Each nucleus comes out as one annotation with its polygon in segmentation.

Step 4: turn polygons into instance masks
Most nuclei models (StarDist, Cellpose, U-Net with a watershed step, Mask R-CNN) train from an instance label image: background is 0 and each nucleus has its own integer. This converts a COCO export with pycocotools:
import numpy as np
from pycocotools.coco import COCO
coco = COCO("export.json")
for image_id in coco.getImgIds():
info = coco.loadImgs(image_id)[0]
labels = np.zeros((info["height"], info["width"]), dtype=np.uint16)
anns = coco.loadAnns(coco.getAnnIds(imgIds=image_id))
for i, ann in enumerate(anns, start=1):
labels[coco.annToMask(ann) > 0] = i
np.save(f"{info['file_name']}.labels.npy", labels)
Later shapes overwrite earlier ones where they overlap. If your labels follow the no-overlap rule from Step 1, that never happens.
Where to go next
- What is inside DSB2018, its folder format and which model to start with: the nuclei segmentation dataset guide.
- A second, more uniform nuclei set from one chemical screen, with an official train, validation and test split: BBBC039 on DataTorch.
Source and license
BBBC038v1, the 2018 Data Science Bowl image set, from the Broad Bioimage Benchmark Collection. License: CC0. Source: https://bbbc.broadinstitute.org/BBBC038. Please cite: Caicedo et al., Nucleus segmentation across imaging experiments: the 2018 Data Science Bowl, Nature Methods 16, 1247 to 1253 (2019).
Label nuclei on your own images
Upload a few microscopy images and outline them in the browser, with your team.
Frequently asked questions
How many images are in the DSB2018 nuclei dataset?
The hosted copy has 670 images from the stage 1 training set, with 29,442 nuclei. Each nucleus is its own polygon, converted from the official per-nucleus masks.
What license is DSB2018 under?
BBBC038v1 is CC0. The contributors waived copyright and related rights. Cite Caicedo et al., Nature Methods 16, 1247 to 1253 (2019).
Should I label nuclei as instances or as a single foreground class?
As instances. One polygon per nucleus lets you build either an instance mask or a binary mask later. You cannot recover instances from a binary mask once touching nuclei are merged.
Can masks overlap?
Not in DSB2018. No pixel belongs to two nuclei. Keep the same rule in your own labels so your data matches the benchmark.
Open the hosted copy on DataTorch.
Browse the files in your browser, then download the dataset with a free account.
