An Online Automatic Corona Diagnose System Based on Chest X-ray Images

An outbreak of SARS-CoV-2 shocked healthcare systems around the world. It began in December 2019 in Wuhan, China, and spread out in over 120 countries in less than three months. Imaging technologies helped in COVID-19 fast and reliable diagnosis. CT-Scan and X-ray imaging are popular methods. This study is focused on X-ray imaging, concerning limitations in small cities to access CT-Scan and its costs. Using deep learning models helps to diagnose precisely and quickly. We aimed to design an online system based on deep learning, which reports lung engagement with the disease, patient status, and therapeutic guidelines. Our objective was to relieve pressure on radiologists and minimize the interval between imaging and diagnosing. VGG19, VGG16, InceptionV3, and ResNet50 were evaluated to be considered as the main code of the online diagnosing system. VGG16, with 98.92% accuracy, achieved the best score. VGG19 performed quite similarly to VGG16. VGG19, InceptionV3 and ResNet50 obtained 98.90, 71.79 and 28.27 subsequently.


Introduction
SARS-CoV-2 spread quickly all over the world [1]. This virus causes lung infection and pneumonia in most of patients. Reverse transcription-polymerase chain reaction (RT-PCR) is a reliable and trusted way to ensure infection with COVID-19 [2]. But this method was time-consuming, and some kits do not have enough accuracy. Common symptoms are fever and cough, in addition to dyspnea, headache, and fatigue [3].
Hemdan et al. [5] developed a framework called COVIDX-Net to assist the medical community. In this study, VGG19 and DenseNet outperformed other models. In another study, Narin et al. [6] studied on three CNN models, including ResNet50, InceptionV3, and Inception-ResNetV2, which ResNet50 model provided 98% accuracy among others.
CT-Scan is not available in most of the small cities, so X-ray is a suitable alternative for imaging lungs.
This study aimed to develop a machine learning model based on X-ray images. For this purpose, we have created an online system that recognizes COVID-19 by analysing the images from the coronal plane. The key feature is that all the users can use the latest updated model quickly. The output of our system is lungs engagement with the disease, patient status, and therapeutic guidelines. VGG16, VGG19, InceptionV3, and ResNet50 were evaluated and nally VGG16, with 98.92% accuracy selected as the main core of our online system [7].
The procedure of deploying model will be explained in the second section of the manuscript. The third part contains the discussion and results. Finally, the conclusion of the study represented in section four. Figure 1 contains a owchart to achieve an online system. The main outcomes are lung engagement with the disease, patient status, and therapeutic guidelines.

Materials And Methods
First, VGG16, VGG19, Inception V3, and ResNet50 were trained on con rmed COVID-19 X-ray images and normal lung images, then the trained model with the highest e ciency deployed on Google Cloud Platform (GCP) and utilized via a python based API. Images and results transferred using JSON. Speci c details will be discussed in the following.

Train Model
A public dataset provided by Cohen et al. [8] contains con rmed lung images with COVID-19 along with images from hospitals of the Ardabil province of Iran that were used to create a dataset for the machine learning model. Fine-tuned VGG16, VGG19, Inceptionv3, and ResNet50 CNNs were assessed.
VGG16 and VGG19 were proposed by Simonya and Zisserman [9]. These models stacked convolutional layers together. VGG16 has 138.4 million parameters, while VGG19 has 143.7 million parameters. With respect to the size of parameters, training these networks on the small size of the COVID-19 dataset is not e cient. So Fine-tuning these networks helps to develop models su cient for this study.
He et al. [10] suggested ResNet50 in 2015 with 25.6 million parameters and 152 layers, which is 8x deeper than VGG networks.
Inception-V3 was proposed by Szegedy et al. [11] in 2015, Around 23 million parameters created this network, which achieved 5.6% top-5 error for single frame evaluation on ImageNet Large Scale Visual Recognition Challenge (ILSVRC) 2012 challenge.
Fully connected layer added on top of the pre-trained models. Four hundred con rmed positive COVID-19 subjects with 1000 healthy lungs X-ray images from Radiological Society of North America (RSNA) pneumonia detection challenge [12] created the rst version of the model.

API
The backbone of this system is uploaded on the Google Cloud Platform (GCP), which provides serverless computing services. This feature helps to create and execute models e ciently. The connection between back-end and front-end maintained by JSON. To avoid storage problems, input images do not restore. The structure of API is easy to understand. When an encoded image fed into API, python core will decode and preprocess image. This image will be analysed, and three outputs will be shown on the website: lung engagement with the disease, patient status, and therapeutic guidelines. The main core reports the lung engagement with the disease, and based on this key outcome, other analyses will be done and shown to the user.

Results And Discussion
The models were implemented with python 3.7 on a laptop equipped with an Intel Core i7-9750H processor, Nvidia GTX 1650 2GB VGA, and 24GB RAM. Four interested networks examined by the same epoch value and dataset. The training and testing ration are 80:20 percent. So we had 280 test and 1120 train images. The size of input images is 244x244 except InceptionV3, which was 299x299. The results reported in Table 1 in terms of accuracy, sensitivity (known as recall), and speci city. These metrics VGG 16 achieved the maximum accuracy of 98.42%, among others. This model holds the highest sensitivity and speci city, which indicates its e ciency and applicability. The confusion matrix of these networks is reported in Table 2. This matrix consists of true positive, false negative, false positive, and true negative values. The accuracy/loss and epoch plots are illustrated in gure 2-5. These reports include training accuracy, validation accuracy, training loss, and validation loss.
Receiver operating characteristic (ROC) curve illustrated in gure 6. If the curve follows the True-Positive border and then the top border of the ROC space closely, the test is more accurate.
Precision and F1-score are three other metrices to evaluate networks. The equation to obtain these metrices is expressed equations 4-5: These results are reported in Table 3.

Conclusion
Machine learning algorithms growth quickly in recent decades. A combination of image processing and machine learning created e cient convolutional neural networks that have signi cant applications such as in auto-driven cars. This interdisciplinary eld can be used in medical science. The outbreak of SARS-CoV-2 showed us necessities in the medical system. By the increase in the number of people in hospitals and demanding for CT-Scan and X-ray, The time in diagnosing and con rming the disease played a crucial role. This study evaluated four CNNs and selected the best as the main core of the online diagnosing system by deploying online machine learning application on the GCP. Online diagnosing platform is free and will update regularly. VGG16, with 98.82% accuracy, outperformed other models.  Inception V3 training history plot ResNet50 training history plot The receiver operating characteristic curve of networks