SigLIP — bone marrow cell classification (20 cell types)
Twenty-class classifier for single-cell images from bone marrow smears.
79.76 % balanced accuracy over 20 cell types — 8 points above the dataset paper's ResNeXt-50 (71.4 %), trained on 30 % of the images with one fixed recipe, without dataset-specific tuning.
| Metric on the held-out test set (17,137 cells) | Value |
|---|---|
| Balanced accuracy (mean recall, 20 classes) | 79.76 % |
| Accuracy | 84.99 % |
| Macro F1 | 75.93 % |
The companion model (YOLO) and the full write-up: GitHub.
The dataset
Bone-Marrow-Cytomorphology_MLL_Helmholtz_Fraunhofer (Matek et al. 2021): 250 × 250 px single-cell images from bone marrow smears of 945 patients, May-Grünwald-Giemsa stained, expert-labelled into 21 classes. Abnormal eosinophils (8 images) were dropped, leaving 20 classes.
| Split | Cells |
|---|---|
| Train (max 4,000 per class) | 51,737 |
| Validation | 17,137 |
| Test | 17,137 |
The problems with this dataset
- Extreme imbalance — from 29,424 images (segmented neutrophils) down to 8; seven classes have fewer than 500 images, and three have only 4 to 6 cells in the test split.
- No patient identifiers — every split, ours and the paper's, is per image, so the same patient's cells can appear in training and test.
- Neighbouring maturation stages — myelocyte → metamyelocyte → band → segmented neutrophil are judgement calls at the boundaries, and that is where the errors concentrate.
Compared with the dataset paper
Matek et al. (Blood 2021) report class-wise strict recall for a ResNeXt-50 trained with five-fold cross-validation on the whole dataset (classes upsampled to about 25,000 images). The mean over the same 20 classes is 71.4 %. This model is above the paper on 17 of the 20 classes; the three below it are small in the test set — hairy cells (41 cells), other cells (30) and immature lymphocytes (6).
Not the same protocol: the paper averages five folds; this model is tested once on a 10 % hold-out. Both are per-image random splits over the same 20 classes.
Results in detail
(Matrix shown for SigLIP; the YOLO errors follow the same maturation-chain pattern.)
Training and evaluation
| Training data | at most 4,000 cells per class (51,737 of 171,366) |
| Training | 15 epochs, learning rate 5e-5, batch 16, minority classes oversampled |
| Split | stratified 80 / 10 / 10 per image, seed 42 |
| Model selection | best epoch on the validation split |
| Test | held-out 10 %, evaluated once, no tuning on the test set |
| Hardware | one NVIDIA T4 |
Usage
from PIL import Image
import torch
from torchvision.transforms import Compose, Normalize, Resize, ToTensor
from transformers import AutoModelForImageClassification
model = AutoModelForImageClassification.from_pretrained("ghostsas001/bone-marrow-cells-siglip").eval()
tf = Compose([Resize((224, 224)), ToTensor(), Normalize([0.5] * 3, [0.5] * 3)])
x = tf(Image.open("cell.jpg").convert("RGB")).unsqueeze(0)
probs = torch.softmax(model(pixel_values=x).logits, 1)[0]
print(model.config.id2label[int(probs.argmax())])
Labels: ART, BAS, BLA, EBO, EOS, FGC, HAC, KSC, LYI, LYT, MMZ, MON, MYB, NGB, NGS, NIF, OTH, PEB, PLM, PMO — abbreviations as in the dataset (for example BLA = blast, MYB = myelocyte, NGS = segmented neutrophil).
Limitations
Research model, not a medical device. Trained on one laboratory's smears and scanner; other stains, microscopes or cohorts may reduce accuracy. One training run, no confidence intervals. Classes with fewer than 50 test cells have noisy recall.
References
- Matek C., Krappe S., Münzenmayer C., Haferlach T., Marr C. Highly accurate differentiation of bone marrow cell morphologies using deep neural networks on a large image data set. Blood 138(20), 2021. doi:10.1182/blood.2020010568
- Dataset: Bone-Marrow-Cytomorphology_MLL_Helmholtz_Fraunhofer, The Cancer Imaging Archive, doi:10.7937/TCIA.AXH3-T579, CC BY 4.0
- SigLIP (Google) — huggingface.co/google