Abstract
Imaging flow cytometry with supervised learning can realize high-accuracy leukocyte classification. However, since supervised learning relies on annotated cell images and this labeling process generates cell losses, current imaging flow cytometry with supervised learning cannot be used for leukocyte differential. This study proposes a self-supervised contrastive learning framework pretrained on a non-annotated dataset comprising bright-field leukocyte images acquired via a custom imaging flow cytometry. The pretrained feature extractor, frozen during downstream tasks, employs lightweight linear or multilayer perceptron classification heads to achieve leukocyte differential in three independent annotated datasets: normal leukocyte subtypes (4-class), leukemia cells (2-class), and mixed normal/abnormal leukocytes (8-class). The proposed method achieves classification accuracies of 96.16%, 96.68%, and 92.24% across three independent datasets, performing comparably to supervised baselines (with differences of less than 2%), therefore demonstrating high accuracy for leukocyte differentials. Furthermore, since the abnormal leukocytes in the latter two datasets were not included in the pre-training dataset, the corresponding F1-scores of 96.68% and 91.92% indicate the method’s strong generalization ability. The presented self-supervised learning framework enables high-accuracy and strong-generalization leukocyte differential using non-annotated images from imaging flow cytometry.

Subject terms: Electrical and electronic engineering, Biosensors
Introduction
Leukocyte differential refers to the quantification of the percentage and absolute counts of white blood cells (WBCs) in peripheral blood, and it is widely used as a first-line hematological test1. The gold-standard method for leukocyte differential analysis involves the microscopic examination of blood smears, in which a blood sample is applied to slides, stained with acidic eosin and basic methylene blue dyes, and observed under a microscope2–4. Based on morphological analysis of nuclear characteristics, organelle architecture, and cytoplasmic or membrane properties, trained hematologists can classify WBCs into standard normal types—including basophils (BAS), eosinophils (EOS), lymphocytes (LYM), monocytes (MON), and neutrophils (NEU)—as well as various abnormal forms, such as myeloblasts, promyelocytes, myelocytes, metamyelocytes, and atypical lymphocytes5–7. Although widely used in clinical practice, this method is time-consuming, which seriously limits diagnostic efficiency8,9.
To address this issue, hematology analyzers were designed to perform continuous analysis of single blood cells based on light scattering and impedance variations, enabling high-throughput leukocyte differentiation10–12. Automated commercial hematology analyzers, such as the Sysmex XN-2000 and Beckman Coulter DxH 900, are routinely utilized in clinical laboratories worldwide13–16. Unfortunately, accurate leukocyte differential was achieved only for normal WBCs, but not for abnormal ones, due to the absence of morphological parameters17.
To overcome these limitations, imaging flow cytometry was utilized to capture fluorescence and/or bright-field images of white blood cells for classification by combining machine learning and deep learning18–21. For example, the commercial ImageStream platform attained 97.0% F1-scores in four-part leukocyte classification with machine learning22. In 2024, Wang et al.23 accomplished a classification accuracy of 97.1% for three ovarian cell types by integrating three supervised networks on bright-field and three-channel fluorescence imaging data. In 2025, Chen et al.24 achieved a classification accuracy of 99.6% for four leukocyte subtypes by employing a fusion of five deep neural networks, which combined supervised LSTM and ResNet-18 models applied to impedance and fluorescence imaging data. However, since supervised learning relies on annotated cell images and this labeling process generates cell losses, current imaging flow cytometry with supervised learning cannot be used for leukocyte differential.
Thus, label-free bright-field images captured by imaging flow cytometry25–27 coupled with self-supervised learning28–30 holds a significant promise for leukocyte differential. Different from supervised learning, self-supervised learning can utilize non-annotated data for training and classification by automatically generating proxy tasks to generate supervisory signals from the data itself, thereby obtaining guidance from large-scale data and achieving highly discriminative features for downstream classification31,32. Within the field of leukocyte classification of blood smears, self-supervised learning has demonstrated high accuracies and strong generalization. For example, in 2024, Jia et al.33 achieved a classification accuracy of 93.51% across 15 classes on the TMAMD leukocyte-stained blood smear dataset using a masked autoencoder pretrained on a stained blood smear dataset. In 2024, Koch et al.34 reported a classification accuracy of 86.6% for 10-part leukocyte differential on the Acevedo dataset, utilizing a pretrained DINO v2 network.
As to leukocyte classification based on imaging flow cytometry and self-supervised learning, the only previous report was in 2023, in which Zhang et al.35 reported an accuracy of 91.9% for three-part classification of normal leukocytes using a pretrained deep convolutional autoencoder with frozen parameters. However, the generative learning used in this study focused on pixel-level reconstruction, which over-emphasized low-level details irrelevant to semantic discrimination, thereby potentially compromising the accuracy and generalizability of leukocyte classification.
This study establishes a self-supervised contrastive framework for leukocyte differential, based on bright-field images from imaging flow cytometry. Compared to generative learning, contrastive learning directly enhances feature separability and robustness against perturbations without being constrained by the need for precise input reconstruction. The MoCo v236 framework was selected for its strong alignment with classification objectives, training stability, and computational efficiency, making it well-suited for capturing subtle discriminative features in cell images compared with generative methods37 and MoCo v338. More specifically, the feature extraction network was pretrained on unannotated leukocyte images. For downstream classification tasks, the pretrained encoder’s parameters were frozen, and only lightweight linear or multilayer perceptron (MLP) classification heads were trained. The MoCo v2-based methodology achieves performance parity with supervised baselines, underscoring exceptional cross-dataset generalization capabilities without architectural retraining. The unannotated and strongly generalizable imaging flow cytometry-based sorting method may enhance the capability of clinical leukocyte differential.
Materials and methodology
Working flow chart
As shown in Fig. 1, the overall workflow of this study consisted of three main phases: (a) image acquisition, (b) self-supervised pre-training, and (c) multi-dataset downstream leukocyte differential. Initially, leukocyte samples—including mixed leukocytes, purified leukocytes, and leukemia cell lines—were captured using a custom-built imaging flow cytometry system. Through multiple independent experiments, one non-annotated dataset (derived from leukocyte mixtures) and three annotated datasets were constructed for pre-training and generalization evaluation.
Fig. 1. Schematic of generalizable self-supervised learning for imaging flow cytometry on multi-dataset leukocyte differential.
a In image acquisition, images of leukocyte mixtures, purified leukocytes, and leukemia cell lines were captured by a home-developed imaging flow cytometry. Through multiple independent experiments, one non-annotated leukocyte mixture dataset along with three annotated datasets, which were utilized for testing model generalization, were constructed. b In self-supervised pre-training, a MoCo v2-based contrastive learning framework was conducted on the non-annotated leukocyte mixture dataset. This framework utilized a ResNet-18 as the shared backbone network, comprising a query encoder updated by backpropagation and a momentum encoder with momentum-updated parameters. After pre-training, the query encoder was saved as a feature extractor. c In downstream differential, the three annotated datasets were used independently to train and evaluate to validate the generalization. During fine-tuning, the pre-trained ResNet-18 weights were frozen, and only a lightweight linear classifier or MLP head was trained for each specific task
In the self-supervised pre-training phase, a Momentum Contrast (MoCo v2) framework36 was employed to learn representative features from the non-annotated dataset. This framework utilized a ResNet-1839 architecture as the shared backbone network, consisting of a query encoder (updated via backpropagation) and a momentum encoder (updated via momentum-based moving average). Following pre-training, the pre-trained query encoder was subsequently saved as a fixed feature extractor.
For the downstream differential phase, the pre-trained weights were frozen, and only a lightweight linear classifier or multilayer perceptron (MLP) head was trained and evaluated on each of the three annotated datasets to validate cross-dataset generalization.
Image acquisition and dataset composition
The image data in this study were acquired by a custom-built imaging flow cytometry (Fig. 1a). The cytometry utilized a PZT-based acoustic focusing method, which ensured that cells passed sequentially through the depth-of-field region at the center of the channel, enabling the high-throughput acquisition of high-quality, in-focus bright-field cell images. The samples tested included leukocyte mixtures, purified leukocytes, and leukemia cell lines. For detailed configurations regarding materials, cell preparation, and the imaging flow cytometry setup, please refer to our group’s previous publication40. Specifically, the original images were single-channel grayscale with a resolution of 200 × 200 pixels and 8-bit depth. For storage, the images were replicated into 3-channel format and saved as PNG files.
Through multiple experiments, four mutually independent datasets were constructed: one non-annotated dataset for self-supervised pre-training and three annotated datasets for downstream differential tasks to test generalization of pre-training feature extractor. No cell images were reused across these datasets. The self-supervised pre-training dataset consisted of images from leukocyte mixtures obtained from four healthy volunteers and contained only non-annotated images of normal leukocytes. The three downstream differential datasets all comprised annotated leukocyte images. Normal leukocyte types came from purified leukocytes isolated via fluorescence-activated cell sorting after red blood cell lysis of whole blood, while abnormal leukocyte types were derived from in vitro cultured leukemia cell lines. All three datasets were independent and non-overlapping.
The first dataset included the four most abundant normal leukocyte types—EOS (eosinophil), LYM (lymphocyte), MON (monocyte), and NEU (neutrophil)—and served as a four-class baseline for normal cell classification. The second dataset contained two types of leukemia cell lines, HL60 (promyelocytic leukemia) and K562 (chronic myelogenous leukemia), which were unseen during feature extractor pre-training. It was used to validate the generalizability of the feature extractor in classifying novel abnormal cell types. The third dataset comprised five types of normal leukocytes—BAS (basophil), EOS, LYM, MON, and NEU—as well as three types of abnormal leukemia cell lines: Jurkat (T-cell leukemia), HL60, and K562. This dataset included both all categories of normal cells and abnormal cell types (representing both lymphoid and myeloid lineages) not encountered during feature extractor pre-training.
Self-supervised pre-training
The self-supervised learning workflow in this study comprised two parts. First, a feature extractor was pre-trained using self-supervised learning on an extensive non-annotated dataset. Subsequently, for the three downstream differential tasks, the deep neural network for feature extraction was frozen, and only a lightweight classification head was trained separately on each annotated dataset. This approach thus enabled cell classification with minimal training cost while maintaining the integrity of the backbone feature extraction network.
Prior to being fed into the neural network, images were first resized to a fixed dimension of 224 × 224 pixels. During the contrastive pre-training phase, data augmentation was applied to generate different views; this step was omitted for downstream tasks. The images were then converted into PyTorch tensors, and pixel values were linearly scaled from the integer range [0, 255] to floating-point values [0.0, 1.0]. Finally, normalization was performed using Z-score standardization, with mean and standard deviation parameters set to 0.5 for all three channels. The training in this study was performed on Ubuntu 18.04 systems using PyTorch 1.8.2 and CUDA 11.1, hosted on AutoDL servers with an Intel Xeon Gold 6430 CPU (16 vCPUs) and a single NVIDIA RTX 4090 GPU (24 GB).
In the self-supervised pre-training phase, as illustrated in Fig. 1b, the MoCo v2 architecture36 was employed for contrastive learning, which featured a momentum encoder and a queue-based dictionary for maintaining a large set of negative samples. To formally define the learning objective, the instance discrimination pretext task was adopted. This task aims to learn an encoder such that the representation of a query image is similar to that of its positive key (a different augmented view of the same image) and dissimilar to representations of negative keys (other images in the queue). This is achieved by minimizing the InfoNCE (Noise-Contrastive Estimation) loss function, formulated as:
| 1 |
where and denote the L2-normalized feature representations extracted by the query encoder fq and momentum encoder fk, respectively; k+ is the positive key feature; ki are negative keys sampled from the queue; K = 65536 specifies the queue size; and τ = 0.07 is a temperature hyperparameter that modulates the sharpness of the distribution. The parameters θk of the momentum encoder fk are updated via a momentum-based moving average of the parameters θq of the query encoder fq, following the update rule:
| 2 |
with a momentum coefficient m = 0.999. This momentum-based update mechanism enhances the consistency of key representations across the queue.
Following the establishment of the theoretical framework, the implementation components were detailed in this section. The backbone feature extraction network was a ResNet-18 convolutional neural network, selected for its offers favorable balance between model complexity and accuracy, effectively meeting the feature extraction requirements for leukocyte images. Since the effectiveness of contrastive learning depended on the data augmentation strategy, a composite augmentation scheme—comprising rotation, flipping, erosion, and Gaussian blur—was designed to address the characteristics of non-annotated bright-field leukocyte images, which were single-channel and sensitive to magnification.
The batch size was set to 256, the maximum feasible on the RTX 4090 GPU (24 GB), to ensure high training speed. Key hyperparameters, including learning rates of 0.01 and 0.05, then intermediate values of 0.02 and 0.025, and finally 0.0225, were tuned to identify the optimal network for downstream feature extraction. The training performance of MoCo v2 was evaluated using two standard primary metrics: top-1 accuracy and contrastive loss36. Top-1 accuracy measures the model’s ability to correctly identify the positive key (augmented view of the same image) among a large number of negatives in the instance discrimination task and serves as a direct indicator of representation quality. Contrastive loss quantifies the similarity between positive pairs relative to negative pairs, with lower values indicating more effective learning of invariant features. These metrics offer complementary perspectives: accuracy reflects downstream discriminative potential, while loss guides the optimization process until convergence.
Multi-dataset downstream leukocyte differential
For the three downstream leukocyte differential tasks (Fig. 1c), two classification schemes were employed using the MoCo v2 pre-trained feature extractor, both evaluated with fivefold cross-validation: a linear classifier and a 3-layer multilayer perceptron (MLP). In both schemes, the feature extractor remained frozen, and the output logits o were converted into a probability distribution over the predicted classes via the softmax function, which is defined as:
| 3 |
where oj denotes the j-th element of the logits vector o, corresponding to the raw, unnormalized score for the j-th class. The denominator represents the sum of the exponentials of all elements in the logits vector, serving as the normalization factor that ensures the output values sum to 1. Thus, the function computes the probability of the j-th class by exponentiating its logit and scaling it by the sum of the exponentiated logits of all possible classes.
The linear classifier acted as a direct probe for the intrinsic discriminability of the features learned through self-supervised learning. It was defined by the transformation:
| 4 |
where the input feature vector was projected directly to the output logits, introducing no non-linearity beyond the softmax function.
Furthermore, the MLP classifier introduced non-linearity through two hidden layers, sequentially transforming the input feature to 1024 dimensions, then to 512 dimensions; each transformation was followed by non-linear activation and normalization operations before the final linear output layer produced the class logits o. This design allowed the MLP to enhance separability beyond a linear boundary while maintaining a lower computational cost relative to full-network fine-tuning, thus providing a practical balance for the downstream tasks.
To evaluate the effectiveness of the proposed scheme, this study also compared it against another self-supervised learning scheme and three supervised learning schemes on the three downstream tasks. All tasks used 5-fold cross-validation, and key hyperparameters such as the learning rate were tuned for optimal performance. A batch size of 256 was used across all tasks to maximize training throughput on the available GPU.
SimCLR was adopted as an alternative self-supervised learning framework for comparison. To facilitate a fair comparison of feature effectiveness between the two self-supervised methods, the SimCLR-trained feature extractor was similarly frozen, and an identical linear classification head was trained on the three downstream tasks. The SimCLR framework also utilized ResNet-18 as the backbone network with the same data augmentation as MoCo v2. However, since SimCLR’s performance is known to depend on a large batch size and lacks a momentum update mechanism, gradient accumulation was employed to overcome the memory limitations of a single RTX 4090 GPU (24 GB). An original batch size of 256 was combined with a gradient accumulation step of 16, yielding an effective batch size of 4096. Other key hyperparameters included a temperature of 0.5 and a learning rate of 0.1. For downstream evaluation, the linear classifier was trained identically to the MoCo v2 case, with the feature extractor frozen.
For comparison, we trained three supervised learning methods—MLP, ResNet-18, and ViT-Small—separately on the annotated dataset of each downstream task. Multilayer perceptron (MLP) is a feedforward artificial neural network model composed of an input layer, hidden layers, and an output layer, capable of learning complex patterns in data. By comparing the performance of a standalone supervised MLP with that of the self-supervised feature extractor followed by an MLP head, we could directly evaluate the effectiveness of the features learned through self-supervision.
ResNet-18 is an 18-layer deep residual network that mitigates the vanishing gradient problem through skip connections. As a lightweight architecture known for its balanced performance and parameter efficiency, it was selected as the supervised convolutional neural network benchmark for comparison with our proposed scheme.
Vision Transformer (ViT) is a transformer-based architecture for computer vision that divides images into fixed-size patches and treats them as token sequences for feature extraction. The ViT-Small variant was chosen for this study as the supervised ViT benchmark because its parameter count was comparable to that of ResNet-18, ensuring a fair comparison.
To compare the results from the three downstream tasks, classification accuracy, precision, recall, and F1-score were calculated for evaluation. Accuracy measures the proportion of correctly predicted samples. Precision measures the proportion of true positive samples among those predicted as positive. Recall measures the proportion of correctly predicted samples among all true positive samples. F1-score is the harmonic mean of precision and recall, thus providing a comprehensive assessment of model performance. In addition, Paired t tests were applied to evaluate the statistical significance of the observed performance differences between the self-supervised and supervised models across the datasets and metrics.
The core scheme of this study, the self-supervised framework based on MoCo v2, was further evaluated on the three downstream tasks using confusion matrices for both the linear and MLP classification heads. A confusion matrix visualizes the correspondence between predicted results and true samples in a tabular format, facilitating a detailed analysis of classification errors. Each cell contains the absolute count of instances and the corresponding proportion, which is calculated by is calculated by dividing the count in that cell by the total number of instances belonging to the true class of that row, thereby providing a normalized view of the prediction distribution for each actual class. Furthermore, Grad-CAM visualizations were employed to assess the interpretability of the learned representations, identifying the key morphological features that contributed to the classification decisions.
Results and discussion
Datasets
The details of the image datasets captured by the custom-built imaging flow cytometry were shown in Table 1. Beginning with the leukocyte mixture images used for the self-supervised feature extraction, this dataset comprised 80,347 images sourced from 4 healthy donors. These images were obtained directly from the leukocyte mixture after the lysis of red blood cells in whole blood, were non-annotated, and used to train a stable and effective feature extractor in the self-supervised task. Representative images were shown in Fig. 2a.
Table 1.
Leukocyte datasets captured by a home-developed imaging flow cytometry
| Dataset name | Primary use | Annotate status | Total | Cell classes & quantity |
|---|---|---|---|---|
| Leukocyte Mixture Dataset | Self-supervised Pre-training | Non-annotated | 80,347 | Normal Leukocytes: 80,347 |
| 4-class Normal Leukocyte Dataset | Task 1: 4-class Normal Leukocyte Differential | Annotated | 24,834 | 1. Eosinophil (EOS): 4175 |
| 2. Lymphocyte (LYM): 5879 | ||||
| 3. Monocyte (MON): 6383 | ||||
| 4. Neutrophil (NEU): 8397 | ||||
| 2-class Abnormal Leukocyte Dataset | Task 2: 2-class Abnormal Leukocyte Differential | Annotated | 11,093 | 1. HL60: 5468 |
| 2. K562: 5625 | ||||
| 8-class Normal/Abnormal Leukocyte Dataset | Task 3: 8-class Normal/Abnormal Leukocyte Differential | Annotated | 8,419 | 1. Basophil (BAS): 515 |
| 2. Eosinophil (EOS): 1034 | ||||
| 3. Lymphocyte (LYM): 1159 | ||||
| 4. Monocyte (MON): 1189 | ||||
| 5. Neutrophil (NEU): 1238 | ||||
| 6. Jurkat: 1086 | ||||
| 7. HL60: 1061 | ||||
| 8. K562: 1137 |
Fig. 2. Representative single-cell bright-field images collected by the home-developed imaging flow cytometry for the four datasets.
a Non-annotated mixture of leukocytes, all of which are normal leukocytes; b annotated 4-class normal leukocytes including eosinophils (EOS), lymphocytes (LYM), monocytes (MON), and neutrophils (NEU); c annotated 2-class abnormal leukemia cell lines of HL60 and K562; d annotated 8-class normal/abnormal leukocytes, comprising five types of normal leukocytes—basophils (BAS), eosinophils (EOS), lymphocytes (LYM), monocytes (MON), and neutrophils (NEU)—and three types of abnormal leukemia cell lines (Jurkat, HL60, and K562). (Scale bar: 5 μm)
Subsequently, annotated leukocyte image data were captured and used in the three downstream differential tasks. Normal leukocyte types were derived from purified leukocytes via fluorescence-activated cell sorting (FACS) after red blood cell lysis in whole blood from healthy donors, while abnormal leukocyte types were derived from in vitro cultured leukemia cell lines. The three datasets were mutually independent with no overlap. Representative images were shown in Fig. 2b–d. Dataset 1 (Fig. 2b) comprised 4 types of purified normal leukocytes from healthy human peripheral blood: EOS (eosinophils), LYM (lymphocytes), MON (monocytes), and NEU (neutrophils), with a total of 24,834 images. Dataset 2 (Fig. 2c) contained 2 types of leukemia cells: HL60 and K562, which were abnormal cell types absent during the training of the self-supervised learning feature extractor, with a total of 11,093 images. Dataset 3 (Fig. 2d) included 8 types of normal and abnormal leukocytes: 5 purified normal types—BAS (basophils), EOS, LYM, MON, NEU—and 3 leukemia cell lines—HL60, Jurkat, and K562—which were also absent during pre-training. This dataset had the smallest volume (8419 images) but the most categories. Except for BAS (515 images), each category contained approximately 1000 images each to ensure relatively balanced data volume.
The example images indicated that all leukocyte bright-field images were clear and in focus, with distinct cell contours and internal textures. Based on apparent cell size, normal leukocytes were smaller than abnormal leukemia cells, while the size of normal leukocytes remained consistent across datasets. Among the normal leukocytes, lymphocytes were significantly smaller than the other four types, which was consistent with standard leukocyte analysis. The leukocyte mixture contained cells with both larger and smaller diameters, suggesting that it included all categories of normal leukocytes.
Results of self-supervised pre-training
Figure 3 presented the self-supervised pre-training results on the non-annotated leukocyte mixture dataset, specifically comparing the performance of MoCo v2 under different learning rates. The comparison included the variation in Top-1 accuracy across training epochs (Fig. 3a) and the variation in contrastive loss across training epochs (Fig. 3b). The tested learning rates were 0.01 (red), 0.02 (blue), 0.0225 (green), 0.025 (purple), and 0.05 (yellow). These results indicated that the model converged around 100 epochs under all five learning rates, justifying the selection of 200 epochs for training.
Fig. 3. Performance comparison of MoCo v2 self-supervised pre-training under different learning rates.
a Top-1 classification accuracies versus training epochs. b Contrastive losses versus training epochs. The learning rates were set to 0.01 (red), 0.02 (blue), 0.0225 (green), 0.025 (purple), and 0.05 (yellow). Results demonstrate that the performance of the three learning rates is remarkably similar, all achieving very high final accuracies of ~ 100% with losses all converging near 6.2, highlighting the parameter robustness of MoCo v2 on this dataset. The learning rate of 0.0225 (green curve) was ultimately selected as it achieved the highest accuracy of 99.99%
Among the five learning rates, the feature extraction network for downstream tasks was selected based on the highest Top-1 accuracy. The final choice was the model trained with a learning rate of 0.0225 (green curve), which achieved the highest Top-1 accuracy (99.99%), outperforming the 99.97% achieved with 0.01, 99.98% with 0.02, 99.98% with 0.025, and the 99.94% achieved with 0.05. For the contrastive loss, since a custom-built dataset was used for this study, the final converged contrastive loss value of approximately 6.2 only indicated effective convergence of self-supervised learning on this specific dataset but was not directly comparable to values reported on other datasets.
The final performance in terms of both Top-1 accuracy and contrastive loss was highly similar across the learning rates, achieving an extremely high final accuracy (close to 100%) and a contrastive loss value approaching 6.2. This demonstrated the parameter robustness of MoCo v2 on this dataset and confirmed the high compatibility of the selected data augmentation strategy, the ResNet-18 backbone network, and the leukocyte mixture dataset, marking a successful phase in self-supervised pre-training.
Results of multi-dataset downstream leukocyte differential
After obtaining the feature extraction network via self-supervised pre-training, the network was frozen and applied to differential tasks on three downstream leukocyte datasets. For each dataset, a linear classification head was first trained to validate the effectiveness of the features, followed by training an MLP classification head to improve classification accuracy. The classification confusion matrix results were shown in Fig. 4.
Fig. 4. Confusion matrices for downstream leukocyte differential on three datasets.
a The linear classification head and b the MLP head for 4-class normal leukocytes; c the linear classification head and d the MLP head for 2-class abnormal leukocytes; e the linear classification head and f the MLP head for 8-class normal/abnormal leukocytes. Evaluation shows that self-supervised pre-trained feature extractors were highly discriminative and generalizable, achieving high accuracy with linear evaluation alone; MLP heads further enhanced nonlinear fitting, boosting overall classification accuracy
For the 4-class normal leukocyte differential task (Fig. 4a), the linear classification head achieved high precision with the recall for each cell type exceeding 0.90, demonstrating the effectiveness of feature extraction. The MLP classification head further improved the recall for each cell type to above 0.94 (Fig. 4b). In terms of cell types, the two lowest recall values were for EOS and NEU, which was consistent with the expectation that eosinophils and neutrophils are similar and thus difficult to distinguish.
In the 2-class abnormal leukemia cell differential task (Fig. 4c, d), the model exhibited exceptional accuracy in distinguishing between HL60 and K562, two types of abnormal leukocytes not present in the pre-training dataset, with each class recall exceeding 0.95, thereby demonstrating the generalization capability of the self-supervised pre-trained feature extraction network. The MLP classification head effectively reduced the minor misclassifications observed with the linear classification head, achieving a per-class recall exceeding 0.97. The high accuracy might be attributed to the relative simplicity of the binary classification task.
In the most complex 8-class normal/abnormal mixed leukocyte differential task (Fig. 4e, f), the linear classification head still achieved a minimum recall of 0.84 for NEU, which more robustly demonstrated the generalization of the feature extraction network. The recall for each cell type was relatively lower due to the task’s complexity. In the confusion matrix for linear classification shown in Fig. 4e, LYM exhibited the highest recall of 0.96, likely because their significantly smaller diameter makes them a distinctive feature. Following LYM, three types of abnormal leukocytes—which are larger than normal cells—also showed relatively high recall. The remaining four types of normal leukocytes, with similar diameters, showed lower recall. These results were consistent with cell diameter being the most obvious and physically meaningful distinguishing characteristic. Notably, the total number of misclassified samples between normal and abnormal (146) was lower than that within normal leukocytes (573), verifying that greater feature differences exist between normal and abnormal cells.
As shown in Fig. 4f, the MLP classification head significantly improved the recall for several leukocyte types (e.g., achieving a recall of 0.90 for MON, 0.87 for NEU, and 0.96 for Jurkat). However, the improvement for BAS was limited, resulting in only two additional correct classifications. This is likely attributable to the limited number of BAS samples (approximately half that of other types) and the relatively simple architecture of the MLP head. Despite this, high-accuracy differential was achieved, with the recall for each leukocyte type exceeding 85%.
Based on Grad-CAM analysis (Fig. S1), the model exhibits strong medical interpretability by precisely localizing attention to the intrinsic morphological features of leukocytes, with activation maps that were confined to intracellular textures and cell contours. It also captured size variations, showing a positive correlation between leukocyte diameter and the Grad-CAM hotspot area, which confirms its ability to quantify structural distinctions between leukocytes.
Table 2 presented the performance of the proposed self-supervised learning scheme compared to other supervised and self-supervised methods on three leukocyte datasets, evaluating Accuracy, Precision, Recall, and F1-score to comprehensively provide a comprehensive assessment. First, the supervised learning baseline—direct MLP classification on the raw data—performed significantly worse than other methods, with accuracies of only 43.40% and 43.37% for the 4-class Normal and 8-class Normal/Abnormal tasks, respectively. This demonstrated that a simple MLP (or even simpler linear layers) could not effectively distinguish leukocytes, thereby underscoring the necessity and effectiveness of feature extraction through self-supervised pre-training compared to training classifiers directly on raw data.
Table 2.
Classification performance of different supervised/self-supervised methods on three leukocyte datasets
| Dataset | Methodology | Accuracy | Precision | Recall | F1-score |
|---|---|---|---|---|---|
| 4-class Normal | MLP (Sup) | 43.40% | 45.33% | 36.04% | 33.00% |
| ResNet-18 (Sup) | 96.81% | 96.80% | 96.79% | 96.78% | |
| ViT-Small (Sup) | 97.61% | 97.63% | 97.47% | 97.54% | |
| SimCLR (Linear Head) | 73.58% | 72.96% | 72.68% | 72.81% | |
| MoCo v2 (Linear Head) | 93.56% | 93.70% | 93.45% | 93.57% | |
| MoCo v2 (MLP Head) | 96.16% | 96.15% | 95.98% | 96.06% | |
| 2-class Abnormal | MLP (Sup) | 85.28% | 85.29% | 85.26% | 85.27% |
| ResNet-18 (Sup) | 97.67% | 97.68% | 97.67% | 97.67% | |
| ViT-Small (Sup) | 95.17% | 95.17% | 95.16% | 95.17% | |
| SimCLR (Linear Head) | 95.46% | 95.45% | 95.46% | 95.46% | |
| MoCo v2 (Linear Head) | 95.47% | 95.46% | 95.47% | 95.46% | |
| MoCo v2 (MLP Head) | 96.68% | 96.69% | 96.68% | 96.68% | |
|
8-class Normal/ Abnormal |
MLP (Sup) | 43.37% | 43.13% | 40.34% | 39.63% |
| ResNet-18 (Sup) | 94.01% | 93.83% | 94.11% | 93.88% | |
| ViT-Small (Sup) | 92.54% | 92.49% | 92.25% | 92.37% | |
| SimCLR (Linear Head) | 72.70% | 71.87% | 71.40% | 71.46% | |
| MoCo v2 (Linear Head) | 91.46% | 91.12% | 91.15% | 91.13% | |
| MoCo v2 (MLP Head) | 92.24% | 92.00% | 91.87% | 91.92% |
Subsequently, the performance of two representative supervised learning networks, ResNet-18 and ViT-Small, was established as benchmarks on the three datasets. Notably, supervised learning required retraining the entire feature extraction network separately on each annotated dataset and could not leverage non-annotated data. The two self-supervised learning contrastive methods, SimCLR and MoCo v2, were then evaluated based on linear classification head performance. MoCo v2 outperformed SimCLR by approximately 20% across all four metrics (Accuracy, Precision, Recall, and F1-score) on both the 4-class Normal and 8-class Normal/Abnormal tasks, proving that its self-supervised learned features possessed higher discriminability and generalization. Finally, by freezing the feature extraction network pre-trained with MoCo v2 and training only a simple MLP classification head, the achieved performance on all four metrics was within approximately 2% of the supervised learning benchmarks across all three downstream differential tasks.
Based on paired t tests across three datasets (Table S1), the supervised ResNet-18 showed statistically significant superiority over the self-supervised MoCo v2+MLP (p < 0.05 in all comparisons). However, the mean performance differences remained practically small: 0.72% for 4‑class Normal, 1.09% for 2‑class Abnormal, and 1.97% for 8‑class Normal/Abnormal—all below the 2% threshold. This indicated that the self-supervised method achieved comparable performance to supervised learning, especially in less complex tasks, while the increased gap in the more challenging 8‑class setting reflected an expected decline in feature discriminability. These results collectively demonstrated that the self-supervised pre-trained feature extraction network possessed exceptional cross-dataset generalization capability.
Conclusion
This study establishes a self-supervised contrastive framework for leukocyte differential, based on bright-field images from imaging flow cytometry. Through pretraining on non-annotated data, the feature extractor learned augmentation-invariant, discriminative representations, enabling high performance on downstream tasks with minimal fine-tuning. The proposed “pretrain on normal, evaluate on unseen abnormal” paradigm enables the assessment of generalization across diverse datasets, including unseen abnormal leukocyte types, with accuracy comparable to that of supervised models. This confirms that the learned representations are robust, transferable, and less prone to dataset-specific overfitting. Thus, this work underscores the potential of self-supervised learning to enhance flow cytometry by reducing manual annotation burdens and improving model generalization capability.
Future work will focus on two key objectives: classifying leukocytes from different hospital settings and integrating multimodal diagnostic data (e.g., fluorescence labeling, impedance signals). We will advance these efforts by utilizing broader, multi-center patient samples and validated through collaborations with hospitals. This validation will involve data from diverse sources, covering variations in region, imaging devices, and protocols, to robustly promote the clinical translation of intelligent flow cytometry diagnostics.
Supplementary information
Acknowledgements
This work was supported from the National Natural Science Foundation of China (Grants No.: 62331025 and 62121003) and the Beijing Municipal Natural Science Foundation (Grants No.: 4232010).
Competing interests
The authors declare no competing interests.
Contributor Information
Zirui Wang, Email: wangzirui23@mails.ucas.ac.cn.
Xianxiang Chen, Email: chenxx@aircas.ac.cn.
Yi Zhang, Email: zhangyi03@aircas.ac.cn.
Jian Chen, Email: chenjian@mail.ie.ac.cn.
Supplementary information
The online version contains supplementary material available at 10.1038/s41378-026-01236-x.
References
- 1.Molnar, J. A. “12 - Automated blood cell analysis”, Rodak’s Hematology (Sixth Edition), E. M. Keohane, C. N. Otto and J. M. Walenga, eds., pp. 174-200, St. Louis (MO): Elsevier (2020).
- 2.Lewis, J. E. & Pozdnyakova, O. Digital assessment of peripheral blood and bone marrow aspirate smears. Int. J. Lab. Hematol.45, 50–58 (2023). [DOI] [PubMed] [Google Scholar]
- 3.Chase, M. L. et al. Consensus recommendations on peripheral blood smear review: Defining curricular standards and fellow competency. Blood Adv.7, 3244–3252 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.Nakashima, M. O. et al. The impact of pathologist review on peripheral blood smears a college of american pathologists q-probes study of 22 laboratories. Arch. Pathol. Lab. Med.149, 618–626 (2025). [DOI] [PubMed] [Google Scholar]
- 5.Palmer, L. et al. ICSH recommendations for the standardization of nomenclature and grading of peripheral blood cell morphological features. Int. J. Lab. Hematol.37, 287–303 (2015). [DOI] [PubMed] [Google Scholar]
- 6.Matek, C. et al. Human-level recognition of blast cells in acute myeloid leukaemia with convolutional neural networks,. Nat. Mach. Intell.1, 538–544 (2019). [Google Scholar]
- 7.Vilchez C. “13 - Examination of the peripheral blood film and correlation with the complete blood count”, Rodak’s Hematology (Sixth Edition), E. M. Keohane, C. N. Otto and J. M. Walenga, eds., =201–18, St. Louis (MO): Elsevier (2020).
- 8.Tian, Z. X. et al. Blood cell analysis: From traditional methods to super-resolution microscopy. Photonics9, 261 (2022). [Google Scholar]
- 9.Cheng, W. X. J. et al. Application of image recognition technology in pathological diagnosis of blood smears. Clin. Exp. Med.24, 181 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Rastogi, S. et al. Overall equipment effectiveness, efficiency and slide review analysis of high-end hematology analyzers. Pract. Lab. Med.30, e00275 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11.Daves, M. et al. Modern hematology analyzers: Beyond the simple blood cells count (with focus on the red blood cells). J. Lab. Precis. Med.9, 4 (2024). [Google Scholar]
- 12.Liu, L. A. et al. Multi-wavelength multi-direction laser light scattering for cell characterization using machine learning-based methods. Cytom. Part A103, 796–806 (2023). [DOI] [PubMed] [Google Scholar]
- 13.Buoro, S. et al. Multicenter evaluation of blood cell counts on 8 automated hematology analyzers. Biochimica Clin.40, 195–203 (2016). [Google Scholar]
- 14.Ciepiela, O. et al. A comparison of Mindray BC-6800, Sysmex XN-2000, and Beckman Coulter LH750 automated hematology analyzers: A pediatric study. J. Clin. Lab. Anal.30, 1128–1134 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 15.Meintker, L. et al. Comparison of automated differential blood cell counts from Abbott Sapphire, Siemens Advia 120, Beckman Coulter DxH 800, and Sysmex XE-2100 in normal and pathologic samples. Am. J. Clin. Pathol.139, 641–650 (2013). [DOI] [PubMed] [Google Scholar]
- 16.Schapkaitz, E. & Raburabu, S. Performance evaluation of the new measurement channels on the automated Sysmex XN-9000 hematology analyzer. Clin. Biochem.53, 132–138 (2018). [DOI] [PubMed] [Google Scholar]
- 17.Wang, M. R. et al. Developments of conventional and microfluidic flow cytometry enabling high-throughput characterization of single cells. Biosens. -Basel12, 443 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Huang, Q. et al. Imaging flow cytometry: From high - resolution morphological imaging to innovation in high - throughput multidimensional biomedical analysis. Front. Bioeng. Biotechnol.13, 1580749 (2025). [DOI] [PMC free article] [PubMed]
- 19.Railean, V. & Buszewski, B. Flow cytometry - sophisticated tool for basic research or/and routine diagnosis; impact of the complementarity in both pre- as well as clinical studies. Crit. Rev. Anal. Chem.54, 2087–2109 (2024). [DOI] [PubMed] [Google Scholar]
- 20.Vonficht, D. et al. Ultra-high-scale cytometry-based cellular interaction mapping. Nat. Methods22, 1887–1899 (2025). [DOI] [PMC free article] [PubMed]
- 21.Kanno, H. et al. High-throughput fluorescence lifetime imaging flow cytometry. Nat. Commun.15, 7376 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 22.Nassar, M. et al. Label-free identification of white blood cells using machine learning. Cytom. Part A95, 836–842 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Wang, Z. W. et al. Single-detector multiplex imaging flow cytometry for cancer cell classification with deep learning. Cytom. Part A105, 666–676 (2024). [DOI] [PubMed] [Google Scholar]
- 24.Chen, S. et al. Bimodal fusion of single-cell impedance and imaging data using five deep neural networks. IEEE Nanotechnol. Mag.19, 24–30 (2025). [Google Scholar]
- 25.Du, Z. Q. et al. Label-free detection and enumeration of rare circulating tumor cells by bright-field image cytometry and multi-frame image correlation analysis. Lab a Chip22, 3390–3401 (2022). [DOI] [PubMed] [Google Scholar]
- 26.Otesteanu, C. F. et al. A weakly supervised deep learning approach for label-free imaging flow-cytometry-based blood diagnostics. Cell Rep. Methods1, 100094 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 27.Wang, Z. W. et al. Single-detector dual-modality imaging flow cytometry for label-free cell analysis with machine learning. Opt. Lasers Eng.168, 107665 (2023). [Google Scholar]
- 28.Zeune, L. L. et al. Deep learning of circulating tumour cells. Nat. Mach. Intell.2, 124–133 (2020). [Google Scholar]
- 29.Liu, B. et al. Self-supervised learning reveals clinically relevant histomorphological patterns for therapeutic strategies in colon cancer. Nat. Commun.16, 2328 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30.Hong, T. et al. Automated cell profiling in imaging flow cytometry with annotation-efficient learning. Opt. Laser Technol.181, 111992 (2025). [Google Scholar]
- 31.Lu, Y. N. et al. “Self-supervision can be a good few-shot learner”, In Proc. Computer Vision (ECCV 2022), Tel Aviv, Israel, 740–58 (2022).
- 32.Rani, V. et al. Self-supervised learning: A succinct review. Arch. Comput. Methods Eng.30, 2761–2775 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 33.Jia, N. et al. A fine-grained image classification algorithm based on self-supervised learning and multi-feature fusion of blood cells. Sci. Rep.14, 22964 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 34.Koch, V. et al. “DinoBloom: A foundation model for generalizable cell embeddings in hematology”, In Proc. Medical Image Computing and Computer Assisted Intervention (MICCAI 2024), Marrakesh, Morocco. 520–30 (2024).
- 35.Zhang, Z. et al. Interpretable unsupervised learning enables accurate clustering with high-throughput imaging flow cytometry. Sci. Rep.13, 20533 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 36.He, K. et al. “Momentum contrast for unsupervised visual representation learning”, In Proc. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR 2020), Seattle, WA, USA, 9726–35 (2020).
- 37.He, K. et al. “Masked Autoencoders Are Scalable Vision Learners”, In Proc. 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR 2022), New Orleans, LA, USA, 15979–88 (2022).
- 38.Chen, X. et al. “An Empirical Study of Training Self-Supervised Vision Transformers”, In Proc. 2021 IEEE/CVF International Conference on Computer Vision (ICCV 2021), Montreal, QC, Canada, 9620–9 (2021).
- 39.He, K. et al. “Deep residual learning for image recognition”, In Proc. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2016), Las Vegas, NV, USA, 770–8 (2016).
- 40.Huang, X. et al. Label-free 8-part leukocyte differential enabled by imaging flow cytometry of acoustic focusing and deep neural network of ResNet-18. Biomed. Instrum.1, 10004 (2025). [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.




