WEIGHTS COMMITTED & RELEASED · v1.1.0

Empirical detection and classification of Leukemic Blasts.

A PyTorch and YOLOv8n pipeline trained on 25,875 microscopy fields with 115,548 annotated cells across 6 research cohorts. Features automated whole slide image (WSI) sliding-window tiling, multi-class blast morphology classification, and experience replay active learning.

OFFICIAL MODEL CHECKPOINTS & ARTIFACTS

Pretrained YOLOv8n Checkpoints (Release v1.1.0)

Both files are the same epoch-19 weights (identical SHA-256), published under two names. v1.0.0 remains available from its release page for comparison.

Top Training Checkpoint

best.pt

6.27 MB (6,270,162 bytes) · PyTorch

The best validation epoch (19) of the v1.1.0 training run, with optimizer state stripped. Standard filename for Ultralytics pipelines, research reproduction, and transfer learning.

SHA-256 Checksum:
ca4a0efaa5a85f7d60470c167b56b813e7e79749ec6bfc3fcabf6d814034e19d
Production Runtime Asset

active_model.pt

6.27 MB (6,270,162 bytes) · PyTorch

The deployment checkpoint bundled at data/models/active_model.pt, loaded by default by the FastAPI review sandbox and sliding-window WSI tiler.

SHA-256 Checksum:
ca4a0efaa5a85f7d60470c167b56b813e7e79749ec6bfc3fcabf6d814034e19d
One-Line CLI Download & Checksum Verification
# 1. Download best.pt directly via curl
curl -L -O https://github.com/abusuraihsakhri/blast-detection-algo/releases/download/v1.1.0/best.pt

# 2. Or download via GitHub CLI
gh release download v1.1.0 -p "best.pt"

# 3. Verify SHA-256 hash matches
# Expected: ca4a0efaa5a85f7d60470c167b56b813e7e79749ec6bfc3fcabf6d814034e19d
certutil -hashfile best.pt SHA256   # On Windows
sha256sum best.pt                   # On Linux / macOS
TRAINING DYNAMICS & VALIDATION CONVERGENCE

Validation and held-out test results

v1.1.0 was retrained for 20 epochs after fixing three data problems found in an audit of v1.0.0: polygon labels that Ultralytics misread, image-level tags stored as cell boxes, and evaluation images that reappear in other datasets' training splits. Both models are scored below on the same leak-free test set: 757 test images (4,631 boxes) with no near-duplicate in any training split, labels corrected. The released checkpoint is epoch 19, the best validation epoch.

96.94%
mAP@50 (leak-free test)
v1.0.0 on the same images: 93.96%. Validation: 94.1%.
94.07%
Precision (leak-free test)
v1.0.0: 86.82%.
94.46%
Recall (leak-free test)
v1.0.0: 90.64%.
77.10%
mAP@50-95 (leak-free test)
v1.0.0: 72.57%. Box quality averaged over IoU thresholds 0.50 to 0.95.
≈ 3 ms
Inference per image
640 px, batch 16, RTX 3060 Laptop GPU, plus ≈ 1 ms NMS. Measured with Ultralytics 8.4.31.
Class v1.0.0 AP@50 v1.1.0 AP@50 v1.1.0 AP@50-95 v1.1.0 P v1.1.0 R
Benign0.9600.9690.6870.9180.973
Early0.9880.9850.7020.9450.988
Pre0.9870.9900.7950.9530.987
Pro0.9940.9940.8700.9710.994
WBC0.9660.9740.7300.9420.924
RBC0.9090.9610.8490.8720.916
Platelets0.8510.9400.6671.0000.782
Myeloblast0.8620.9410.8690.9250.994
Lymphoblast–No test split. On the validation holdout: AP@50 0.743, AP@50-95 0.612, P 0.689, R 0.780. The weakest class.
Atypical–Not evaluated: no training or evaluation boxes. Reserved for reviewer-assigned labels.

Whole-slide tiling. evaluate_tiling.py stitches 64 test images into a 4800×4800 pyramidal TIFF and runs the sliding-window pipeline on it. The pipeline scores mAP@50 97.7% against 98.0% for predicting each image directly, so tiling, coordinate mapping and global NMS cost almost nothing. This checks the tiling code only: a mosaic of camera fields is not a scanned slide.

Limitations. Test images come from the original per-dataset splits, so these are in-distribution numbers, and Leukemia-NFXZN supplies 309 of the 757 test images. Blast-Cell-Detection has no leak-free test images at all: every one has a near-copy in another dataset's training split. Platelets rest on 26 BCCD images, so their AP is noisy. Lymphoblast was only measured on a validation holdout that also picked the checkpoint. The model has not been evaluated on real whole-slide scans, and tiles are not resampled to a common microns-per-pixel scale.

EMPIRICAL ARTIFACT VIEWER

Interactive Validation Curves & Detection Batches

