A Deep Learning Approach for COVID-19 Detection and Diagnosis using ResNet Architecture

DOI : 10.17577/IJERTV10IS120062

Download Full-Text PDF Cite this Publication

Text Only Version

A Deep Learning Approach for COVID-19 Detection and Diagnosis using ResNet Architecture

Vishal Rajashekar

Student, Dept. of ECE,

BNMIT, Bangalore

V Manikanta Sanjay

Student, Dept. of CSE,

JSSATE, Bangalore

Sameer A Kyalkond

Student, Dept. of CSE,

JSSATE, Bangalore

AbstractThe year 2020 has been extremely unpleasant for individuals all over the world. The deadly COVID19 pandemic, which was initially reported in December 2019, had wreaked havoc across the globe. For months, the entire world had come to a halt. The global economy has come to a grinding halt. Thousands of individuals worldwide have lost work as a result of downsizing. The largest crisis, however, was in the area of human health. A virus so novel that no one has ever seen or heard of anything like it. Tens of millions of individuals were infected with the Corona Virus, and the virus's death toll of over a million sparked tremendous hysteria among the populace. With virtually no remedy available, isolation was the only option to contain the sickness. However, Real Time testing required a lengthy lead time, which accelerated the spread of the disease. The simplest technique to establish whether a person had been infected with the virus was to analyse a Chest X-Ray for a probable Pneumococcal Infection that met the Covid19 requirements. We developed a model based on Convolutional Neural Networks that analyses X-Rays quickly and determines whether a person is infected with the virus. This method is far faster than the comprehensive testing necessary in the alternative.

