Skip to content

White blood cell image classification using deep transfer learning

License

Notifications You must be signed in to change notification settings

yixiangD/few-shot-wbc-classification

Repository files navigation

Deep learning model for WBC image classification

Repository for paper

@article{deng2023deep,
  title={Deep learning for few-shot white blood cell image classification and feature learning},
  author={Deng, Yixiang and Li, He},
  journal={Computer Methods in Biomechanics and Biomedical Engineering: Imaging \& Visualization},
  pages={1--11},
  year={2023},
  publisher={Taylor \& Francis}
}

If you find this repository helpful, we kindly encourage you to cite our paper listed above.

Please feel free to create issues if you need help running the code. We will try to help you as much as we can.

Preprocess data

Dataset

  1. Dataset used in the paper is publicly available on Github. We also used the labels of WBC class for the same dataset on kaggle, located at dataset-master/dataset-master/labels.csv.
  2. A dataset for microscopic peripheral blood cell images for development of automatic recognition systems a recently published large dataset (optional for testing)
mkdir ./data # at the root
# upzip all_Cell_data-master.zip
mv all_Cell_data-master/ ./data
mv labels.csv ./data

Prepare clearly labeled dataset and generate cropped images

Run the following from the root directory to generate

  • a table recording the image indices with known WBC labels and the cropping coordinates in data/df_coord.csv, note that images with more than two WBCs are excluded,
  • corresponding cropped images in data/all_Cell_data-master/crop*.jpg.
python few_shot_wbc/preprocess.py

The expected cell counts for each class,

Cell type NEUTROPHIL EOSINOPHIL LYMPHOCYTE MONOCYTE BASOPHIL
Cell count 203 83 33 20 3

Spilt images into train and test folder

Here, we create train and test folders for our model. Available arguments:

  • --shuffle, enable image index shuffle,
  • --nfold, int, available choice [5, 10], for 5-fold splitting or 10-fold, default is 5,
  • --num_class, int, available choice [2, 4], for binary classification (lymphocyte or not) or four-class classification (four WBCs excluding basophil, since there is too few of them), default is 2,
  • --crop, if added, use cropped WBC-only images otherwise use the orignal images with RBCs.
python few_shot_wbc/split_images.py

Methodology

CNN Model

Transfer learning with

  • AlexNet
  • VGG19
  • ResNet152
  • DenseNet
  • MobileNetV2
  • ResNext101_32x8d
  • EfficientNet b3

Methods for Data Imbalance

Reference:

About

White blood cell image classification using deep transfer learning

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published