Inspect convergence loss curves, normalized confusion matrices, precision-recall trade-offs, and side-by-side ground truth vs predictions. Click any artifact to enlarge in high resolution.

Training Convergence Curves

Training & Validation Trajectory Across 20 Epochs

Box, classification and distribution focal (DFL) losses with validation metrics for all 20 epochs. Validation mAP@50 rose to 94.1% at epoch 19. Unlike v1.0.0, which fell from 92.2% to 83.6% once mosaic augmentation switched off at epoch 11, it kept improving after the switch.

Label Distribution and Spatial Coordinates

Class Frequency & Spatial Bounding Box Distribution

Class counts, box centroids, and box sizes for the training split.

Normalized Confusion Matrix

Normalized Confusion Matrix

Quantifies cross-class classification fidelity. Shows how often each class is confused with the others, including the precursor lymphoid stages (Early, Pre, Pro).

Raw Confusion Matrix

Raw Instance Count Confusion Matrix

Raw counts of true labels against predicted classes on the validation split.

Precision-Recall Curve

Precision-Recall (PR) Curve

Precision-recall curves at IoU 0.50 for the 9 classes that have validation boxes. Atypical has none.

F1 Score vs Confidence Calibration

F1 Score vs Confidence Threshold Calibration

Identifies optimal operating threshold for production inference. The all-class F1 score peaks at 0.91 at confidence 0.415. The pipeline default is 0.25.

Validation batch:
Ground Truth Annotations

Validation Batch 0 — Annotated Ground Truth

Reference labels from the source datasets.

Model Predictions

Validation Batch 0 — YOLOv8n Predictions

Model predictions on the same validation images, with confidence scores.

DATALAKE HARMONIZATION

Aggregated Multi-Cohort Datalake (25,875 Fields)

Six public Roboflow datasets are merged and remapped into one 10-class taxonomy. The table shows the raw sources (115,548 boxes). Merging now cleans them in three ways. Polygon rows are converted to boxes; Leukemia-NFXZN mixes both formats in 1,010 label files, which Ultralytics misreads. Near-full-frame image tags are dropped (465 in Myeloblast-fbliw, 119 in Blood-Cell-znm2t). And train images that nearly duplicate any validation or test image are removed (676), because several sources re-export the same micrographs. Acute-Leukemia, which ships without a validation split, lends about 10% of its source images to validation. The v1.1.0 training set is 22,366 images (96,573 boxes), with 1,749 validation images (10,942 boxes).

# Cohort / Dataset Source Target Morphological Scope Train Valid Test Total Images Annotated Cells
1 Leukemia-NFXZN (Tawfiq Islam) B-ALL subtyping (Benign, Early, Pre, Pro) 6,589 622 312 7,523 83,854
2 Blast-Cell-Detection (YOLOv4) Binary blast vs leukocyte (blasts remapped to Pre) 3,011 72 39 3,122 3,365
3 BCCD Blood Cell Foundation Baseline blood elements (WBC, RBC, Platelets) 377 110 53 540 8,851
4 Blood-Cell-znm2t Differential Leukocyte differential (8 subtypes, all merged into WBC) 9,105 389 387 9,881 10,589
5 Acute-Leukemia AML/ALL Myeloblast vs Lymphoblast (train split only) 3,809 0 0 3,809 7,626
6 Myeloblast-fbliw Dedicated AML blasts (472 image-level "RBC" boxes included in totals) 700 200 100 1,000 1,263
Total Aggregated Datalake 23,591 1,393 891 25,875 115,548
MORPHOLOGY TAXONOMY

Unified 10-Class Cellular Taxonomy

Box counts are raw source totals across train, valid, and test after remapping, before the cleaning described above. Descriptions give the usual morphology of each class. The model learns from the labels alone and does not measure these features explicitly.

Pre B-ALL
46,491 cells

Pre B-ALL blasts from Leukemia-NFXZN. Also includes 1,689 generic "blast-cell" boxes from Blast-Cell-Detection, which are not subtyped.

Early Pre-B
16,402 cells

Precursor B-lymphoblastic stage with high N:C ratio, dense homogeneous chromatin texture, and absent or inconspicuous nucleoli.

Pro B-ALL
10,818 cells

Early uncommitted B-cell lineage blast (CD10-). Lacks mature B-cell surface markers; features round-to-oval nuclei with delicate chromatin.

Myeloblast (AML)
3,003 cells

AML blasts from Acute-Leukemia and Myeloblast-fbliw. In Myeloblast-fbliw the blasts are labeled "WBC" in the source and remapped here.

Lymphoblast
3,162 cells

Lymphoblasts from the Acute-Leukemia dataset only. Measured on a 10% validation holdout (AP@50 0.743), the weakest class. There is no test split.

Benign
11,832 cells

The non-leukemic class of the Leukemia-NFXZN B-ALL dataset.

WBC
15,122 cells