KeywordsCOVID-19; CNN; ResNet-18; Diagnosis Report;

  1. INTRODUCTION

    Coronavirus SARS-like severe acute respiratory illness is the hallmark of the coronavirus-caused Coronavirus Disease 2019 (COVID-19) (SARS-CoV-2). It was found in Wuhan, China, in December of this year. An continuous worldwide pandemic has resulted from the spread of the illness since then.

    Fever, cough, headache, tiredness and trouble breathing are all common symptoms of COVID-19. One to fourteen days after virus encounter, symptoms may begin to manifest. At least a third of people who have been afflicted do not show any signs of the illness. More than eighty-one percent of those who show signs of illness enough to be classified as patients have mild to moderate symptoms (up to mild pneumonia), whereas 14 percent have severe symptoms (dyspnea, hypoxia, or imaging findings showing more than fifty percent lung involvement), and five percent have critical symptoms (respiratory failure, shock, or multiorgan dysfunction).

    Through direct contact with virus-infected respiratory droplets and airborne particles, COVID-19 is transmitted. It is possible for these particles to be inhaled or to reach the mouth, nose or eyes by contact or direct deposition (i.e. being coughed on). People in close proximity for a long length of time pose the highest risk of infection, although particles may be breathed across longer distances, particularly in poorly ventilated and congested indoor environments.

    We've all witnessed the devastation caused by Covid19, one of the most catastrophic outbreaks in decades, during the last several months. There is just no justification for this.

    Human health has been negatively impacted by the use of Covid19. Long-term complications, such as diminished brain function, memory loss, and GBS, have been reported by persons who have been affected by tiredness, weakness, and low haemoglobin saturation. Accurate diagnosis of the illness and its impact on the body is the answer to this issue. X-Ray Imaging has shown to be a very effective tool for analysing the human body and its organs throughout the last several decades and into the future.

    Deep learning is an AI function that replicates the data processing and pattern formation processes of the human brain. Deep learning is an AI function. Using neural networks, deep learning is a kind of machine learning in artificial intelligence that is able to learn from data that is unstructured or unlabeled.

    Computer vision, machine vision, speech recognition, natural language processing, audio recognition, machine translation, bioinformatics, drug design, and medical image analysis have all benefitted from the use of deep-learning architectures such as deep neural networks, deep belief networks, recurrent neural networks, and convolutional neural networks.

    In deep learning for visual data analysis, convolutional neural networks (CNNs or ConvNets) are a kind of deep neural network. This kind of artificial neural network is also referred to as a "shift invariant" or "space invariant" artificial neural network because of the common weights it uses and the translation invariance it provides (SIANNs). Images and videos, recommender systems, classification, medical image

    analysis and natural language processing are just a few of the uses for these algorithms.

    Based on well-known pyramidal cell structures in the cerebral cortex, a residual neural network (ResNet) is an artificial neural network (ANN). ReLU between-layer nonlinearities (ReLU) and batch normalisation are used in the construction of typical ResNet models. Gradient disappearance is one of the main reasons for skipping layers. By reusing activations from a preceding layer until the next one learns its weight, this may be done effectively. This layer is amplified during training because the weights adjust to mute the upstream layer.

    Convolutional Neural Network Models (CNNs) are being used to determine whether or not a person has been affected by Covid19. Patients with Covid19 might be diagnosed sooner rather than later thanks to this method. This will also help to separate suspicious patients until a conclusive test can be performed. Consequently, we will be able to restrict the spread of the disease and keep it in check.

  2. LITERATURE SURVEY

    1. Mohd Zulfaezal Che Azemin, Radhiana Hassan, Mohd Izzuddin Mohd Tamrin, and Mohd Adli Md Ali, COVID-19 Deep Learning Prediction Model Using Publicly Available Radiologist-Adjudicated Chest X-Ray Images as Training Data: Preliminary Findings [1]

      The paper details the numerous parameters of a Chest X-Ray and how they assist in its analysis.

      Chest X-Rays have been effective in diagnosing many Pneumococcal infections, including Pneumonia. The recent addition of Covid19 illness has proven to be extremely successful. The factors are highly significant and can quickly indicate whether or not an individual is positive for Covid19 infection.

      Deep learning has the potential to completely change the automated interpretation of chest radiographs. Over 40,000 research publications have been published on the application of deep learning to this subject, which includes the construction of a referent data set, organ segmentation, artefact removal, multilabel classification, data augmentation, and illness severity grading. The critical component of deep learning research is the availability of training and testing data sets, which must be available in order for the research to be reproducible and comparable.

      This study aims to build a deep learning model for COVID-19 case prediction based on an existing pretrained model that was then retrained utilizing adjudicated data to differentiate images with opacity in the airspace, a COVID-19-associated anomaly, as a basis for the machine's predictions.

      In the Figure 1 we can observe a picture which shows the Chest X-Ray of patients affected by COVID19 and how it differs from Normal or Viral Pneumonia X-Ray.

      Fig. 1. A sample dta of matched cases.

      The data set originated at the National Institutes of Health Clinical Center in the United States of America and includes roughly 60% of all frontal chest X-rays performed at the center. The labels were generated as part of a recent Google Health study. The study was prompted by the need for more precise ground truth in chest X-ray diagnosis.

      The study's strength is in its use of adjudicated labels with a strong clinical link to COVID-19 cases and in its training, validation, and testing using mutually exclusive publicly available data. The results reported here are preliminary due to the scarcity of photos used in the testing phase in comparison to the testing set of a known radiography data set, which contains over 1900 images. While deep learning models trained on actual COVID-19 cases can result in improved performance, caution should be exercised when evaluating the performance of deep learning models applied in this context until and unless appropriate data are available to generalize the outcomes of real-world data.

    2. Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun,

    Deep Residual Learning for Image Recognition [2]

    We have learned about the ResNet Network in this paper.

    Deep learning is an artificial intelligence function that mimics the way the human brain processes data in order to detect objects, recognize voice, translate languages, and make judgments.

    Deep Learning Networks are a challenge to train. As a result, we employ a Residual Framework to facilitate the training of networks that are significantly deeper than those previously used.

    The article describes the ResNet Network in detail, as well as how it outperforms a few other similar networks.

    Additionally, we saw how various test cases executed on different layers of the ResNet Network affect the model's accuracy and error percentage.

    Fig. 2. ResNet 18 vs ResNet 50.

    In Figure 2, we can observe how ResNet 18 is better than ResNet 50 in terms of sensitivity, maintaining almost the same specificity.

    Fig. 3. A Sensitivity of ResNet.

    In Figure 3, we can observe how ResNet Network solves the problem of vanishing gradient, which maintains almost the same level of accuracy even as we go deeper.

    When training artificial neural networks using gradient-based learning methods and backpropagation, the vanishing gradient problem occurs. Each time a neural network's weights are updated, the error function's partial derivative with respect to the current weight is taken into account. The issue is that the gradient may be so slight that it effectively prevents the weight from changing its value.

    The ResNet 18 architecture is seen in Figure 4. Residual Network topologies are founded on the premise that instead of learning unreferenced functions, each layer of the network learns residual functions with reference to the layer inputs. Such architectures have been shown to be more efficient at optimising and achieving accuracy. Generally, the ResNet-18 design reflects an advantageous trade-off between depth (i.e., computational time) and performance. As illustrated in Figure 4, the network design consists of five convolutional phases.

    Fig. 4. ResNet 18 Architecture.

  3. OBJECTIVES

    The goal is to come up with a practical solution to the problem by devising a method of diagnosing and treating the person when they are still in the early stages of infection. We will be able to detect the numerous parameters associated with the human lungs of an infected individual as a result of this.

    Aiming to adopt radiography imaging in order to identify the lung function of the patient as well as determine the degree of the infection is an innovative concept. In addition, we are using a Machine Learning Algorithm to figure out the answer to this question.

  4. METHODOLOGY

    The purpose of this research is to determine whether or not a person is infected with Covid19. This is accomplished by acquiring the individual's Chest X-Ray and scanning it for the set of specified parameters. The following step is to incorporate this information into the trained model. The model then takes it in and compares it to a pre-defined Dataset to determine if the individual is Covid19 positive. The model is constructed using Pytorch and the ResNet18 Network. The method entails the addition of several libraries, including torch, torchvision, matplotlib, os, and shutil.

    1. Steps Involved:

      1. Importing Necessary Libraries and Packages: The libraries required for this project as mentioned above which include Torch, Torchvision, NumPy, Matplotlib, OS, Shutil, Random, and Python Image Library (PIL). These libraries are used to perform a set of functions such as creating a custom dataset, data cleaning, data augmentation, data visualization and so on.

      2. Customizing the Dataset for Training and Testing: The Dataset Obtained is a labelled Dataset with the labels Covid- 19, Viral Pneumonia, and Normal. We take this data and classify it into Train and Test Dataset.

      3. Preparing the Dataset using PyTorch: We prepare the Dataset to be fed into the model by using (torch.utils.data.Dataset()) module. Dataset is a class inbuilt to torch.util library which is extended to create a custom dataset of our choice based on certain parameters.

        Fig. 5. Steps involved in Project Implementation

      4. Performing Image Transformation: The Dataset is then subjected to a set of transformations which are required by our model before being fed into the Data-loader. The following transformations are required by the Resnet18 model.

        Size = 224*224

        • Conversion of image to Tensor.

      5. Preparing the Data-loader using PyTorch: We prepare the Data-loader for the Dataset to be fed into the model by using (torch.utils.data.DataLoader()) module by setting the Batch Size as 8. We also shuffle the data so that images of same label are not together.

      6. Visualising the Data under Train and Test set: The data is visualised by using Matplotlib to display the images one batch at a time. The images are also shuffled to create a balance in the dataset.

      7. Importing and Creating the Model: The next step is to import the Resnet18 from Torchvision library which is pretrained on Imagenet.

      8. Training the Model: The model is then trained for the given data using the pretrained Resnet18 model.

      9. Validating and Saving the Trained Model: The model is the validated using the Test Dataset and the parameters such as Validation Loss and Accuracy are determined. This trained Model is then saved.

    2. Training and Validation:

    To train a neural network, an optimization technique is used to determine the optimal set of weights for mapping inputs to outputs. Training neural networks is challenging due to the interdependence of the weights in these intermediate levels. Thus, when a little tug is applied to any of the connections, the effect is felt not just by the neuron being tugged, but also by all the neurons in successive layers, affecting all the outputs. Therefore, it is impossible to obtain the optimal set of weights by optimizing a single weight at a time, but rather by simultaneously exploring the entire space of possible weight groups.

    The last stage is to convert your neural network from a learning to a running state, which is and validate it. Model Validation is the process of comparing a trained model to a test set. The data set used for testing is a subset of the data set used for training. The testing data set is primarily used to evaluate a trained model's generalization capacity.

    Fig. 6. Training and Validation of Model

  5. RESULTS AND INTERPRETATIONS

