Koushik
3 min readNov 2, 2020

--

Blog 2

Detecting COVID-19 with Chest X-Ray

Introduction-

The COVID-19 pandemic is causing a major outbreak in more than 150 countries around the world, having a severe impact on the health and life of many people globally. One of the crucial step in fighting COVID-19 is the ability to detect the infected patients early enough, and put them under special care. Detecting this disease from radiography and radiology images is perhaps one of the fastest ways to diagnose the patients. Some of the early studies showed specific abnormalities in the chest radiograms of patients infected with COVID-19. Inspired by earlier works, we study the application of deep learning models to detect COVID-19 patients from their chest radiography images.

Data collection:

We have acquired the data from kaggle. The data consists of 1700 chest radiography images. It consists of 2 classes Covid and normal images.

Data preprocessing:

In the image preprocessing ,the path of the images is defined. Then the first image from the folder is loaded into the variable ‘image’ by calling the function load_image. The image is then visualized by using matplotlib.imshow. Then the dimensions of the image, the maximum pixel value, and the minimum pixel value in the grayscale bar is printed. Also the mean and standard deviation of the image pixels are calculated.

os.listdir(path) used to load image form specified path, OpenCV is used to read and display an image, random.sample(folder, arg2)(arg2: an integer value, used to load the number of a specified folder)

Splitting the data:

We have split the 20 percentage of data into test data and 80 percentage of data into train data.

We have converted 400 images to 800 using data argumentation. We have resized the images from 1080p to 224p.

We have done hyperparameter tuning for choosing a set of optimal hyperparameters for a learning algorithm.

Then we got a standard model with-

2 convolution layers

1 flatten layer

1 dense layer

Confusion Matrix:

Results:

We have run the data in the standard model which we have obtained from the hyperparameter tuning. We have acquired the accuracy of 93%.So we have considered the model in detecting the covid.

Challenges while preprocessing the image data:

At first we have considered 3 class(covid, normal and pneumonia).But the model was predicting only normal and pneumonia because of data imbalance. As the model couldn’t capture much difference between the covid and pneumonia images as they were almost same. We have tried so many times but we couldn’t solve the data imbalance . So we had to remove the pneumonia class.

--

--