Detecting Covid-19 from Chest X-ray using Transfer Learning

DOI : 10.17577/IJERTV11IS080006

Download Full-Text PDF Cite this Publication

Text Only Version

Detecting Covid-19 from Chest X-ray using Transfer Learning

Ms. N. Sandhya Rani

Assistant Professor, Dept. of CSE MLR Institute of Technology Hyderabad, Telangana, India

Dhoma Harshavardhan Reddy

UG Student, Dept. of CSE MLR Institute of Technology Hyderabad, Telangana, India

Abstract- The novel Coronavirus has been the most harmful disaster that nobody could have ever imagined. Currently it has become a fatal epidemic, citing fears concerning the health infrastructural facilities on the market, considering the need to take a look at a vast population. The foremost common diagnostic tests available as of now are Reverse Transcription-Polymerase Chain Reaction (RT-PCR) and Rapid Antigen Testing (RAT), which is usually preferred to acquire the results in a quick span of time. However, there are some drawbacks to RT-PCR testing and RAT testing, like relying only on these 2 ways might be challenging and it becomes increasingly tough for many nations to get the requisite number of testing kits, and there are some occurrences of false-positive results. Chest X-rays, additionally to RT-PCR testing, will be a helpful technique for containing the spread of COVID, as patients can receive the results quickly and take required measures. The tensor flow-based CNN method has been projected to classify chest x-ray images. The projected model has been trained and tested on the ready dataset consequently, a viable answer has been presented, that is that the development of a COVID-19 detection system that might assist medical specialists with the reports and then the consultants will come back to a call. Within the medical field, transfer learning has established to be the foremost economical technology and has excelled within the field of image processing, which makes it the more effective approach for our use case.

