cell-level triage for leukemia screening
The cells that matter most, seen first.
Acute lymphoblastic leukemia is diagnosed by examining a blood smear one cell at a time. This network ranks every cell by how closely it resembles a leukemic lymphoblast, so the reviewer reaches the most suspicious ones sooner — running entirely in the browser, with no image ever leaving the device.
background
The hardest part is telling two very similar cells apart.
Acute lymphoblastic leukemia is the most common cancer in children. It begins in the bone marrow, which starts producing immature lymphocytes — lymphoblasts — in enormous numbers, crowding out the healthy blood cells the body needs.
Diagnosis starts at a microscope. A stained smear of blood or marrow is examined cell by cell, and each cell has to be placed on one side of a line: is this a malignant lymphoblast, or something benign?
That question is much harder than it sounds. Healthy marrow — particularly in children, and particularly while recovering from an illness — produces hematogones, entirely ordinary immature B-cells. Under the microscope they look very similar to lymphoblasts: same rough size, same high ratio of nucleus to cytoplasm, same fine chromatin.
Telling them apart reliably is a learned skill that takes years, and the people who have it are concentrated in a small number of centres.
what it does
Same cells, same reviewer, better order.
The model takes one already-isolated cell image and returns a number between 0 and 1: how closely it resembles the leukemic lymphoblasts it was trained on. Run across a smear, those numbers give an order — the cells most worth a second look, first.
That is the whole idea, and it is deliberately modest. Nothing is removed from the review. Nothing is decided. The reviewer still sees every cell on the slide; they simply reach the interesting ones earlier instead of working through in arbitrary order. On a slide carrying hundreds of cells, the order you meet them in is most of the work.
It also runs in a place that matters. The whole network is 47.7 MB and executes inside the browser tab, on the visitor's own machine. There is no server, no upload, and no account — which means no patient image ever leaves the device it was opened on, and the tool works anywhere a browser does.
measured on held-out patients
Eleven patients the network had never seen.
single cells in the test set, from 11 patients held out of training entirely
precision — of every 100 cells it flags, about 96 really are leukemic
ROC AUC — how well it ranks cells, independent of any threshold
the whole network, downloaded once and run inside your browser
1,882 cells, and what happened to each one
Every cell in the test set is one mark. The upper block is the 1,094 cells that actually were leukemic; the lower block is the 788 that were not. Crimson means leukemia is present in the cell — solid where the model caught it, hollow where it did not.
The confusion matrix
Counts at the decision threshold of 0.770. Rows are what the cell was; columns are what the model said.
| Model flagged | Model did not flag | Total | |
|---|---|---|---|
| Actually leukemic | 851true positives | 243false negatives | 1,094 |
| Actually normal | 36false positives | 752true negatives | 788 |
| Total | 887 | 995 | 1,882 |
The metrics
| Measure | Value | In cells |
|---|---|---|
| Precision | 0.959 | Of the 887 cells it flagged, 851 really were leukemic. |
| Specificity | 0.954 | Of 788 normal cells it cleared 752 and falsely flagged 36. |
| Sensitivity | 0.778 | Of 1,094 leukemic cells it flagged 851. |
| F1 | 0.859 | Harmonic mean of precision and sensitivity. |
| ROC AUC | 0.858 | Threshold-independent ranking quality. |
| Accuracy | 0.852 | 1,603 of 1,882 cells put on the right side. The least useful line in this table — the classes are unbalanced and the two errors are not equally bad. |
Precision is what makes the ordering useful. At the 0.770 threshold, 96 of every 100 flagged cells really are leukemic, so a reviewer working down the flagged list meets real lymphoblasts almost immediately rather than wading through false alarms. Sensitivity of 0.778 is the reason this is a starting order and not a filter: the reviewer reads the whole slide either way, and the ranking only changes what they see first.
the full trade-off
Every threshold is a choice about which errors you prefer.
Lowering it catches more leukemic cells and raises the false alarms a reviewer has to wade through. Raising it does the reverse. 0.770 is one point on that curve, and it was chosen on validation patients, never on these.
validation
Scored the hard way, on purpose.
C-NMC gives you many cells per patient, and the obvious way to split it — divide the images at random — puts cells from the same patient on both sides of the wall. That looks harmless and is not.
Cells from one patient share a blood draw, a staining batch, a slide, a microscope, and a lighting setup. Those things leave a signature on every image — a cast, a texture, a background tint — that has nothing to do with whether the cell is malignant. A network with cells from patient 07 in its training set does not have to learn what a lymphoblast is in order to score patient 07's test cells. It can learn what patient 07 looks like, and recall the label.
So the split here was rebuilt by patient, and verified subject-disjoint before training began. Every number on this page comes from eleven patients the network had never seen in any form.
The same architecture, the same data, the same recipe. The only change was which folder each file went into.
| Measure | Split by imagethe easy score | Split by patientwhat is published | Change |
|---|---|---|---|
| F1 | 0.953 | 0.859 | −0.094 |
| Sensitivity | 0.947 | 0.778 | −0.169 |
Splitting by patient is harder to score well on, and it is the only split that answers the question a clinic would actually ask: how does this behave on someone it has never met? The published figures are the ones that survived that test.
method
How it was built, in nine decisions.
Data
C-NMC 2019, the ISBI challenge set of single-cell images from paediatric B-lineage ALL, colour-normalised and pre-segmented.
Split
By patient, 70/15/15, stratified by class, seed 42 — 51 training, 11 validation, 11 test. Subject-disjointness verified before training, not assumed.
Architecture
ResNet-50 pretrained on ImageNet, fine-tuned end to end.
Input
224×224×3 NHWC float32, Caffe-style: RGB to BGR, then per-channel means [103.939, 116.779, 123.68] subtracted. No 0–1 rescale.
Loss
Focal loss weighted toward the leukemic class, so the class imbalance could not quietly optimise the model into ignoring positives.
Output
A single sigmoid giving P(normal), since class index 1 is normal. Everything here uses P(leukemic) = 1 − that.
Threshold
0.770, chosen on a stratified subset of the validation patients. The test set was scored once, at that threshold, and never used to pick it.
Evaluation
1,882 cells from the 11 test patients: 1,094 leukemic, 788 normal.
Demo weights
The browser copy stores weights at float16 — half the bytes, scores differing by up to about 0.002. Every metric here came from the float32 export.
scope
Where this applies, and where it doesn't.
Everything below is a boundary on what has actually been measured. It is here so the results above can be read for what they are.
01 Has it been validated clinically?
No. No prospective study, no reader study, no hospital, no regulatory review of any kind. Nothing here establishes that it helps a real pathologist on a real case.
02 How many datasets has it seen?
One — C-NMC 2019. Performance on images from a different hospital, scanner, stain protocol, or segmentation pipeline is unknown, and the split-by-patient result above is a direct reminder of how much acquisition can matter.
03 Can it find cells in a whole slide?
No. The input has to be pre-segmented — individual cells, already cut out and centred. Finding and isolating the cells is a separate problem this project does not touch.
04 What about stain variation?
The images are colour-normalised; C-NMC ships that way. Raw slide images with their real stain variation are a different distribution.
05 Which patients does it apply to?
Paediatric B-lineage only. The dataset is childhood B-cell ALL. T-lineage disease, adult patients, and other malignancies are outside anything that was measured.
06 Can it say "this is not a cell"?
No. The two classes are the only two options. It cannot say "this is a neutrophil", "this is a smudge cell", or "this image is not a cell". It sorts everything onto a leukemic/normal axis, including things that belong on neither.
07 What does a cell it doesn't flag mean?
It means the model did not rank that cell highly — nothing more. At the published threshold it flagged 851 of 1,094 leukemic cells, so an unflagged cell has not been cleared of anything. This is a ranking aid for a reviewer who reads every cell, and it only works as one.
try it
Run the actual model on an actual cell.
This is the same ResNet-50 that produced every number above, exported to ONNX and executed locally with onnxruntime-web. Your image is read into a canvas, resized to 224×224, and passed to the network without leaving your device.
The weights are stored at float16, the precision the network was trained and evaluated at. That halves the download and moves the score by up to about 0.002 against the float32 export, so treat the third decimal as noise.
Before you use this: it is not a diagnostic tool. It is a student research prototype, not a medical device, and it has never been validated in a clinic. It does not detect leukemia and it does not diagnose anyone — it assigns a similarity score to a picture of a single cell that has already been cut out of a slide. It is designed to sit in front of a qualified reviewer who examines every cell regardless, and nothing it outputs should be used to make a decision about a person.
What this accepts: one isolated white blood cell, roughly centred, on a plain background, cut out of an already-segmented smear — the kind of image C-NMC is made of. A photograph of a whole slide, a field of many cells, or anything that is not a stained cell will still return a confident-looking number, and that number will be meaningless.
1 — Load the network
0%
Tick the box above to enable.
2 — Choose a cell image
Load the network first.
what the network saw
0.000 P(leukemic), against a threshold of 0.770
0.000threshold 0.7701.000
A score, not a finding. This tool ranks cells for a reviewer who reads all of them; it does not clear a cell and it does not diagnose anyone.