In [1]:
from fastai2.vision.all import *
from fastai2.vision.widgets import *

Deep Learning tool for diagnosis and prognosis Covid-19

This is a quick prototype developed for Lumiata Covid-19 Global AI hackathon event.This application loads the trained deep learning model and classifies the uploaded chest X-ray into any of the following category

  • Covid-19
  • Normal
  • Pneumonia

Data

Model trained on: (Latest data added on April 23, 2020)

  • Covid-19 X-ray data: 337 images
  • Normal Chest X-ray : 333 images
  • Pneumonia Chest X-ray: 328 images

Motivation

When businesses reopen, we need a effective way to test masses. We need a tool to identiy covid-19 symptoms that is cheap, fast,easy to scale, and use existing infrastructure. Also after a successful diagnosis, we need to answer additional questions like:

  • Could this patient stay at home or need an ICU?
  • If a patient needs an ICU, in how many days?
  • What is the survival rate of this patient?
  • How he is going to respond to some particular treatment?

Currently, our team is focused on building a diagnosis tool, and we are working on answering the above questions and add these additional features in our tool. In medical AI tools, it's important to be transparent about the model error metrics, data collection, peer review, and clinical study. We will be releasing these details along with our product.

Model Demo

In [2]:
from fastai2 import __version__
In [3]:
path = Path()
In [4]:
learn_inf = load_learner(path/'export.pkl', cpu=True)
In [5]:
btn_upload = widgets.FileUpload()
out_pl = widgets.Output()
lbl_pred = widgets.Label()
btn_run = widgets.Button(description='Analyse')
In [6]:
def on_click_classify(change):
    img = PILImage.create(btn_upload.data[-1])
    out_pl.clear_output()
    with out_pl: display(img.to_thumb(128,128))
    pred,pred_idx,probs = learn_inf.predict(img)
    lbl_pred.value = f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}'
btn_run.on_click(on_click_classify)
In [7]:
display(VBox([widgets.Label('Select your X-ray'), btn_upload,  btn_run, out_pl, lbl_pred]))

About the model

The deep learning model was developed using fastai framework and deployed using voila and render.

Training data sample

m

Model Metrics

m m

Model Interpretation (Explainability)

In applications like using AI in medicine, it's highly important to understand the reason behind a model prediction. For this explainability, we have started with coloring the area where our model focuses more for making some prediction. In future, we are planning to combine this with natural language processing to generate more reasoning behind our model predictions

m

Acknowledgments

We would like to thank the dataset providers (cited above) for making the dataset available for public access, also thank you Jeremy Howard and Team for creating fastai and making it accessible to everyone. Finally, we would like to thank the hackathon mentors and organisers for giving us an opportunity to contribute something to a big global cause.