Keywords- Covid-19; Chest X-ray; tensor flow; transfer learning; CNN (Convolutional Neural Network); image processing.


    In China, a natural viral infection originating from associate degree anonymous supply erupted in 2019. More than a hundred and twenty million cases are confirmed worldwide to date, with the quantity continued to grow. Individuals with underlying medical conditions like polygenic disease, cancer, cardiovascular unwellness, and chronic preventive respiratory organ disease area unit a lot of liable to expertise severe symptoms. It typically takes five to six days for the initial symptoms to manifest within his or her body. With a small headache, some individuals will even go months while not experiencing any symptoms. The virus's long period of time and asymptomatic cases build detection, tracking, and containment a troublesome task. what is more, respiratory illness is one of those metastasis infections that incorporates a high propensity for affecting human lungs particularly. in an exceedingly typical scenario, the alveoli within the lungs area unit stuffed with atomic number 8 whenever someone breathes. However, within the case of someone infected with respiratory illness, the alveoli area unit stuffed with blood and

    pus. At present, the COVID-19 test outcomes take around more than twenty-four hours to detect the presence of the infection. This can be extraordinarily distressing for anyone, and that they could have symptoms like fever, exhaustion, and issue breathing. each of those disorders have identical symptoms, making detection troublesome. As a result, the SARS-CoV-2 virus should be detected exactly. As there are not any particular drugs obtainable, early diagnosis of COVID-19 infection and isolation of infected patients are critical. In distinction to RT-PCR, Chest X-rays area unit so a reliable and quicker approach for COVID-19 identification and assessment, particularly in epidemic areas. Chest X-Ray Screening is out there in the majority hospitals; thence these images is COVID-19 patients were first identified using this method.

    As a result, chest X-ray image analysis is helpful in saving the medical specialists valuable time. In the medical field, transfer learning has proved to be the most efficient technology. It is a quick and accurate way of determining the treatment strategy for various diseases. Currently, a range of machine learning methodologies is in use to image analysis, cancer detection, and a range of other applications can be used to detect heart irregularities and brain tumours. It's also utilised to tell the difference between COVID-19 infected and uninfected people and those who arent infected with COVID-

    19. Deep learning has altered our perceptions about artificial intelligence and how we use data. Deep learning is named for the fact that the networks include multiple layers and a large

    number of trainable parameters. ConvNet is another term for this. It mostly aids in the processing of data that has a whole grid structure, such as a picture. Pixels are organized in a lattice framework to create images, and every grid has a completely unique cost that represents the brightness and hue of every pixel. As each neuron functions in its region of receptivity, the human brain can grasp information from images. The perceptual system field is encompassed by the central nervous system with a network of numerous neurons. CNN's can interpret data in their receptive fields in a similar way.


    For categorization, Sethy and Behera utilised a Support Vector Machine, a supervised learning model (SVM). They looked at AlexNet, Inceptionv3, ResNet101, and VGG19, as well as eleven different pre-trained neural networks.

    They created an AI-based identification model for COVID-19 detection from CT images using the dataset. Gozes et al. developed an AI-based automated CT image processing technique for coronavirus discovery, quantitative determination, and monitoring on a testing set of 168 non- native patients.

    Asymmetric and periphery ground-glass and collaborative and interactive pulmonic opacities were found on CT scan images as markers of COVID-19 infection. Zhao et al. prepared the open-source COVID-CT is a dataset comprising 376 COVID- 19 CT images from 219 patients and 471 images of patients who were not prone to COVID-19, because getting datasets connected with COVID-19 is difficult.

    Xu et al. mention in their study that Computed tomography of Covid-19 have properties that distinguish them from other types of respiratory organ illnesses such as respiratory problem. They used 619 CT images to strengthen their understanding, and the accuracy was around 89.7%. ResNet was employed as an associate design by the writers of this paper. Several investigations and analyses involving deep learning are being carried out in the field of diagnostic imaging, such as X-raying (CT) scans.

    At the CT level, RADnet has an accuracy of 81.82 percent in predicting haemorrhage. Song et al. developed three forms of deep neural networks available named CNN, DNN, and SAE for the process of calcification of respiratory organ cancer. "COVID-net: a specialized deep convolutional approach for recognition of COVID-19 patients from chest X-ray photos," Scientific Papers, vol. 10; L. Wang, Z. Lin, and A. Wang.


    There are a variety of techniques in the field of machine learning obtainable for recognizing COVID-19 at the instant, however all of them have their own set of limitations. as an example, with the assistance of DeepNet, the accuracy computed was moderately less and the heatmap generation and have extraction phases of the algorithms had some flaws. whereas extracting the options during the initial hases, the model couldnt establish the RGB pattern of the input pictures.


    Our proposed solution is based on the well-known pre-trained decilitre model (VGG-16). Because of two factors, we prefer to employ the VGG-16 model. To begin, it extracts the choices

    at a basic level by exploiting its smaller kernel size, which is suitable for Chest X-ray images with a limited number of layers. Second, it has a more powerful feature extraction capability for COVID-19 X-Ray image categorization. One of the transfer learning strategies we use is a fine-tuning approach. We usually utilise ImageNet's pre-trained weight to figure with the VGG-16 model for the finetuning approach. Because we only have a limited number of COVID-19 Chest X-Ray images for training purposes, it helps to overcome the over-fitting issue. Convolution component, FC-layers, and SoftMax classifiers are the three primary building pieces of our proposed methodology. Figure 2 depicts a generic diagram of the suggested model. Within the following subsections, we usually justify each building block. The overall block diagram of the proposed model.

  5. IMPLEMENTATION Implementation Modules:

    1. Dataset creation: Since this is the initial step in applying transfer learning, typically, we begin by prepping the dataset. When COVID19 attacks the epithelial cells that line the airways, chest x-rays are usually used to assess the patient's respiratory health. To improve the classification model 3 provided, we are using chest x-rays instead of computer image scans. X-rays are less costly, efficient, and provide patients small concentrations than higher radiation exposure CT scans. Furthermore, mobile x-ray appliances are frequently examined in isolation rooms, lowering the danger of pathogenic bacteria and the need for PPE.

    2. Data Augmentation: Transfer learning models can require a large amount of coaching information. Image magnifying technology is widely used in PC vision and has been the focus, transfer learning has received considerable attention since its inception. The more data you have, the better the performance of your model. Also, COVID19 remains an emerging infectious disease, so no suitable dataset has been published at this time. As a result, Information Extension can be a highly powerful technique for creating bigger datasets artificially, and it should be used. We tend to use three advanced strategies: random rotation, random noise, and horizontal inversion (invert the rows of pixels).

    3. Data Pre-processing: Information pre-processing, it is possible to resize the X-ray pictures. It's as a result of the assorted algorithms need totally different image inputs. The photos should be flattened according to the model specifications. The actual dimensions of the input images were varied, but they were all sorted and made uniform by adjusting the scaling to 224×224 pixels.

    4. Feature Extraction: Once information pre-processing, the options are extracted. White shaded regions depict the region of the lungs wherever the sacs area unit crammed with pus and supported the generated options the photographs area unit additional passed onto the subsequent stages.

  6. MODEL

    Three varieties of layers form up the CNN which are names as the convolutional layers, pooling layers, and fully-connected (FC) layers. Additionally, to those 3 layers, there are an additional parameter that are the dropout layer and the activation operational layer.

      1. Convolution Layer: This layer is the first and foremost layer which is used to garner wide range of features from the feeded images. The produced outcome is called as feature map that provides the essential data info about the feature map related to the image, such as vertices and the image borders. This feature map is then passed to alternate steps to explore multiple alternative options of the input image.

      2. Pooling Layer:

        The main goal of this layer is to reduce the length of the feature map which is the output of convolution layer, to reduce the total price of the procedure.

      3. Fully Connected Layer

        The Total Connectivity (TC) layer includes weights and offsets as well as neurons and majorly utilized to attach neurons within 2 completely different layers. These given layers are frequently placed well before output neuron and make up most of the other CNN's initial layers.

      4. Dropout Layer

        A dropout layer is employed whereby many neurons are dropped from the neural network throughout the coaching method which results in a reduced size of the model. After trying to pass a dropout of 3/10th, the neural network randomly produces a mid of connections.

      5. Activation Function


        1. Dataset Description

          For our dataset, we used Kaggle, where we found high resolution images which were needed for our project. This info had 150 Chest X-ray pictures at the time we tend to ready our dataset. Out of those, forty-three were found to be feminine and eighty-two were male. For our training purpose, we've got taken 150 pictures, out of which we've got set to require 50 images as positive covid, 50 pictures as Viral Pneumonia, and another 50 pictures as normal. The figure below shows sample image dataset.

        2. The Planned Model

          The figure shows a thorough demonstration of the flowchart setup which was proposed for Covid detection.

        3. Proposed Model

          VGG16 is a simple and widely used convolutional neural network (CNN) design used for ImageNet, a large visual information project used to analyse visual object recognition software packages. The design of the VGG16 was developed and introduced in 2014 by Karenic Simonyan. "VGG" stands for Visual Pure Mathematics Cluster, which

          may be the cluster of research panel at Oxford University who developed this design named the model as VGG16, as it a 16 layered model.

          The VGG16 model won 92.7% of the top five. Check the accuracy of ImageNet. This is a dataset of over 1.4 million images in 900 categories. In 2014, one of the most well-known simulations was published to the ImageNet Massive Scale Visual Recognition Challenge (ILSVRC). During coaching, the input to the convnet can be a fixed size 224x224RGB image. The only pre-processing done here is to subtract the average RGB values calculated by the coaching set from each element.

          There are three Fully Connected (FC) layer units that follow the convolutional layer stack: the primary 2 each has 4096 channels and the third has a 1000-way ILSVRC classification. 1000 channels to carry (one per class). The final layer of the model is the soft-max classifier which is used to calculate the model's probabilistic classification. The structure of fully connected layers is the same for the entire network.

        4. Performance Metrics

          -Accuracy = (TP+TN)/(TP+TN+FP+FN)



          -Precision = TP/(TP+FP)

          True (+) and True (-) values are denoted by TP and TN, respectively, whereas False (+) and False (-) values are denoted by FP and FN, respectively.

        5. Expected Graphs

        6. VGG16 Model Accuracy

        7. Epochs vs. Training and Validation Accuracy/Loss

  8. SYSTEM REQUIREMENTS Hardware Requirements:

    -System: Intel core i5

    -Hard Disk: 1TB

    -Input Devices: Keyboard, Mouse.

    -Ram Storage: 8 Gigabytes.

    -GPU: 4 Gigabytes Software Requirements:

    -Operating System: Windows 10

    -Coding Language: Python


    The project was carried out using Google Colab. After developing the model, we run two files named Image Classification and Web app which are saved under python notebook extension. After executing the code i.e., Web app. ipynb file, we connect to our google drive account and run each and every section o the code, at the end of the code we pass on a command, which is used to display the output. Here we use streamlit, which is an open-source ML interface for projecting the project outputs. We connect to a random tunnel for projecting the user interface screen, these tunnels are created when the streamlit code is in run mode.


    As mentioned earlier, early prognosis and diagnosis of COVID (19) using deep learning methodologies with minimal capital and complications is the most important step in averting disease progression and pandemics. By integrating deep learning algorithms into radiation centre equipment, it will be easier to manifest and diagnose the disease a bit faster, at low cost and secured in the near future. Using these strategies for rapid diagnostic strategy-making in COVID 19 will be a valuable tool for radiologists to reduce manual error and provide help in decision-making during critical situations and peak illnesses. In the future, these models will need to be trained and validated on aggrandised, heterogeneously mixtured datasets to occupy the entire available data info space.


