Automatic detection of COVID-19 chest X-ray based on Convolution Neural Network

Currently, chest X-rays, as one of the auxiliary diagnostic methods for COVID-19, play an important role in the detection of COVID-19. In this paper, we propose an automatic detection method of COVID-19 chest X-ray based on Convolution Neural Network. In this method, we first get an image of the chest by X-ray, and then we preprocess the chest X-rays, and then send the preprocessed X-ray images to the convolutional neural network for feature extraction and classification, and finally we were able to diagnose whether COVID-19 or not. We test the three types of models (Inception V3, ResNet and DenseNet) under different layers, and finally propose the automatic detection method of COVID-19 chest X-ray. After a large number of experiments, the highest accuracy rate of COVID-19 detection is 98.059%. Compared with other studies in the same period, our accuracy rate is higher, and it is very fast. This indicates that our proposed method can be used as an auxiliary detection for COVID-19.


Introduction
Chest X -rays and CT are still widely used in the diagnosis of pneumonia. It can quickly obtain the condition of the patient's lung reliably, and is a rapid clinical diagnosis method. However, the correct judgement through X-ray images requires professional knowledge and experience. It is even more difficult to distinguish between COVID-19 and other pneumonia through X-ray images. Generally, it can only be judged by professional and experienced doctors.
The medical system is under enormous pressure to cope with the current shortage of staff. Through the algorithm of artificial intelligence, the diagnostic accuracy and efficiency of computer can be equal to or even exceed that of traditional doctors. Combining deep learning with medical images can dramatically reduce doctors' workload. Let doctors devote themselves to where they are needed.
The detection of COVID-19 based on X-ray images can be traced back to February 2020, AI et al. [1], who pointed out that chest X-ray (CXR) examination can be used as the main screening tool for COVID-19. More and more researchers have devoted themselves to COVID-19 diagnosis based on Xray images, such as Wang et al. [2], Zhang et al. [3]and Hemdan et al. [4]. Narin et al. [5] used the pretrained model of ImageNet dataset to train, in which the pre-trained Resnet50 model could achieve 98% diagnostic accuracy.
There are few studies on COVID-19 chest X-ray image recognition in China. However, COVID-19 detection method based on deep learning has important research value. In the context of the global pneumonia epidemic is still the focus of research. In this context, the automatic detection network of COVID-19 chest X-ray proposed in this paper can be used as a fast and accurate auxiliary detection method.

Proposed Method
Our COVID-19 chest X-ray detection method consists of the following parts: image acquisition, image preprocessing, COVID-19 chest X-ray detection network. Our overall method block diagram is shown in Fig. 1. In the image acquisition stage, we will get images of the chest by X-ray. In the image preprocessing stage, we will standardize the size, brightness and contrast of the image. After the preprocessed image passes through our COVID-19 chest X-ray detection network, we can know whether the patient has contracted COVID-19. A large number of experiments have proved that our method has a significant effect on the detection of COVID-19 chest X-ray images and can be used as an auxiliary means for the detection of COVID-19.

2.1.image acquisition
Currently available chest X-ray data sets for COVID-19 are sparse. Open source datasets are all mutually contained, which makes it difficult to select datasets that are more representative. So, we chose two classic pneumonia datasets, Chest X-ray Images (pneumonia) [6] and COVID-19 Chest X-ray Database [7], which are included in most datasets.
The Chest X-ray Images (Pneumonia) dataset included 5,863 chest X-ray images from healthy individuals, chest X-ray images from patients with Common pneumonia (Non-COVID-19 pneumonia). This dataset is included in most pneumonia datasets and serves as the basis datasets for distinguishing pneumonia patients from normal patients.
The COVID-19 Chest X-ray Database contains a total of 2,905 chest X-ray images from healthy individuals, bacterial pneumonia patients, and COVID-19 patients (positive for COVID-19). The dataset was collected and indexed by M. E. h. Chowdhury et al. [9] from all published articles and online resources. To avoid duplication, they also compared these articles and chest X-ray images with GitHub database. Therefore, the dataset in the integrity and accuracy of the data has a good guarantee.
In this study, the above two data sets were integrated, and the images with poor quality were removed. In the integrated dataset, chest X-rays of normal people and chest X-rays of other two types of pneumonia patients were shown in Fig. 2. Fig. 2 (a) is a normal chest X-ray images, which can show clear lungs without any abnormal turbidity in the image. Fig. 2

2.2.image preprocessing
In this study, the above two datasets were integrated, and the images with poor quality were removed.
The data distribution of this study is shown in Table 1.
Since the integrated data set was used in this study, we need to standardize and normalize the data in the dataset. In this paper, we call the transforms method provided by torchvision to standardize the data. The standard deviation and variance are [0.485, 0.456, 0.406] and [0.229, 0.224, 0.225] respectively. In addition, in order to enrich the image data, half of the images were randomly flipped and rotated 10 degrees clockwise (or counterclockwise) to enhance the diversity of image features.