The model is trained using the Resnet18 model that has been pre-trained on Imagenet. The following findings are achieved for our custom dataset after a single epoch 1850 steps) of training.

  1. Result Obtained For Training Stage:

    The initial step in the Training Phase was to construct a custom Dataset for training and validation. The Validation Dataset was generated by randomly selecting 120 random samples from each label, with both sets mutually exclusive.

    The following stage was to perform the necessary data transformations and enhancements for the ResNet18 model. The Data loader was established with a batch size of eight and prepared to load weight updates into the model.

    Label

    Train Dataset

    Test Dataset

    Normal

    10072

    120

    Viral Pneumonia

    1225

    120

    Covid-19

    3496

    120

    Fig.5 Dataset Distribution.

    Fig.6. Result obtained during Training Stage.

    Finally, the output was fed through a Softmax Filter, and the resulting probabilities were calculated. The model was trained for one epoch, which included 1850 weight updating steps. At the conclusion of Training, the following result was discovered:

    Training Accuracy = 93.7876 %, Training Loss = 0.1708 Validation Accuracy = 97.7778 %, Validation Loss = 0.0447

    Fig.7. Result obtained during Training Stage

    Fig.8. Train Dataset

    Fig.9 Test Dataset

  2. Result Obtained For Validation Stage:

    This stage validated the previously saved model and computed the results. The model previously trained was well- suited for the test dataset, and it achieved a reasonable level of accuracy and loss. The following findings were obtained.

    Fig.10. Result obtained for Validation Stage

    Fig.11. Untrained Model Output

    Fig.12. Pre Trained Model Output.

  3. Results Obtained For Diagnosis Stage:

