Git Product home page Git Product logo

covid_detection's Introduction

Covid Detection with X-Ray and PyTorch

Introduction

We will use the COVID-19 Radiography Database to see if we can classify X-Ray images and detect the presence of Covid on them.

The datasets contains auround 3900 images. Among them, 1200 come from COVID-19 positive patients, 1345 from patients suffering viral pneumonia and finally 1341 from healthy people.

We will take ResNet-18 and fine-tune it.

All this will be done using the PyTorch framework.

The Dataset

The dataset consists of 3886 png images.

The resolution is either 1024x1024 and 256x256 pixels.

ResNet-18 expects 224x224 pixels images as input, so we will resize them thanks to torchvision transforms.

X-ray of a Covid-19 positive patient

Resnet-18

ResNet were first introduced in 2015 with this paper by Kaiming He, Xiangyu Zhang, Shaoqing Ren and Jian Sun from Microsoft Research.

It's a Deep Residual Network trained on Imagenet that obtained state-of-the-art performance on image recognitions tasks.

Steps

We will build a dataset class that will, among other things, performs data augmentation thanks to torchvision.transform.

The following steps will be executed:

  • resize to 224x224
  • apply random horizontal flip
  • normalize the data the same way as ImageNet.

We will import the pretrained ResNet model from torchvision. ResNet18 was trained on Imagenet, which has 1000 classes. We only have 3, Normal, viral pneumonia and covid-19.

So we will want to change the last fully connected layer and change it to 3 output features (looking at the last layer, we can see it has out_features=1000)

Cross entropy has been chosen as a loss function and Adam as the optimizer.

Finally we will visualize our results.

Results.

References

COVID-19 Radiography Database (https://arxiv.org/abs/1512.03385)

covid_detection's People

Contributors

pcolonna avatar

Watchers

 avatar

Forkers

saransh2112-cse

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.