Detecting sickle cells using AI

In this project we worked in a group of 4, we created multiple modals so that we could compare the results of different modals. I was responsible for the Detectron2 modal. This case study shows the journey to getting to the end result.

The goal

We were set out to create an AI that uses object detection to detect sicklecells in microscope images in the different stages of deoxygenating. The primary goal was to create a highly accurate model, we were aiming of an accuracy of around 90%.

Annotating the dataset

The first step we took was to annotate the images that the client had provided us. We made a selection from the images that we had. To ensure that there was no unintentional bias on our end these where random picked using code.

After selecting the images, we annotated the images in Label stadio, which allows us to manually draw bounding boxes around the sickle cells. These annotations can then be used to train and validate the model. In total we annotated around 570 images, each containing several sickle cells.

Converting our annototations to Detectron2

The annotations exported by label studio were not in the correct format for Detectron2 yet, to ensure that the annotations were done correctly we used a python script to load the JSON and convert the data to the correct format for Detectron2.

Optimizing the modal for the highest accuracy

As we wished to gain a very high accuracy, we went through several different itterations of the modal. For this we greatly tweaked the settings of the modal. Until we reached the highest accuracy without the modal becoming overfit.

Showing the annotations the modal made

Since we were creating a medical AI, a high accuracy was the most important part of the AI. Since the AI was primarily aimed at being used for research purposes that can be build upon in future projects. The majority of our time was spend annotating images and optimizing the modal as much as possible.

Beside the accuracy score we also hand validated the annotations by writing code that shows us the annotations the modal has made. Which allowed us to further tweak the modal according to our findings.

The end result

The final produced modal for Dectecton 2 was trained with 420 training images, 50 validation images and 50 test images. In the image to the right you can see the confusion matrix produced for the Detectron2 modal.

The Detectron2 modal had the following results:

  • Accurcy 95.3%

  • F1-Score 85.1%

  • PR-Score 92.3%