Offline, full-stack decision-support ecosystem for instance segmentation and classification of bone marrow aspirates in low-resource clinical environments.
graph TD
A[Raw Bone Marrow Image] -->|Optical Microscope| B(Color Normalization: CLAHE)
subgraph Stage 1: Segmentation
B --> C{YOLOv8-Nano}
C -->|Detects Target ROI| D[Polygon Generation]
end
subgraph The Bridge
D --> E[Bounding Box Extraction]
E --> F[Tight Crop / Natural Background]
end
subgraph Stage 2: Classification
F --> G{MobileNetV3}
G -->|Multi-class Inference| H[Logits & Softmax]
end
subgraph Clinical Safety
H --> I{Confidence ≥ 85%?}
I -->|Yes| J[Confident Prediction]
I -->|No| K[Flagged: Review Required]
end
J --> L((Streamlit UI))
K --> L((Streamlit UI))
classDef stage1 fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
classDef stage2 fill:#e8f5e9,stroke:#1b5e20,stroke-width:2px;
classDef safety fill:#fff3e0,stroke:#e65100,stroke-width:2px;
class C,D stage1;
class G,H stage2;
class I,J,K safety;
- Clinical Context & Architecture
- System Specifications
- Standard Operating Procedure (SOP)
- Clinical Interface (Human-in-the-Loop)
- Technology Stack
- Roadmap
Bone marrow aspirate analysis presents extreme morphological complexity, hampered by dense cell occlusion and severe class imbalance across maturation stages. Existing automated solutions require prohibitive infrastructure, such as cloud computing and motorized digital microscopes.
MarrowNode resolves this bottleneck by delivering a decentralized, edge-optimized software pipeline capable of operating entirely offline, processing optical microscopy images captured via standard consumer adapters.
To overcome the medical annotation bottleneck and ensure long-term scalability, MarrowNode implements a decoupled, two-stage inference architecture. This modularity allows the system to scale to new pathologies without retraining the heavy segmentation backbone.
-
Stage 1: Agnostic Instance Segmentation (YOLOv8) A lightweight segmentation model (YOLOv8-Nano) trained strictly on a binary class (Nucleated Cell vs. Background) using the SegPC-2021 clinical dataset. Its sole purpose is to handle occlusion, draw polygons, and locate targets within dense bone marrow smears.
-
The Bridge: Automated Isolation An intermediary algorithmic step that computes the bounding box from the segmentation polygon, crops the raw image, and isolates the detected cell on a standardized background (masking out neighboring artifacts).
-
Stage 2: Expert Classification (MobileNetV3) A highly optimized Convolutional Neural Network (MobileNetV3-Small) trained on isolated, expertly annotated single-cell datasets (such as the MLL dataset). It processes the cropped outputs from Stage 1 to classify the specific hematological lineage (e.g., Myeloblast, Monocyte, Lymphocyte).
-
Hardware Deployment Constraint: Both stages, along with the color normalization pipeline (CLAHE), are engineered to run sequentially and offline on standard consumer hardware.
Establish a reproducible, scalable, and modular machine learning pipeline for bone marrow aspirate analysis, utilizing a two-stage approach (Segmentation -> Classification).
- Color Normalization Pipeline:
- Input: Raw RGB images from optical microscopes.
- Process: Convert to LAB color space, apply CLAHE on the L-channel, convert back to RGB.
- Dataset Preparation (Stage 2 - Classification):
- Ingest the MLL dataset (isolated cells). Apply color normalization.
- Dataset Preparation (Stage 1 - Segmentation):
- Ingest the SegPC-2021 Challenge dataset.
- Dynamically merge multi-instance
.bmpmasks and extract normalized YOLO polygon coordinates.
- Train the Classifier (Stage 2):
- Architecture: MobileNetV3 (Fine-tuned, lr=1e-4).
- Task: Multi-class classification.
- Train the Segmenter (Stage 1):
- Architecture: YOLOv8-seg (Nano version).
- Task: Binary instance segmentation on dense smears.
- Develop the Bridge Script: Calculate tight bounding boxes, mask ROI, and feed to the Classifier.
- Safety Threshold (Uncertainty Estimation): The orchestrator automatically flags any classification under 85% confidence as "Review Required" to prevent AI hallucinations on noisy clinical data.
The system features a lightweight, open-source Streamlit dashboard tailored for hematologists. It operates entirely locally, ensuring patient data privacy (no cloud processing).
Key Features:
- Dual Mode Inference: Users can upload a Full Smear (triggers Stage 1 + 2) or an Isolated Cell (bypasses YOLO to prevent Scale Shift issues on cropped datasets).
- Human-in-the-Loop: Uncertain predictions are highlighted in red, forcing the clinician to make the final call.
- Deep Learning: PyTorch, Ultralytics (YOLO)
- Computer Vision: OpenCV, Pillow
- User Interface: Streamlit (Customized for offline use)
- Edge Deployment (WIP): ONNX Runtime
- Initialize repository and environment.
- Configure data ingestion and color normalization scripts.
- Establish Stage 2 classification model architecture (MobileNetV3).
- Train Stage 1 instance segmentation model (YOLOv8) on clinical data.
- Build and test the Human-in-the-loop clinical interface (Streamlit).
- Optimize models for Edge Computing (ONNX FP16 Quantization).
- Framework: ONNX Runtime (CPU Execution Provider)
- Precision: FP16 (Half-Precision)
- End-to-End Latency (Stage 1 + Stage 2): ~300 ms per Full Smear Image
- Clinical Target: < 2000 ms (Passed)
Disclaimer: MarrowNode is an open-source Computer-Assisted Intervention (CAI) tool for research purposes. It does not provide autonomous medical diagnoses.
