SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Figure 7: Our dataset enables training GANs for attribute-based image editing, which can be used for synthesizing counterfactual examples. For instance, controlling cell size and NC ratio can illustrate the decision boundaries between monocytes and lymphocytes.
5.1 Human Intervention with Highly Interpretable Models
One of our motivations in developing this dataset is to foster XAI for WBC recognition. An effective approach to enhance explainability is designing models that make predictions based exclusively on attributes that are easily interpretable by humans. Koh et al. [49] explored such a model that initially uses a CNN to predict a set of human-interpretable attributes and subsequently uses these attributes to predict the target output. Formally, the models are trained on data points of  $\{image x, attribute a, target y\}$ , using  $x$  to predict attributes  $\hat{a}$  and then relying exclusively on  $\hat{a}$  to estimate the target  $\hat{y}$ . We implemented a basic version of this model using the attribute predictor developed in Sec. 4. In particular, we trained a L1-regularized linear softmax classifier  $f(\cdot)$  to predict WBC types from the probabilities of attributes inferred from an image. Importantly, we limit the  $f(\cdot)$  to depend solely on these attribute probabilities to determine the cell category. The model can predict the WBC categories with a F-measure of  $99.40 \pm 0.04\%$ , whereas a CNN predicting directly from images can achieve  $99.54 \pm 0.05\%$ . Despite the slightly reduced accuracy, the attribute-based model facilitates more engaging human-model interactions, akin to Koh et al. [49], by enabling human interventions with the edited attributes  $\hat{a}'$  and observing how this impacts the prediction  $f(\hat{a}')$  versus  $f(\hat{a})$ . As shown in Fig. 6-(a), we can analyze hypothetical scenarios, such as what would happen if a cell contained granules of a different color. Such analysis would be infeasible without our dataset.
5.2 Counterfactual Example Retrieval and Synthesis
Another way of explaining a classifier is to show counterfactual examples, where a slight modification to the input image can result in a different classification outcome by the classifier. Our attribute predictor described in Sec. 4 can be utilized for retrieving counterfactual examples that correspond to attribute changes. Fig. 6-(b) displays a retrieved example where the pink granules of the cell in Fig. 6-(a) are changed to purple ones, illustrating the decision boundary between neutrophils and basophils. Furthermore, we can even generate counterfactual examples for a given WBC image by utilizing data-driven image editing techniques [50]. As a proof-of-concept, we trained an unconditional StyleGAN [51] and implemented GAN-based editing techniques [52, 53] to modify cell size and the nuclear cytoplasmic (NC) ratio, as shown in Figure 7. These attributes are crucial in distinguishing between monocytes and lymphocytes [31, 38]. Larger cells with a lower NC ratio (depicted on the left in Fig. 7) are likely monocytes, whereas smaller cells with a higher NC ratio (shown on the right in Fig. 7) are lymphocytes. These counterfactual examples helps us understand the decision boundaries.
(a) APL (Positive)
(b) Non-APL (Negative)
Figure 8: (Best viewed with zoom). We analyze the binary classifier for Acute Promyelocytic Leukemia (APL) using images of promyelocytes, a type of immature cell absent from our dataset. Employing the attribute predictor trained on our dataset, we estimate the probability distribution of morphological attributes in test images of (a): APL and (b): Non-APL. Notably, we observe a significant difference in  $P(\text{Blue Cytoplasm})$  between correct predictions and incorrect predictions within (a) and (b). Specifically, plot (a) demonstrates that the classifier is likely to overlook APL if the cell exhibits blue cytoplasm, whereas plot (b) indicates the classifier tends to mistakenly diagnose APL when the cell lacks blue cytoplasm. Essentially, the classifier correlates blue cytoplasm with Non-APL. This correlation is not medically supported [60, 61] and is a coincidental correlation present in the training set (as demonstrated in plot (c)) of a specific dataset [59]. For further details, refer to Sec. 5.3.
(c) Biased Training Set
5.3 Interpreting Model Bias for Blood Disorders Involving WBCs
Although our dataset annotates morphological attributes of typical cells from healthy individuals, we believe it still offers significant potential for explaining the behaviors of machine learning models for atypical cells from blood disorders. Attribute predictors trained on our dataset can unveil biases that a model might have inadvertently learned, thereby improving model interpretability. Models often misclassify images that are linked to particular attributes. This issue has been reported in various machine learning systems, including face recognition models that underperform on certain genders [54], races [55], or skin colors [56]. Similar examples have been discovered in the medical field, where skin disease detection models erroneously associate malignant cases with artificial skin markers used in clinical practices [57], or X-ray models misinterpreting the appearance of a treatment device as pathological signs [58]. By employing our attribute predictors to identify biases, we can improve model interpretability, enabling a deeper understanding of decisions and ultimately contributing to XAI that assists clinicians in adapting ML models for diagnosis.
To illustrate this point, we explore the Acute Promyelocytic Leukemia (APL) detection dataset [59] derived from peripheral blood smears. This dataset presents a binary classification task of recognizing APL from images of immature myeloid cells – an atypical category not covered in our dataset. Initially, we trained a baseline classifier using ResNet50, achieving an AUC of  $76.97 \pm 2.35\%$ , comparable to the reported  $73.9\%$  achieved using a 7-layer CNN. Subsequently, we applied our attribute predictors on the test images to examine the correlation between the classifier's performance and the attribute distributions in promyelocytes, the type of myeloid cells essential for diagnosing APL, as indicated by the  $P$  in APL, representing promyelocytic, the adjective form of promyelocyte.
We explored the attribute distribution and the classifier's performance in actual APL cases and actual non-APL cases. On closer inspection of all attributes, we found that promyelocytes characterized by blue cytoplasm were frequently misclassified as false negatives, as illustrated in Fig. 8-(a). Examining the training set more thoroughly to locate the source of this bias, we found a clear correlation between blue cytoplasm and non-APL cases (Fig. 8-(c)). To validate this bias, we consulted relevant literature [60, 61] and inspected actual images within this dataset. We concluded that this was a spurious correlation present in the training set, specific to this dataset [59]. This example clearly illustrates how our dataset can help in identifying model biases, thus promoting model interpretability for XAI in medical diagnostics.
We have presented a densely-annotated dataset for WBC recognition, containing 11 morphological attributes for 10,298 cell images. This dataset addresses the current gap in the development of explainable and interpretable machine learning models for WBC analysis, a crucial task in hematology and pathology. We trained an automatic attribute recognition model and showcased several specific applications that can be developed using our attribute annotations. We hope that our dataset will foster advancements in XAI in the fields of pathology and hematology.
Limitation. We annotated images from a single source [6], which is limited to typical cells and does not include abnormal cells from blood disorders, which may be of greater clinical interest. Annotating these cells is a future direction. The cytoplasm color in our attribute definitions assume the use of the May Grünwald-Giemsa staining method, and they may appear differently with other staining methods (e.g., the color purple in granules may not look purplish). However, domain adaptation could mitigate these distributional shifts. Creating a similar dataset with other staining methods is future work.
This project is supported by the Sysmex Corporation. We thank Mari Kono and Joao Nunes for helpful discussion. The research was carried out at the ROSE Lab at the Nanyang Technological University, Singapore. We thank Siyuan Yang, Takuma Yagi, and Lalithkumar Seenivasan for their valuable feedback on the manuscript. We also thank anonymous reviewers for their constructive suggestions. The computational work for this article was partially performed on resources of the National Supercomputing Centre (NSCC), Singapore (NSCC project ID: 12003626).
[59] John-William Sidhom, Ingharan J Siddarthan, Bo-Shiun Lai, Adam Luo, Bryan C Hambley, Jennifer Bynum, Amy S Duffield, Michael B Streiff, Alison R Moliterno, Philip Imus, et al. Deep learning for diagnosis of acute promyelocytic leukemia via recognition of genomically imprinted morphologic features. NPJ Precision Oncology, 5(1):38, 2021.
[60] Ping Wang, Zhonghui Tang, Byoungkoo Lee, Jacqueline Jufen Zhu, Liuyang Cai, Przemyslaw Szalaj, Simon Zhongyuan Tian, Meizhen Zheng, Dariusz Plewczynski, Xiaoan Ruan, et al. Chromatin topology reorganization and transcription repression by pml-rarα in acute promyeloid leukemia. Genome Biology, 21(1):1-21, 2020.
[61] Danielle Sainty, Vincenzo Liso, Angelo Cantu-Rajnoldi, David Head, Marie-Joelle Mozziconacci, Christine Arnoulet, Laurence Benattar, Susanna Fenu, Marco Mancini, Eliane Duchayne, et al. A new morphologic classification system for acute promyelocytic leukemia distinguishes cases with underlying plzf/rara gene rearrangements. Blood, The Journal of the American Society of Hematology, 96(4):1287-1296, 2000.
7.1 Broader Impacts
Our study was exempt from institutional IRB approval as we added labels to publicly available data. We do not foresee immediate ethical concerns in our dataset as we annotate well-anonymized public data and rely on medical literature for attribute definitions. However, we acknowledge that every dataset is inevitably influenced by the potentially biased values of its creators. While the bias may be less significant in white blood cells compared to domains such as aesthetics [22], face [54], or skin [56], we remain committed to addressing any ethical concerns that may arise in the future.
7.2 Dataset Files
Our dataset consists of three csv files, which are hosted at https://github.com/apple2373/wbcatt/tree/main/submission. Moreover, the files are small enough to be permanently hosted on the NeurIPS website as supplementary material. This ensures long-term accessibility and backup. The three files of pbc_attr_v1_train.csv, pbc_attr_v1_val.csv, and pbc_attr_v1_test.csv contain attribute annotations for the train/val/test splits.
- cell_size, cell_shape, nucleus_shape, nuclearCytoplasmic_ratio, chromatin_density, cytoplasm_vacuole, cytoplasm_texture, cytoplasm Colour, granule_type, granule Colour, and granularity: Attribute columns. We annotated them, which is the main contribution of this paper.
- label: One of the five WBC types (neutrophils, eosinophils, basophils, monocytes, and lymphocytes) provided by the PBC dataset.
- img_name: This is the image file name. It can serve as a unique identifier.
- path: Image path organized by the PBC dataset.
For images, please download from the PBC dataset: https://data.mendeley.com/datasets/snkd93bnjr/1
7.3 License
Our dataset is under the MIT license.
7.4 Details of Attribute Prediction in Section 4
7.4.1 Model Details
Let  $M$  denote the attribute prediction model,  $I$  for the input image, and  $A$  for the predicted attributes. The model  $M$  consists of an image encoder  $E$  and an attribute predictor  $P$ .
The image encoder  $E$  (for example, ResNet) processes the input image  $I$  and generates the feature vector  $F$ :
$$
F = E (I)
$$
The attribute predictor  $P$  is comprised of several attribute predictors  $P_{i i = 1}^{n}$ , each being a fully-connected layer tasked with predicting the  $i$ -th attribute. Each attribute predictor  $P_{i}$  accepts the image features  $F$  as input and outputs the predicted distribution  $A_{i}$  for each attribute:
$$
A _ {i} = P _ {i} (F)
$$
The predicted attributes  $A$  collate all the predicted attribute distributions  $A_{i i=1}^{n}$ , serving as the predicted attributes for the input image  $I$ :
$$
A = \left[ A _ {1}, A _ {2}, \dots , A _ {n} \right]
$$
The overall prediction of the attribute prediction model  $M$  for the input image  $I$  can be expressed as:
$$
A = M (I) = P \left(E (I)\right),
$$
Figure 9: The architecture of the attribute prediction model. The model accepts an input image, which is processed by an image encoder  $E$  to yield a feature vector. This vector is then processed by multi-task attribute predictors  $\{P_i\}_{i=1}^n$  to produce predicted attribute distributions  $\{A_i\}_{i=1}^n$ .
where  $P = [P_{1}, P_{2}, \ldots, P_{n}]$  represents the composition of the attribute predictors.
The architecture of this model is illustrated in Figure 9. Training this network inherently involves multi-task learning, where each task is to predict a specific attribute. The model takes an input image, which is processed by a shared image encoder to yield a feature vector. This feature vector is then utilized by several attribute predictors  $P_{i_i = 1}^n$ , each responsible for generating predicted attribute distributions  $A_{i_i = 1}^n$ .
7.4.2 Implementation Details
We use the Adam optimizer with a learning rate of 0.0001, a weight decay of 0.01, and a batch size of 128. We train the model for 30 epochs, selecting the best-performing model based on the validation set, and evaluate its performance using the test set. The PyTorch code for this model is available in attribute_prediction.py, which contains the implementation of the AttributePredictor class. The code to execute the experiment is traineval.py.
7.4.3 More Baselines
The main paper presents results utilizing the backbone of ResNet50 [62], which is one of the most frequently used image classifiers and has been reported as having received the highest number of citations in the field of artificial intelligence [63]. As mentioned in the main paper, we have intentionally kept the model simple. We believe that reporting results with this widely used backbone is beneficial as it provides a solid foundation for future work. However, in Table 6, we also have results from other backbones such as VGG16 [64], ViT-Base/16 [65], and ConvNeXt-Tiny [66].
7.5 Annotation Process and Quality Control
We used Label Studio [67] (see Figure 10) as the annotation tool. To ensure the accuracy and reliability of the annotations in our dataset, we implemented a comprehensive quality control process. This involved multiple steps and the participation of domain experts. The following sections outline the key aspects of our annotation quality control.
(i) Recruiting Qualified Annotators. We called for students majoring in biomedical sciences who claimed to have a basic knowledge of WBCs. We requested each of them to provide a short description of the five types of WBCs to ensure that they possessed the required foundational knowledge. We invited those who provided satisfactory answers to an information session, where we clearly explained the morphological attributes using materials similar to those presented in the main paper (Sec. 3.1 - Sec. 3.4) and Figure 2. We then recruited them to perform a pilot annotation of 100 images (see next).
(ii) Pilot Annotation. After the aforementioned screening process, we instructed each candidate to independently annotate a randomly selected subset of the same 100 images. We intentionally used the same images to evaluate their understanding and enable comparisons among the candidates. We acknowledge that the candidates annotated the images while being aware of the cell type. This was a necessary compromise we made by involving medical students instead of hiring pathologists due to cost limitations. The cell types in the PBC dataset had already been verified by pathologists, and this knowledge aided the students in producing higher-quality annotations. For instance, they could
Figure 10: The screenshot of Label Studio, the labeling tool used to annotate the WBCAtt dataset. Annotators can determine the cell type from the name associated with the cell, which is provided before image selection. The image to be annotated is presented in a clear and organized manner, enabling annotators to easily navigate and zoom in on the image. Attribute selections are organized using radio buttons, ensuring that only one choice can be selected at a time. All attributes must be selected before submitting and proceeding to the next image.
utilize the cell type as prior knowledge, such as understanding that lymphocytes from healthy patients should not possess a multi-lobed nucleus.
(iii) Annotation Phase 1 and Feedback. Based on their performance on the pilot annotation, we selected the students and assigned them 200 images for what we refer to as Phase 1. In this phase, each student annotated a unique set of images, with allocation decisions taking into account their individual strengths. For instance, if a student demonstrated superior proficiency in annotating neutrophils compared to other cell types, we allocated a higher number of neutrophil images to that student. Subsequently, we conducted a thorough review of the annotations, providing specific feedback and updating our attribute descriptions to improve clarity.
(iv) Annotation Phase 2 with Regular Discussions. After completing Phase 1, we allocated the remaining images to the annotators and encouraged them to report any uncertain cases for further discussion. In cases of ambiguity, we discussed with the pathologists who defined the attributes with us, ultimately reaching a consensus. These discussions and consensus-building efforts were instrumental in ensuring the consistency and high-quality of the annotations.
(v) Review and Validation. Upon completion of Phase 2, our research scientists, who were not directly involved in the annotation process, meticulously reviewed and validated all annotations for correctness and adherence to the attribute definition. This means that each image in our dataset is reviewed at least by two individuals. We corrected errors or inconsistencies through this refinement process, thereby enhancing the quality and accuracy of the annotations.
(vi) Reliability Analysis. To assess the reliability of our annotations, we randomly selected a subset of 1,000 images, and replicated our annotation process with different annotators. Out of the  $11,000 (= 11 \times 1,000)$  attribute annotations, 10,569 were consistent with the original annotations, resulting in an agreement rate of approximately  $96.1\%$ . Details of the per-cell agreement rate and the per-attribute agreement rate are also tabulated in Figure 11. This high agreement demonstrates the reliability and robustness of the annotations.
7.6 Case Studies of Attribute Prediction
As mentioned in the main paper, we examine specific prediction results, both correct and incorrect ones, produced by our attribute prediction model. We use Grad-CAM to highlight the areas the model
Figure 11: The inter-annotator agreement on a random sample of 1000 images from the WBCAt dataset. Approximately  $96.1\%$  of the annotations showed consistency between the original annotations and the re-annotations by different annotators. The last column represents the per-cell agreement rate, while the last row corresponds to the per-attribute agreement rate.
focuses on. In this appendix, we present additional cases that were not included in the main paper due to space limitations.
7.6.1 Successful Cases on Our Dataset
When the model correctly predicted attributes, we expect that the Grad-CAM heatmap will emphasize the cell structure in line with the attribute definition. For instance, if the model is predicting the nucleus shape, it should highlight the nucleus prominently. Figure 12 shows two examples of successful attribute predictions with Grad-CAM heatmaps. In these instances, the model effectively localizes the attributes. The Grad-CAM heatmaps focus on the cell edges when predicting cell shape and cell size, as shown in Figure 12-(b), (c), (i), and (j). At times, the localization is extremely precise. Particularly, for the nucleus-shape prediction in Figure 12-(d), the Grad-CAM heatmap accurately marks the thin filament of the nucleus, which serves as a key determinant for segmented nucleus identification. Moreover, the Grad-CAM can localize the cytoplasm-vacuole, as shown in Figure 12-(m), and highlight the cytoplasmic area during the prediction of cytoplasm color, as depicted in Figure 12-(n).
7.6.2 Failure Cases on Our Dataset
Subsequently, we investigate the cases where the model incorrectly predicted the attributes. We expect the Grad-CAM heatmaps to indicate the reasons behind the model's failures. After manually examining multiple instances of failed predictions, we have identified the following potential factors contributing to incorrect predictions:
(i) Presence of Two Cells in an Image. The existence of multiple distinct cell types within an image can present a challenge for the attribute predictor. Given that attributes are highly specific to different cell types, this situation can cause confusion during attribute prediction. For example, in Figure 13-(i)(a), both a neutrophil and a lymphocyte are present in the same image. The lymphocyte is considered the ground truth for the cell type in this image, as annotated by the creator of the PBC dataset (not by us), primarily because the lymphocyte occupies a more central position. Consequently, our attribute annotations are based on the lymphocyte rather than the neutrophil. During attribute prediction, even though the Grad-CAM heatmaps focus on the lymphocyte when predicting cell-shape (Figure 13-(i)(b)) and cell-size (Figure 13-(i)(c)), the attribute predictor looks at the neutrophil when predicting other attributes such as granularity (Figure 13-(i)(e)), granule color (Figure 13-(i)(f)), and granule type (Figure 13-(i)(g)). These attributes related to granules are typically not triggered for lymphocytes in most cases, resulting in incorrect predictions.
Figure 12: Grad-CAM heatmaps of accurate attribute predictions for a neutrophil ((a)-(g)) and a monocyte ((h)-(n)). Among the 11 attributes, we have selected six attributes that effectively differentiate between the respective cell types (neutrophil and monocyte).
(ii) Broken Cell vs (iii) Leaked Cellular Substances. Sometimes the structure of cell is broken. Figure 13-(ii) shows an broken cell where the cell membrane is unrecognizable, thus making the cell-shape irregular, which is correctly predicted. On the other hand, Figure 13-(iii) illustrates an oval-shaped basophil surrounded by some cellular substances. Despite the presence of these substances, since its cell membrane remains clearly distinguishable, we annotated as having a round cell shape. However, the Grad-CAM heatmap reveals that the substances outside the cell are interpreted as the cell boundary, leading to an incorrect prediction of an irregular cell shape for this basophil.
(iv) Overlooking WBC. We have observed instances where the WBC is overlooked, and the Grad-CAM heatmap highlights the red blood cell (RBC) instead, as depicted in Figure 13-(iv). Consequently, this leads to incorrect predictions, particularly when estimating cell size since RBCs generally have smaller sizes compared to WBCs.
7.7 Towards Broader Applicability