[1] J. Ker, L. Wang, J. Rao, and T. Lim, Deep Learning Applications in Medical Image Analysis, IEEE Access, vol. 6, pp. 93759389, 2018, DOI: 10.1109/ACCESS.2017.2788044.

[2] Hussin A.Rothan and Siddappa N.Byrareddy, The epidemiology and pathological process of coronavirus sickness (COVID-19) eruption, Journal of pathology, Volume 109, May 2020, 102433,

[3] Kai Liu, Ying Chen, Ruzheng sculptor, Kunyuan Han, Clinical options of COVID-19 in aged patients: A comparison with young and old patients, Journal of Infection, offered on-line twenty seven March 2020, In Press,

[4] E. E.-D. Hemdan, M. A. Shouman, and M. E. Karar, COVIDX-Net: A Framework of Deep Learning Classifiers to Diagnose COVID-19 in XRay pictures, Mar.2020.

[5] Yi-Wei Tang, Jonathan E. Schmitz, David H. Persing, Charles W. Stratton, The Laboratory identification of COVID-19 Infection: Current problems and Challenges, Journal of Clinical biology April 2020, JCM.00512-20; DOI: ten.1128/JCM.00512-20.

[6] K. He, X. Zhang, S. Ren, and J. Sun, Deep Residual Learning for Image Recognition, in 2016 IEEE Conference on pc Vision and Pattern Recognition (CVPR), Jun. 2016, pp. 770778, DOI: 10.1109/CVPR.2016.90.

[7] Wang L, Wong A. (2020), COVID-Net: A Tailored Deep Convolutional Neural Network style for Detection of COVID-19 Cases from Chest Radiography Images; arXiv: 2003.09871.

[8] Li et al. (2020), computing distinguishes COVID-19 from community-acquired respiratory illness on chest CT. RSNA Radiology, Department of Radiology.