Micro-OD / README.md
stumbledparams's picture
Upload folder using huggingface_hub
8e79ea8 verified
---
task_categories:
- object-detection
tags:
- microscopy
- biology
- few-shot
- cell-detection
- biomedical
- malaria
- blood-cells
- live-cell-imaging
- fibroblast
size_categories:
- n<1K
configs:
- config_name: default
data_files:
- split: example
path: data/example.parquet
- split: test
path: data/test.parquet
---
# Micro-OD
**Micro-OD** is a few-shot microscopy object detection benchmark. It aggregates four publicly available biological imaging datasets across distinct microscopy domains and cell types, and packages them into a standardised format designed for evaluating vision models — in particular, large vision-language models (VLMs) — under few-shot, in-context prompting conditions.
## Motivation
Microscopy object detection is a challenging setting for general-purpose vision models: images are domain-specific, class vocabularies are narrow but fine-grained, and labelled data is scarce. Micro-OD is designed to probe how well a model can detect cells and parasites in a new domain when given only a handful of annotated example images at inference time — without any fine-tuning.
## Dataset Splits
The dataset contains two splits that together constitute the few-shot evaluation protocol:
| Split | Role | Images per sub-dataset | Total images |
|---|---|---|---|
| `example` | Few-shot support set | 10 | 40 |
| `test` | Evaluation query set | 53 | 212 |
**Evaluation protocol:** For each sub-dataset, a model may be provided with up to **10 example images** (from the `example` split) as in-context demonstrations. It is then evaluated on each of the **53 test images** in the `test` split. No fine-tuning on the example images is assumed — they serve solely as few-shot context.
## Sub-datasets
| Sub-dataset | Domain | Classes | Original size | Format | Source |
|---|---|---|---|---|---|
| BBBC | Bright-field blood smear; malaria parasite detection | Red Blood Cells, Trophozoite Cells, Ring Cells, Gametocyte Cells, Schizont Cells, White Blood Cells | 1,328 images | PNG | [Broad Bioimage Benchmark Collection](https://bbbc.broadinstitute.org/) |
| BCCD | Peripheral blood smear; blood cell counting | Red Blood Cells, White Blood Cells, Platelets | 364 images | JPG | [BCCD Dataset](https://github.com/Shenggan/BCCD_Dataset) |
| LIVECell | Phase-contrast live cell imaging (RatC6) | Spindle Cells, Polygonal Cells, Round Cells | 420 images | PNG | [LIVECell](https://sartorius-research.github.io/LIVECell/) (images); annotations in-lab |
| NIH-3T3 | Phase-contrast mouse fibroblast imaging | Polygonal Cells, Spindle Cells, Round Cells | 63 images | PNG | In-lab collection and annotation |
## Folder Structure
```
Micro-OD/
├── data/ # Generated Parquet files (HuggingFace viewer)
│ ├── example.parquet # 40 rows — few-shot support set
│ └── test.parquet # 212 rows — evaluation query set
├── example/ # Few-shot support set (raw files)
│ ├── BBBC/
│ │ ├── annotation.jsonl # Bounding-box annotations
│ │ ├── images/ # 10 PNG images
│ │ └── images_overlay/ # 10 images with bounding boxes drawn
│ ├── BCCD/
│ │ ├── annotation.jsonl
│ │ ├── images/ # 10 JPG images
│ │ └── images_overlay/
│ ├── LIVECell/
│ │ ├── annotation.jsonl
│ │ ├── images/ # 10 PNG images
│ │ └── images_overlay/
│ ├── NIH-3T3/
│ │ ├── annotation.jsonl
│ │ ├── images/ # 10 PNG images
│ │ └── images_overlay/
│ └── stat.txt # Split-level statistics
└── test/ # Evaluation query set (raw files)
├── BBBC/
│ ├── annotation.jsonl
│ ├── images/ # 53 PNG images
│ └── images_overlay/
├── BCCD/
│ ├── annotation.jsonl
│ ├── images/ # 53 JPG images
│ └── images_overlay/
├── LIVECell/
│ ├── annotation.jsonl
│ ├── images/ # 53 PNG images
│ └── images_overlay/
├── NIH-3T3/
│ ├── annotation.jsonl
│ ├── images/ # 53 PNG images
│ └── images_overlay/
└── stat.txt # Split-level statistics
```
Each `images_overlay/` folder contains copies of the images with ground-truth bounding boxes rendered on top, useful for visual verification.
## Annotation Format
Annotations are stored as [JSON Lines](https://jsonlines.org/) (`.jsonl`) files — one JSON object per line, one line per image.
```json
{
"image_path": "images/<filename>",
"bbox": {
"<class_name>": [
[[x_min, y_min], [x_max, y_max]],
[[x_min, y_min], [x_max, y_max]]
],
"<class_name>": [
[[x_min, y_min], [x_max, y_max]]
]
}
}
```
**Coordinate convention:**
- All coordinates are in **pixel space**.
- Each bounding box is represented as two points: `[x_min, y_min]` (top-left corner) and `[x_max, y_max]` (bottom-right corner).
- A class key is present only if at least one instance of that class appears in the image.
**Concrete example** (from `example/BCCD/annotation.jsonl`):
```json
{
"image_path": "images/BCCD_example_1.jpg",
"bbox": {
"Red Blood Cells": [
[[201, 223], [314, 322]],
[[1, 252], [89, 357]],
[[203, 336], [292, 441]]
],
"White Blood Cells": [
[[211, 4], [338, 132]]
],
"Platelets": [
[[330, 442], [373, 480]]
]
}
}
```
## Usage
To load the dataset:
```python
from datasets import load_dataset
ds = load_dataset("stumbledparams/Micro-OD")
# Access splits
example_split = ds["example"] # 40 images — few-shot support set
test_split = ds["test"] # 212 images — evaluation query set
# Each row contains:
# image — PIL image
# image_id — "<subdataset>/images/<filename>"
# subdataset — one of: BBBC, BCCD, LIVECell, NIH-3T3
# objects — dict with keys:
# bbox : list of [x_min, y_min, width, height] (COCO format, float32)
# category : list of int (ClassLabel index; decode with int2str)
row = test_split[0]
# Image (PIL.Image)
image = row["image"]
# Bounding boxes and category indices
bboxes = row["objects"]["bbox"] # list of [x_min, y_min, width, height] (float32)
categories = row["objects"]["category"] # list of int (ClassLabel index)
# Class names in ClassLabel index order (alphabetically sorted)
CLASS_NAMES = [
"Gametocyte Cells", "Platelets", "Polygonal Cells", "Red Blood Cells",
"Ring Cells", "Round Cells", "Schizont Cells", "Spindle Cells",
"Trophozoite Cells", "White Blood Cells",
]
for bbox, cat_idx in zip(bboxes, categories):
x_min, y_min, width, height = bbox
label = CLASS_NAMES[cat_idx]
print(f"{label}: [{x_min:.1f}, {y_min:.1f}, {width:.1f}, {height:.1f}]")
```
> **Note on bbox format:** The Parquet files store bboxes in COCO format `[x_min, y_min, width, height]` as float32. `category` is stored as a `ClassLabel` integer index. The raw `annotation.jsonl` files use `[[x_min, y_min], [x_max, y_max]]` (top-left / bottom-right pixel coordinates) — see [Annotation Format](#annotation-format).
## Dataset Statistics
Detailed per-class statistics are available in `example/stat.txt` and `test/stat.txt`. Summaries are provided below.
### Test Split — 212 images
| Sub-dataset | Images | Classes | Total boxes | Boxes/image (mean) | Boxes/image (range) |
|---|---|---|---|---|---|
| BBBC | 53 | 6 | 4,000 | 75.5 | 19–135 |
| BCCD | 53 | 3 | 952 | 18.0 | 9–30 |
| LIVECell | 53 | 3 | 223 | 4.2 | 1–15 |
| NIH-3T3 | 53 | 3 | 376 | 7.1 | 1–14 |
| **Total** | **212** | **10** | **5,551** | — | — |
### Example Split — 40 images
The **Support-Spread Score** (SS) is a composite metric reflecting both class coverage (fraction of classes represented in the sample) and class balance (how evenly instances are distributed across represented classes). Higher is better; a score of 1.0 indicates perfect coverage and balance.
| Sub-dataset | Images | Total boxes | Boxes/image (mean) | Support-Spread Score |
|---|---|---|---|---|
| BBBC | 10 | 734 | 73.4 | 0.136 |
| BCCD | 10 | 78 | 7.8 | 0.680 |
| LIVECell | 10 | 40 | 4.0 | 0.763 |
| NIH-3T3 | 10 | 62 | 6.2 | 0.612 |
| **Total** | **40** | **914** | — | — |
The low SS for BBBC (0.136) reflects the extreme dominance of Red Blood Cells in the malaria dataset, which makes it difficult to achieve a balanced 10-image sample across all 6 classes.
### Class Inventory
| Class | Sub-dataset(s) | Test boxes |
|---|---|---|
| Gametocyte Cells | BBBC | 24 |
| Platelets | BCCD | 159 |
| Polygonal Cells | LIVECell, NIH-3T3 | 417 |
| Red Blood Cells | BBBC, BCCD | 4,427 |
| Ring Cells | BBBC | 34 |
| Round Cells | LIVECell, NIH-3T3 | 24 |
| Schizont Cells | BBBC | 10 |
| Spindle Cells | LIVECell, NIH-3T3 | 158 |
| Trophozoite Cells | BBBC | 193 |
| White Blood Cells | BBBC, BCCD | 105 |
Note that Polygonal Cells, Round Cells, and Spindle Cells appear in both LIVECell and NIH-3T3 but describe morphologically similar — not biologically identical — phenotypes in different cell lines.
## Attribution
Micro-OD combines images and annotations from multiple sources. Please credit the original sources as appropriate:
- **BBBC (malaria):** Ljosa, V., Sokolnicki, K. L., & Carpenter, A. E. (2012). Annotated high-throughput microscopy image sets for validation. *Nature Methods*, 9(7), 637. [https://bbbc.broadinstitute.org/](https://bbbc.broadinstitute.org/)
- **BCCD:** Shenggan. *BCCD Dataset*. GitHub. [https://github.com/Shenggan/BCCD_Dataset](https://github.com/Shenggan/BCCD_Dataset)
- **LIVECell (images):** Edlund, C., et al. (2021). LIVECell — A large-scale dataset for label-free live cell segmentation. *Nature Methods*, 18(9), 1038–1045. [https://doi.org/10.1038/s41592-021-01249-6](https://doi.org/10.1038/s41592-021-01249-6). The morphology-based bounding-box annotations used in Micro-OD were produced in-lab and are not part of the original LIVECell release.
- **NIH-3T3:** Images and bounding-box annotations are an in-lab collection and are not sourced from a public dataset.