Leukocytes from BCCD, Blood-Cell-znm2t (all 8 subtypes merged), Blast-Cell-Detection, and Acute-Leukemia.

RBC
8,447 cells

Erythrocytes from BCCD. The count includes 472 Myeloblast-fbliw boxes, 465 of which cover more than 80% of the image; these image-level tags are dropped from v1.1.0 training.

Platelets
271 cells

Platelets from BCCD. The rarest trained class. Leak-free test AP@50 0.940, measured on only 26 images.

Atypical
0 cells

No source dataset maps to this class, so the released model has never seen an example. It exists so reviewers can assign it in the review UI.

SYSTEM ARCHITECTURE

WSI Sliding-Window & Active Learning Loop

Tiles whole-slide images, writes detections to a local review queue, and fine-tunes on reviewed tiles mixed with earlier data to reduce forgetting.

Step 01
WSI Ingestion
Extracts multi-resolution pyramid levels (.svs, .ndpi, .tiff) using tiffslide.
Step 02
Glass Filtering
Skips tiles where more than 80% of pixels have grayscale luminance above 220.
Step 03
512×512 Tiling
Sliding window with 25% overlap so cells on tile edges appear whole in at least one tile.
Step 04
YOLOv8n Inference
3.01M-parameter detector, run one tile at a time.
Step 05
Global NMS
Drops boxes cut by interior tile edges, maps the rest to slide coordinates, and removes duplicates (IoU 0.45).
Step 06
Experience Replay
Maintains 4:1 historical-to-new ratio with 1.5× quota boost for rare classes.
inference_pipeline.py

Gigapixel Sliding-Window Engine

Reads whole-slide images with tiffslide, skips background tiles, and runs 512×512 patches with 25% overlap in batches. Boxes touching an interior tile edge are dropped, since the overlap shows those cells whole in a neighbor tile. The rest are mapped to slide coordinates for global NMS.

replay_buffer.py

Stratified Experience Replay

Builds each fine-tuning set from newly reviewed tiles plus a stratified sample of earlier reviewed tiles (4 old per new), with a 1.5× quota for underrepresented classes, to reduce forgetting.

app.py & public/

Human-in-the-Loop Web Sandbox

Local FastAPI review interface with a confidence slider, box editing, and validated image uploads. Fine-tuning is started separately with training_pipeline.py --mode hitl.

DEVELOPER INTEGRATION

Quickstart & Pipeline Execution

The weights are pre-bundled in the repository at data/models/active_model.pt and can also be downloaded directly as best.pt from GitHub Releases for inference with Ultralytics YOLO or the custom WSI pipeline.

# 1. Clone the repository
git clone https://github.com/abusuraihsakhri/blast-detection-algo.git
cd blast-detection-algo

# 2. Create isolated virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .\.venv\Scripts\Activate.ps1

# 3. Install dependencies
pip install -r requirements.txt

# 4. Check active model weights (pre-loaded in repository)
ls -lh data/models/active_model.pt

# Option: Or fetch best.pt directly from GitHub Release v1.1.0
curl -L -O https://github.com/abusuraihsakhri/blast-detection-algo/releases/download/v1.1.0/best.pt
from ultralytics import YOLO
import cv2

# Load the trained model checkpoint (best.pt or active_model.pt)
model = YOLO("data/models/active_model.pt")  # or YOLO("best.pt")

# Run inference on a blood smear field
results = model.predict(
    source="path/to/smear_field.jpg",
    conf=0.25,        # 25% confidence threshold
    iou=0.45,         # NMS IoU threshold
    imgsz=640,
    device="cuda:0"   # or "cpu"
)

# Parse detected blast candidates
for box in results[0].boxes:
    cls_id = int(box.cls[0].item())
    cls_name = model.names[cls_id]
    confidence = float(box.conf[0].item())
    xyxy = box.xyxy[0].tolist()
    print(f"Detected {cls_name:<12} ({confidence:.2%}) at {xyxy}")
# Command line: tiles the slide, runs detection, applies global NMS,
# saves tiles to data/raw_tiles/ and writes detections to the SQLite review queue
python inference_pipeline.py path/to/slide.svs

# Same thing from Python
from database import init_db
from inference_pipeline import InferencePipeline

init_db()
InferencePipeline().run("path/to/slide.svs")
# Tile size, overlap, confidence and NMS IoU come from config.py
# (override with BLAST_TILE_SIZE, BLAST_INFERENCE_OVERLAP_PCT, ... in .env)
# Launch the FastAPI human-in-the-loop review interface
python app.py

# Review server starts at http://127.0.0.1:8000
# Features:
# - Review queue for tiles produced by inference_pipeline.py
# - Sandbox: upload a smear image (type, size and pixel limits enforced)
# - Confidence threshold slider, box editing and class reassignment

# Fine-tune on reviewed tiles (run separately, after saving reviews)
python training_pipeline.py --mode hitl