2.3.COVID-19 chest X-ray detection network
In this paper, we selected five convolutional networks with different depths. Considering the accuracy of auxiliary diagnosis, we selected deeper networks. According to the depth from shallow to deep, they are InceptionV3, ResNet50, ResNet101, DenseNet121 and DenseNet169. Inception V3 introduces the method of splitting a larger two-dimensional convolution into two smaller one-dimensional convolutions [8]. As shown in Fig.3, the convolution conversion diagram in the Inception module. A 5x5 convolution of the left branch is split into two 3x3 convolutions. This asymmetric convolution structure can increase the diversity of features and reduce the amount of computation.  The introduction of residual unit makes the network deeper. To a certain extent, it solves the problem of gradient disappearance and gradient explosion.
DenseNet realizes feature reuse by connecting features on channels [10]. DenseNet puts forward a dense connection mechanism: all layers are connected to each other. Specifically, each layer will accept all the previous layers as its additional input. This can realize the reuse of features and improve efficiency. In this study, the above three types of network models were selected as the COVID-19 chest X-ray detection network. The reason is as follows: InceptionV3's asymmetric convolutional splitting can enhance the diversity of features and more accurately distinguish between new coronavirus pneumonia and common pneumonia. As a widely used network model, ResNet has mature application examples and has many advantages in practical applications. DenseNet has a higher accuracy rate than ResNet, fewer parameters, and will be more accurate and efficient in practical applications.
The pre-processed chest X-ray images will be sent to the above-mentioned detection network for feature extraction and final classification diagnosis. It doesn't take too long for us to know the accurate diagnosis result.

Experimental Results
This study conducted experiments on two classic pneumonia datasets, Chest X-Ray Images (Pneumonia) [6] and COVID-19 Chest X-ray Database [7]. We divide the data into three categories: normal, common pneumonia (Non-COVID-19 pneumonia) and COVID-19. We tested the accuracy of five convolutional neural networks on the integrated dataset. The experimental results are shown in Table 2. Due to the dense connection mode of DenseNet121, it has the highest accuracy rate of 98.059%. Since the COVID-19 data are scarce, and DenseNet169 network layers too deep, it has a certain degree of over-fitting. This makes the accuracy of DenseNet169 not as high as DenseNet121. Although Inception V3 has a small number of network layers, its asymmetric convolutional structure also allows it to obtain an accuracy of 97.906%. In order to compare the performance of the five models in the training process, we draw the change of the verification probability of the five models in the training process. Fig. 5 (a) shows the overall situation of the verification probability of the five models. Fig. 5 (b) shows the details of the verification probabilities of the five models. It can be seen from the figure that the image of DenseNet121 is slightly higher than the others.
(a) Overview of training process of five models (b) Training process details of five models Fig. 5 The verification probability of the five models in the training process The specific situation of each category is shown in the confusion matrix in Fig. 6. It can be seen from Fig. 6  model is very accurate in the identification of COVID-19. But there is still this certain confusion between common pneumonia and COVID-19, and between normal and common pneumonia. COVID-19 is detected in nearly 10% of normal patients as shown in Fig. 6 (e). Nevertheless, the method of this study has a very high accuracy rate in identifying whether the patient is COVID-19. In this paper, we also compare the experimental results with other studies in the same period. In these comparative studies, the dataset we used has a large overlap with their dataset. The comparison results are shown in Table 3. It can be seen from table 3 that our method is more accurate than others. It is proved that the proposed method of covid-19 chest X-ray detection can be used as a reliable auxiliary detection method.  Model Accuracy Other people's research CheXNet [11] 97.74% COVID-Net [2] 93.3% CovidAID [12] 90.5% Our approach DenseNet121 98.059% Using the method of this study, it only takes 1.1 seconds to detect each X-ray. Compared with clinicians, they can make a diagnosis faster.

Conclusion
In this study, we propose an automatic detection method of covid-19 chest X-ray based on convolutional neural network. This method has achieved a good result of 98.059% in the detection of COVID-19. It can accurately and quickly distinguish between normal people, COVID-19 and common pneumonia. Compared with traditional doctors, there is no need for rich diagnosis experience, no fatigue, and a very low misdiagnosis rate while saving a lot of time. In terms of time, using the detection method of this study, a computer can detect about 80,000 suspected patients in a day, which is impossible for a doctor to do. After a lot of experimental research, our method can be used as an auxiliary diagnosis for rapid triage, quickly isolate different patients, and block the spread of the virus faster.