key: cord-0653336-k463hqmf authors: Soares, Lucas P.; Soares, Cesar P. title: Automatic Detection of COVID-19 Cases on X-ray images Using Convolutional Neural Networks date: 2020-07-02 journal: nan DOI: nan sha: c4441ce2585e914e7fb3fd1db96ca3495281e980 doc_id: 653336 cord_uid: k463hqmf In recent months the world has been surprised by the rapid advance of COVID-19. In order to face this disease and minimize its socio-economic impacts, in addition to surveillance and treatment, diagnosis is a crucial procedure. However, the realization of this is hampered by the delay and the limited access to laboratory tests, demanding new strategies to carry out case triage. In this scenario, deep learning models are being proposed as a possible option to assist the diagnostic process based on chest X-ray and computed tomography images. Therefore, this research aims to automate the process of detecting COVID-19 cases from chest images, using convolutional neural networks (CNN) through deep learning techniques. The results can contribute to expand access to other forms of detection of COVID-19 and to speed up the process of identifying this disease. All databases used, the codes built, and the results obtained from the models' training are available for open access. This action facilitates the involvement of other researchers in enhancing these models since this can contribute to the improvement of results and, consequently, the progress in confronting COVID-19. In recent months the world has been surprised by the rapid advance of SARS-CoV-2 (COVID-19). Given the widespread of this virus on all continents, the World Health Organization (WHO) has declared that we are experiencing a pandemic of this disease. To face this disease and minimize its socio-economic impacts, not only the surveillance and treatment are essential, but the diagnosis is also presented as a crucial procedure [1] . However, the realization of this is hindered by the delay and limited access to laboratory tests available to detect COVID-19 3 [3] , thus requiring new strategies to carry out case screening. Studies in the area have pointed to the existence of specific indicators on the chest radiography of individuals infected with the SARS-CoV-2 virus [4] . This fact would allow the use of these images in the diagnostic process of COVID-19 [5] , expanding access to other forms of detecting the disease and accelerating its identification process. * https://lpsmlgeo.github.io/ † https://cpscesar-en.github.io/ 3 The Reverse-Transcriptase Polymerase Chain Reaction (RT-PCR) is considered the standard reference method for making the diagnosis of COVID-19 infection [2] . In this scenario, deep learning models are proposed as a possible option to assist the diagnostic process. In particular, this technique arises intending to make the detection of cases of COVID-19 automatic from chest images -X-ray and computed tomography [6, 7, 8] . This research proposes the training of models, using machine learning, to accurately detect the presence of COVID-19 from chest radiographs. Since the dataset used in this research has only 175 images of the positive class (COVID-19 chest X-rays), the authors trained the models using the transfer learning technique. Complementarily, but not least, all the codes used to train the models and the data are available on GitHub 4 . This action aims to facilitate the involvement of other researchers in the process of enhancing these models, as this can contribute to the improvement of results and, consequently, the progress in facing COVID-19 5 . Automate the process of detecting COVID-19 cases from chest radiograph images, using convolutional neural networks (CNN) through deep learning techniques. Deep learning is a machine learning technique that, through deep neural networks, seeks to discover autonomouslythat is, without explicit programming -rules and parameters of a data set, in order to provide adequate representation for a particular problem. The term "deep learning" derives from a large number of hidden layers between the input and output layers of the neural network. In this work, the convolution neural networks were trained using the supervised learning process [9] . Therefore, the labels and the images served as input to the network, intending to minimize the loss function. This last one measures how far the prediction is from the expected output. The models were trained with three different architectures: Xception [10] , Residual Networks (ResNet) [11] , and VGG-16 [12] . Only the fully connected layers were optimized during the training process. The convolutional layers' weights were loaded from the ImageNet [13] dataset thought the transfer learning technique. The models were trained for 80 epochs with a learning rate of 0.001 and a batch size of 15. Categorical cross-entropy and Adam was used as loss and optimization function, respectively. The images used to train the models had a size of 237 x 237 pixels and three colors channel (RGB). The training used 10% of the images for validation and 10% to test. Models were evaluated based on the accuracy metric. The results were plotted on a confusion matrix and analyzed using a class activation map (Grad-Cam) and by visual inspection. The models were trained on Google Colaboratory Virtual Environment using TensorFlow [14] and Keras [15] Python libraries. The construction of the database aimed to maximize the number of training images. For this, two different sources were used: one containing X-ray images of the chest of individuals infected with COVID-19 (n = 175) [16] 6 and the other, with the same type of image, but of lungs of individuals without any infection (n = 100) and with infections related to other virus and bacteria (n = 100) [17] 7 . These datasets were used in this research because of the possibility of free access to the image banks. Each trained model's results were evaluated through the plots of the accuracy and loss function history of the training and validation data (figure 1). The Xception and ResNet models' graphs showed that although the accuracy was 95,9%, 94,6%, respectively, the models overfitted. This result can be inferred because the validation loss does not decrease according to the training loss. Nevertheless, the VGG-16 model graphics shows that there was less overfitting since the training and validation lines approached, and the model had the highest accuracy: 97,3%, meaning that it classified correctly 97,3% of the images used in the validation. Therefore, from the results, it is possible to notice that the VGG-16 model presented greater consistency and accuracy to classify the lungs' images. The generalization capacity of the VGG-16 model was evaluated on a test set with 75 images, that were not used during the training process and randomly sampled from the dataset. The results were plotted in a confusion matrix. The matrix (figure 2) pointed out that the accuracy value was 97,3%. That is, among the 75 images used for the test, the model correctly classified 73. Accurately, the model correctly classified 100% (n = 39) of the images related to COVID-19, 88,2% (n = 17) of the images of normal lungs, and 100% (n = 19) of the images of lungs with other infections. Regarding the errors, the model classified 2,7% (n = 2) of the images referring to normal lungs as other infections. From the results, it is possible to notice that the model had high accuracy in classifying the healthy lungs, COVID-19, and other infections, especially using the VGG-16 architecture. Nevertheless, the class activation map did not show a clear visual pattern that allows us to infer which part of the lung the model is basing on to claim that it has COVID-19. This fact indicates the need to improve the models presented here. Therefore, future researches may evaluate models with different architectures, parameters, and datasets that use augmentation techniques. Besides, considering the unknown character of COVID-19, the activation map exposed in this research can contribute to the literature on the possible indicators of COVID-19 in the lung images of infected individuals. Finally, the authors highlight the importance of providing images of individuals infected with COVID-19 and also the stage of the disease. This data can contribute to the improvement of models and progress in coping with the virus. All models and codes used in this work were made available on the author's blog 8 . Emergence of a novel coronavirus disease (covid-19) and the importance of diagnostic testing: why partnership between clinical laboratories, public health agencies, and industry is essential to control the outbreak 2019 novel coronavirus: an emerging global threat World Health Organization et al. Laboratory testing strategy recommendations for covid-19: interim guidance Imaging profile of the covid-19 infection: radiologic findings and literature review Correlation of chest ct and rt-pcr testing in coronavirus disease 2019 (covid-19) in china: a report of 1014 cases Rapid ai development cycle for the coronavirus (covid-19) pandemic: Initial results for automated detection & patient monitoring using deep learning ct image analysis Deep learning system to screen coronavirus disease 2019 pneumonia. arxiv 2020 Covid-net: A tailored deep convolutional neural network design for detection of covid-19 cases from chest x-ray images Convolutional networks for images, speech, and time series. The handbook of brain theory and neural networks Xception: Deep learning with depthwise separable convolutions Deep residual learning for image recognition Very deep convolutional networks for large-scale image recognition Imagenet: A large-scale hierarchical image database TensorFlow: Large-scale machine learning on heterogeneous systems Covid-19 image data collection: Prospective predictions are the future Labeled optical coherence tomography (oct) and chest x-ray images for classification