Skip to content

UCL/FASt-MAL-MOFF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multiple Instance Learning for Blood Film Microscopy Morphological Analysis

High throughput automated blood film analysis under a brightfield microscope can be a rapid and unified solution to identify blood related disorders, especially in resource constrained settings.The major bottleneck in successfully analyzing blood films with deep learning vision techniquesis a lack of object-level annotations of disease markers such as parasites or abnormal red blood cells. This work proposes a deep learning supervised approach that leverages weak labels readily available from routine clinical microscopy to detect malaria and sickle cells in digital blood film microscopy. This approach is based on aggregating the convolutional features of multiple objects from multiple high resolution image fields.

The idea

MOFF for sickle cell detection in BFS

Getting the data

You can download the images used to train the models here:

Each folder in each dataset represents a sample (xxyyzz-tt-...). Each folder in the TBF dataset contains 100 image fields acquired with a 100x/1.4 NA oil magnification objective. Each folder in the BFS dataset contains 10 to 20 image fields acquired with a 100x/1.4 NA oil magnification objective.
Each dataset contains a file named 'slides_labels.csv' that stores the weak sample level labels. Each row of the csv file looks like: , (0 or 1).

Using the code

White Blood Cell Segmentation

python segment_wbcs.py --dataset_path /path/to/your/dataset/or/downloaded/dataset/ --output_folder /path/to/an/output/destination/ 

This will create a subfolder in the --output_folder corresponding to each of the images existing in the --dataset_path. In each of these subfolders (corresponding to a BFS sample) this script will write images of individual WBCs cropped from the initial image fields.

Red Blood Cell Segmentation

The idea

RBC segmentation

python segment_rbcs.py --dataset_path /path/to/your/dataset/or/downloaded/dataset/ --output_folder /path/to/an/output/destination/ 

This will create a subfolder in the --output_folder corresponding to each of the folders existing in the --dataset_path. In each of these subfolders (corresponding to a BFS sample) this script will write images of individual RBC cropped from the initial image fields.

Malaria Parasite Object Candidate Segmentation

The idea

RBC segmentation

python segment_parasites.py --dataset_path /path/to/your/dataset/or/downloaded/dataset/ --output_folder /path/to/an/output/destination/ 

This will create a subfolder in the --output_folder corresponding to each of the folders existing in the --dataset_path. In each of these subfolders (corresponding to a RBF sample) this script will write images of parasite-like objects cropped from the initial image fields.

Training

The model architecture and code is based on tensorflow-vgg16. We modified a vgg architecture with the convolutional layers pre-trained on the ImageNet dataset.

For Sickle Cell Detection:

python moff_vgg19_sickle.py --dataset /path/to/your/training/segmented/dataset/ --csv_labels /path/to/the/file/containing/the/weak/sample/level/labels --save_dir /path/to/save/trained/model --test_dir /path/to/your/test/segmented/dataset --test_csv_labels /path/to/your/test/weak/labels --output_dir /path/where/you/want/to/save/the/predictions 

For Malaria Detection:

python moff_vgg19_malaria.py --dataset /path/to/your/training/segmented/dataset/ --csv_labels /path/to/the/file/containing/the/weak/sample/level/labels --save_dir /path/to/save/trained/model --test_dir /path/to/your/test/segmented/dataset --test_csv_labels /path/to/your/test/weak/labels --output_dir /path/where/you/want/to/save/the/predictions 

There is not a significant difference between the two scripts. There are some specific parameters hard coded for each case.

Trained models

The malaria MOFF trained model: https://drive.google.com/file/d/1f8v0-EX0xVwiGnKhvD0d-UJ8Z6SUjkjv/view?usp=share_link

Lymphoblast Detection Test

Once a model is trained on the ALL vs Normal weak labels, it can be used to identify individual blast cells in image fields:

python moff_test_detect_blast.py --fov ../test/Im024_1.jpg --trained_model /path/to/your/trained/model --output_dir ../output_test

WBC detection

Lymphoblast detection in BFS using MILCA

Sickle Cell Detection Test

Once a model is trained on the SCD weak labels, it can be used to identify individual abnormal sickle cells in image fields:

python moff_test_detect_sickle.py --fov ../test/pos008_EDOF_RGB.tiff --trained_model /path/to/your/trained/model --output_dir ../output_test

Output the test image fields:

RBC detection

Individual abdnormal Sickle Cell detection in BFS using MILCA

Malaria Parasite Detection Test

Same approach works for Malaria Parasites detection.

python moff_test_detect_parasites.py --fov ../test/FieldPos009_EDOF_RGB.tiff --trained_model /path/to/your/trained/model --output_dir ../output_test

Output the test image fields:

RBC detection

Individual P.Falciparum parasite detection in TBF with MILCA

System Requirements

  • Python3.6
  • Numpy
  • OpenCV
  • scikit-image
  • tensorflow 1.3

About

Multiple Object Feature Fusion for weakly supervised deep learning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages