UCLA Electronic Theses and Dissertations
Total Page:16
File Type:pdf, Size:1020Kb
UCLA UCLA Electronic Theses and Dissertations Title Detecting Coronavirus Disease 2019 Pneumonia in Chest X-Ray Images Using Deep Learning Permalink https://escholarship.org/uc/item/7355g8v8 Author Zhu, Ziqi Publication Date 2020 Peer reviewed|Thesis/dissertation eScholarship.org Powered by the California Digital Library University of California UNIVERSITY OF CALIFORNIA Los Angeles Detecting Coronavirus Disease 2019 Pneumonia in Chest X-Ray Images Using Deep Learning A thesis submitted in partial satisfaction of the requirements for the degree Master of Science in Statistics by Ziqi Zhu 2020 c Copyright by Ziqi Zhu 2020 ABSTRACT OF THE THESIS Detecting Coronavirus Disease 2019 Pneumonia in Chest X-Ray Images Using Deep Learning by Ziqi Zhu Master of Science in Statistics University of California, Los Angeles, 2020 Professor Yingnian Wu, Chair The coronavirus disease 2019 (COVID-19) pandemic has already become a global threat. To fight against COVID-19, effective and fast screening methods are needed. This study focuses on leveraging deep learning techniques to automatically detect COVID-19 pneumonia in chest X-ray images. Two models are trained based on transfer learning and residual neural network. The first one is a binary classifier that separates COVID-19 pneumonia and non-COVID-19 cases. It classifies all test cases correctly. The second one is a four-class classifier that distinguishes COVID-19 pneumonia, viral pneumonia, bacterial pneumonia and normal cases. It reaches an average accuracy, precision, sensitivity, specificity, and F1-score of 93%, 93%, 93%, 97%, and 93%, respectively. To understand on how the four-class classifier detects COVID-19 pneumonia, we apply Gradient-weighted Class Activation Mapping (Grad-CAM) method and find out that the classifier is able to focus on the patchy areas in chest X-ray images and make accurate predictions. ii The thesis of Ziqi Zhu is approved. Chad J. Hazlett Hongquan Xu Yingnian Wu, Committee Chair University of California, Los Angeles 2020 iii TABLE OF CONTENTS 1 Introduction :::::::::::::::::::::::::::::::::::::: 1 2 Dataset ::::::::::::::::::::::::::::::::::::::::: 4 2.1 Data Description . 4 2.2 Dataset Preprocessing . 6 3 Methodology ::::::::::::::::::::::::::::::::::::: 8 3.1 ResNet Architecture . 8 3.2 Transfer Learning . 9 3.3 Implementation Details . 11 3.3.1 Data Augmentation . 11 3.3.2 Hyperparameters . 12 3.4 Performance Evaluation Metrics . 12 3.4.1 Confusion Matrix . 12 3.4.2 ROC Curve and AUC . 14 3.5 Model Interpretation . 15 4 Results ::::::::::::::::::::::::::::::::::::::::: 16 4.1 Performance of the Binary Classification Model . 16 4.2 Performance of the Four-class Classification Model . 17 4.3 Model Interpretation . 19 5 Conclusion ::::::::::::::::::::::::::::::::::::::: 22 References ::::::::::::::::::::::::::::::::::::::::: 24 iv LIST OF FIGURES 2.1 Sample chest X-ray images from our dataset: (A) COVID-19 pneumonia, (B) viral pneumonia, (C) bacterial pneumonia, and (D) normal case. 5 2.2 Data distribution for: (A) binary classification, and (B) four-class classification. 6 2.3 Final data distribution for: (A) binary classification, and (B) four-class classification. 7 3.1 Structure of residual block . 9 3.2 Schema of ResNet18 architecture . 9 3.3 Schematic of transfer learning with ResNet18 for: (A) four-class classification problem, and (B) binary classification problem. 11 3.4 Schema of confusion matrix . 13 3.5 Schema of ROC curve and AUC : red line: a perfect classifier, blue curve: a great classifier, yellow line: a random classifier, and shaded area: AUC for the random classifier. 14 4.1 Confusion matrix of the binary classification . 16 4.2 ROC curve of the binary classification model . 17 4.3 Confusion matrix of the four-class classification. 18 4.4 ROC curve of the four-class classification model: (A) the original ROC curves, and (B) a zoomed area of the ROC curves. 19 4.5 Comment: patchy areas of air space opacification bilaterally with a lower zone predominance. 20 4.6 Comment: there is peripheral patchy air space opacification seen in both lung lower zones with diffuse ground-glass haze bilaterally. 20 4.7 Comment: mutifocal consolidation in right mid zone and left mid/lower zones. 20 v 4.8 Comment: multiple faint alveolar opacities are identified, predominantly peripheral with greater involvement of the upper lobes. 21 4.9 Comment: there is established left upper lobe and now progressive patchy consoli- dation in left lower, right upper and middle lobes. 21 vi LIST OF TABLES 2.1 Details of our dataset . 5 2.2 Details of training and testing set for the binary classification model . 7 2.3 Details of training and testing set for the four-class classification model . 7 4.1 Results for binary classification . 17 4.2 Details of results for the four-class classification model . 18 vii ACKNOWLEDGMENTS I would like to thank my Mom and Dad, for their unfailing support and unwavering love. viii CHAPTER 1 Introduction The novel coronavirus disease 2019 (COVID-19) pandemic is an ongoing pandemic caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2). As of 28 May 2020, more than 5.5 million cases of COVID-19 have been reported in 216 countries, areas and territories, resulting in 353,373 deaths [Org20]. While most people only have mild to moderate symptoms, some patients have developed severe illnesses that include pneumonia and acute respiratory distress syndrome (ARDS). To control the spreading of COVID-19, effective screening of patients is critical. So far, the gold standard screening method is the reverse transcription polymerase chain reaction (RT-PCR) test which has been designed to detect SARS-CoV-2 genetically. But it only has a positive rate ranging between 30% and 60% [AYH20, YYS]. For patients who develop severe illnesses such as pneumonia and ARDS, a good complementary screening method is radiography examination, where chest radiography imaging (e.g., X-ray or computed tomography (CT) scan) is analyzed for SARS-CoV-2 viral infection indicators including bilateral, peripheral ground-glass opacities and pulmonary consolidations [SAB20]. However, the viral infection indicators can be subtle and it is difficult for radiologists to distinguish COVID-19 pneumonia from normal cases or other pneumonias. Thus, computer-aided diagnostic systems that can help detect COVID-19 pneumonia in chest radiography images are highly desired. In deep learning area, convolutional neural networks (CNN) are typically used to solve object detection and image classification problem due to its ability to preserve spatial structure and recognize image features. LeNet-5 [LBB98], introduced by LeCun et al. in 1998, is the first instantiation of CNN that has been successfully used in practice. With only seven 1 layers, it has achieved high performance for digit recognition problem. In 2012, AlexNet [KSH12] entered the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) [RDS15], a benchmark for object detection and image classification tasks at large scale, and was able to outperform all previous non-deep-learning-based models by a significant margin with top-5 error rate at 16.4%. In 2013, ZFNet [ZF14] was designed with the architecture of AlexNet and better hyperparameters. Thus, it reached less top-5 error rate at 11.7%. In 2014, VGGNet [SZ14] and GoogLeNet [SLJ15] both made another jump in performance, with top-5 error rate at 7.3% and 6.7%, respectively. The common thing between VGGNet and GoogLeNet is that they both have deeper architectures. In 2015, the ILSVRC winner is the residual neural network (ResNet) with 152 layers [HZR16]. It achieved the top-5 error at 3.6% which is less than human error 5.1%. This is the first time that a CNN model outperforms human in large scale object recognition tasks and it marks the promising future for CNN models. Motivated by the need for fast and accurate analysis of radiography images, a number of COVID-19 pneumonia detection models based on state-of-the-art CNN models have been proposed and results have shown to be promising [CRK20, NKP20, AM20]. However, those studies are reporting the results on small datasets under binary classification (COVID-19 pneumonia and non-COVID-19 cases) or three-class classification (COVID-19 pneumonia, other pneumonias and normal cases) problem. In this study, we have prepared a comparatively large dataset consisting chest X-rays images of COVID-19 pneumonia, viral pneumonia, bacterial pneumonia, and normal cases, and have trained two models based on transfer learning concept and ResNet architecture. One model is trained to distinguish COVID-19 pneumonia and non-COVID-19 cases in chest X-ray images, while the other one is trained to classify COVID-19 pneumonia, viral pneumonia, bacterial pneumonia, and normal cases. Using the first model, we can quickly screen patients who are suspected of having COVID-19 pneumonia and arrange immediate medical cares for them. The second model can help clinicians to not only better screen COVID-19, but also decide treatment strategy and make treatment plan based on cause of the infection. This thesis is organized as follows. First, Chapter 2 describes the generation of dataset 2 for two models. Chapter 3 describes the model architecture, transfer learning concept, implementation details, performance evaluation metrics, and the model interpretation strategy. Chapter 4 presents and discusses the results of experiments conducted to evaluate and interpret the proposed models. Finally, conclusions are drawn in Chapter 5. 3 CHAPTER 2 Dataset 2.1 Data Description The dataset used to train and evaluate our models consists 6,216 chest X-ray images across 6,001 patients. To generate this dataset, we combine and modify two different datasets that are publicly available: COVID Chest X-Ray Dataset [CMD20] and Labeled Optical Coherence Tomography (OCT) and Chest X-Ray Images [KZG18]. The following section gives a description of the two datasets and a summary of how we generate our dataset: COVID Chest X-Ray Dataset: This dataset comprises 360 chest X-ray images and CT scans across 198 patients which are positive or suspected of COVID-19 pneumonia or other pneumonias.