A diagnosis was developed based on the outcome of the dataset's validation using the pre-trained model. The diagnosis report was created in accordance with current government treatment and precautionary measures.

The diagnosis is made for three different conditions: Normal Pneumonia, Viral Pneumonia, and Covid-19.

Case 1: Normal

When the X-ray is diagnosed as normal, that is, without Covid-19 or viral pneumonitis, the computer prompts the patient to register for the vaccination drive via the "Cowin" portal. When the patient selects "Y," the patient is automatically taken to the "Cowin" website.

Fig.13. Result obtained under Normal Case.

Case 2: Covid-19 Positive

When a patient is diagnosed with Covid-19, the "Ministry of Health and Family Welfare" prescribes treatment and isolation methods. Additionally, the app will ask the patient if they would like a pdf report. The patient will be asked if they like to view surrounding hospitals.

Fig.14. Result obtained for Covid-19 Positive.

Fig.15. Google search to find a Hospital near you.

Fig.16. Covid-19 report sample in PDF format.

Case 3: Viral Pneumonia

When a patient is diagnosed with Viral Pneumonia, the patient has the option of recovering at home or being admitted to a nearby hospital, depending on the severity of the illness. The application would then inquire as to whether the user would like to locate a hospital in the area.

A review of the literature on several current technologies that may be employed for implementation has been conducted. On this basis, the ResNet 18 model was selected for the project's implementation.

The project incorporates the principles of Machine Learning, Convolutional Neural Networks, and Biomedical Signal Processing, as well as the ways in which they may be incorporated into one another.

Chest X-ray analysis has shown to be an excellent method of diagnosing a large number of pneumococcal infections. Among them is Covid19. The conclusion is drawn using a variety of datasets made accessible through a variety of sources. However, owing to severe government regulations, the same is limited and has been considered. There is room for more study and development on the subject.

At the moment, the model is trained only on Covid-19 and Viral Pneumonia strains.

It can be taught in the near future to recognize a greater range of viral illnesses.

The model can only determine if the individual has been infected with the virus, not the severity of the illness. The model may be further enhanced to estimate the severity of the infection via the use of technologies such as Computerized Tomography.

Fig.17. Result obtained when diagnosed with Viral Pneumonia

V. CONCLUSION AND FUTURE WORK

The potential for using modern technology to tackle real- world issues is enormous. Covid19 is an example of a difficulty that nobody anticipated. The purpose of this research is to develop a viable model for successfully detecting and diagnosing Covid19.

REFERENCES

  1. Mohd Zulfaezal Che Azemin, Radhiana Hassan, Mohd Izzuddin Mohd Tamrin, and Mohd Adli Md Ali.: COVID-19 Deep Learning Prediction Model Using Publicly Available Radiologist-Adjudicated Chest X-Ray Images as Training Data: Preliminary Findings, Hindawi International Journal of Biomedical Imaging, Volume 2020, Article 8828855, 18th August 2020.

  2. Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun.: Deep Residual Learning for Image Recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). ISBN:978-1-4673- 8852-8.

  3. Saad Albawi, Tareq Abed Mohammed, Tareq Abed Mohammed: Understanding of a convolutional neural network. 2017 International Conference on Engineering and Technology (ICET). ISBN:978-1- 5386-1950-6.

  4. Arpan Mangal, Surya Kalia, Harish Rajagopal, Krithika Rangarajan, Vinay Namboodiri, Subhashis Banerjee, and Chetan Arora.: CovidAID: COVID-19 Detection Using Chest X-Ray.

Leave a Reply