{'fraction_non_alphanumeric': 0.03473644999068728, 'fraction_numerical': 0.020162041348482027, 'mean_word_length': 4.740978348035284, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Deep Learning on Chest X-ray Images to Detect and Evaluate Pneumonia Cases at the Era of COVID-19

Coronavirus disease 2019 (COVID-19) is an infectious disease with first symptoms similar to the flu. COVID-19 appeared first in China and very quickly spreads to the rest of the world, causing then the 2019-20 coronavirus pandemic. In many cases, this disease causes pneumonia. Since pulmonary infections can be observed through radiography images, this paper investigates deep learning methods for automatically analyzing query chest X-ray images with the hope to bring precision tools to health professionals towards screening the COVID-19 and diagnosing confirmed patients. In this context, training datasets, deep learning architectures and analysis strategies have been experimented from publicly open sets of chest X-ray images. Tailored deep learning models are proposed to detect pneumonia infection cases, notably viral cases. It is assumed that viral pneumonia cases detected during an epidemic COVID-19 context have a high probability to presume COVID-19 infections. Moreover, easy-to-apply health indicators are proposed for estimating infection status and predicting patient status from the detected pneumonia cases. Experimental results show possibilities of training deep learning models over publicly open sets of chest X-ray images towards screening viral pneumonia. Chest X-ray test images of COVID-19 infected patients are successfully diagnosed through detection models retained for their performances. The efficiency of proposed health indicators is highlighted through simulated scenarios of patients presenting infections and health problems by combining real and synthetic health data.


2021)
, there have been 149,744,454 global cases all around the world. 1 In many cases, this disease causes pneumonia. Characteristics of such an infection can be observed by radiologists. Also, deep learning methods can be helpful for operating deep analysis on query radiography images. Thanks to artificial intelligence, early stage and precision diagnosis can be done. Moreover, augmented intelligence can also play a key role for detecting and preventing the spread of novel coronavirus [2].
In this pandemic, the effective screening of COVID-19 is an arduous task in practice. Standard screening test kits called Reverse Transcription-Polymerase Chain Reaction (RT-PCR) are often unavailable. Moreover, the RT-PCR test is highly sensitive. It was found that deep-based Computed Tomography (CT) images analysis could be more reliable than RT-PCR test in early-stage diagnostic [3][4][5]. Notably, where RT-PCR test can turn out negative, deep CT image analysis can already predict true positives in certain cases. False negatives to RT-PCR test can lead to non-negligible propagation of this disease.
At this time, American College of Radiology recommendations for the use of chest radiography and CT for Suspected COVID-19 infection [6] point that generally, the findings on chest imaging in COVID-19 are not specific, and overlap with other infections, including influenza, H1N1, SARS and MERS. Notably, being in the midst of the current flu season with a much higher prevalence of influenza in the U.S. than COVID-19, further limits the specificity of CT. Besides, the use of radiography equipment requires high disinfection needs after each use which can make massive tests laborious and time-consuming. In practice, for hygienic reasons, chest X-rays (CXR) are often frontally taken with patients on a stretcher or bed, lying down or at best sitting. Such constraints often conduct to chest X-rays with poor quality and real issues in term of analysis.
Nevertheless, CT images of lung and chest X-ray images offer additional data for screening COVID-19. Notably, AI technology is already deployed in China for radiography examination and radiomics-like analysis from CT images [7]. AI technology can also facilitate remote operations and help to face the lack of expert radiologists. At this date, many AI tools and radiography image datasets are private resources. The access to publicly open COVID-19-related sets of lung CT images towards conducting deep learning experiments is relatively limited. Some open access X-ray image sets of chest are publicly available.
Research works are highly needed in areas of image detection, evaluation and making-decision techniques, and radiography examinations in order to highlight proof of concepts and scientific truths about this misunderstood COVID-19 disease. The goal of this paper is twofold: i) to present deep learning models tailored with chest X-ray images for detecting pneumonia infection cases such as viral cases towards screening COVID-19, ii) to propose easy-to-apply health indicators for evaluating detected pneumonia infection cases with an estimator of infection and predictions of patient status. This study is presented with the aim of supporting radiologists and other clinicians. In no case this preliminary study could be substituted to a medical advice.
The next section presents some investigated deep learning based image detection architectures and analysis strategies. Section "Experimental study" shows a set of experiments to evaluate the performance of the considered architectures and "Conclusion" concludes the paper.

CNN-based detection and evaluation of infected patients
In [8,9], authors emphasized that the COVID-19 is a viral disease and not a bacterial one. Respectively, an efficient classifier is designed to automatically detect if a query chest X-ray image is Normal, Bacterial or Viral by assuming that a COVID-19 infected patient, tested during an epidemic period, has a high probability to be a true positive when the classification output is Virus (see Fig. 1). Nevertheless, it is worth mentioning that a severe viral respiratory infection can lead to a secondary pneumonia of bacterial nature [10]. For this reason, our classifier aims to be useful at early stage of COVID-19 pulmonary symptoms.
The pulmonary infections can be more directly visible in CT images than in chest X-Ray images [11]. Nevertheless, detection of COVID-19 from chest X-ray images is investigated since they represent widespread resources that are often analyzed upstream of CT scans.
At this time, chest images of COVID-19 cases are relatively limited in open access. Several CNN-based classification architectures such as [12,13] are trained by using small chest image sets of COVID-19 cases. In such cases, it is hard to statistically build meaningful architecture. However, this could permit to observe first behaviors and trends of directly tailored CNN-based classification models. In our case, we adopt another strategy which consists of training CNN-based classification architectures over larger chest image sets of pneumonia and normal cases, and particularly evaluating them by using COVID-19 images.

Tailored CNN models
A set of tailored models based on CNNs have been designed to take three set of image categories (e.g.; normal case, viral pneumonia case and bacterial case) as input and to output the predicted probability for each of the categories. The trained models exploit the CNN backbones ResNet34, ResNet50 and DenseNet169 through the fastai library and a fully connected head, with a single hidden layer, as a classifier.
Besides, a trained model exploits the CNN reference backbone VGG-19. In addition, a dual use model (Inception ResNetV2 -RNN) is prepared for i) characterizing categories of input split images by getting a hidden layer output of a fin-tuned Inception ResNetV2 architecture, ii) predicting final categories of split images (image blocks) using a bidirectional Long Short-Term Memory (RNN-LSTM) architecture. For these last ones, a Keras and TensorFlow workflow is used. Specifically, the prediction stage of the dual-use model operates at a second level analysis of the data. A sequence of sub-images is first generated while entirely covering the images by directly positioning a regular grid onto the original query chest X-ray images. Precisely, the image is split into a set of image blocks that correspond to grid cells (see Fig. 2). This operation enhances the size of the training set while limiting the loss of image details. This loss often occurs when the original images are resized for fitting inputs of standard deep learning architectures. Then, each image block is given as input to the RNN for providing a set of local predictions (radiographic pattern) towards estimating health indicators such as a CNN-based infection ratio (a use is described in Estimation of CNN-based health indicators). The grid discretization (matrix of contamination) should be tuned according to the obtained predictive performance of the considered architecture.

Data preparation and model inputs
For our experiments, we exploited chest X-ray images from the Chest X-Ray Images (Pneumonia) dataset. 2 This dataset is related to the paper [14] on the identification of medical diagnoses and treatable diseases by imagebased deep learning. This dataset contains 5,863 children X-ray images divided in two categories, namely Normal and Pneumonia. The Pneumonia category is composed of pneumonia images that are labeled either bacterial or viral (see illustrations in Fig. 6 of [14]).
The Chest X-Ray Images (Pneumonia) dataset is reorganized into three classes; namely normal, bacterial pneumonia and viral pneumonia (see samples in Fig. 3a, b and c, respectively). Each training set contains 1345 images and each test set contains 148 images. Since this dataset was composed of pulmonary images having heterogeneous and large sizes; and to deal with reasonable computational times during the CNN training experiments, all the images were resized to a unique dimension and rescaled into smaller images (e.g.; size 310 × 310) to fit with standard inputs of tailored architectures. For the last tailored model using RNN, a preliminary split of the original image precedes the resizing step.
Regarding the tests, we added a test set (blind test) that is composed of a single class containing 145 chest Xray images of COVID-19 infected patients (see sample in Fig. 3d). This test set has been constituted by filtering the heterogeneous COVID-19 Image Data Collection dataset [15]; folder containing a mix of CT and X-ray images with a variety of infection types.
We emphasize that the exploited images often contain artifacts such as described in [16] that can make difficult the training stage of machine learning models. Such artifacts are shown in Fig. 3e, f, g and h.
At this time, we consider that the quantity of available COVID-19 is still too limited for building a reliable detector that can discern between Non-COVID-19 viral pneumonia and COVID-19 viral pneumonia. In our case, the 145 chest X-ray images are specifically used as a test set towards ideally detecting them as viral pneumonia. As previously mentioned, we assume that a COVID-19 infected patient, tested during an epidemic period, has a high probability to be a true positive when the classification output is viral pneumonia (Fig. 1).

Estimation of CNN-based health indicators
Based on statistical tools (logistic regression and statistical tests) and realistic data, studies on COVID-19-related death risk factor have been proposed in [17,18]. In this paper, we sketch a simple measure to provide to health professionals an estimator for evaluating the chance of a patient to survive COVID-19 considering risk factors; namely age, comorbidity and the infection rate indicator (Fig. 2). For each risk factor, we associate a score which represents a penalty (a large value decreases the chance of a patient to escape fatality). The proposed measure F is the addition of scores divided by a critical threshold T . Beyond T , there is no chance to be recovered. Formally, F is expressed as follows: where S 1 measures the risk due to the patient's age, S 2 measures the risk related to the CNN-derived infection rate measured from the X-ray chest image of a patient, S 3 measures the risk associated with comorbidities of a patient that can lead to the development of complications.
More precisely, let us give an example to concretely compute the measure F . First, we point out that the scoring system used hereafter must be adjusted by health professionals to match with reality.
In this example, we use the values of fatality riskratio during COVID-19 epidemic in Hubei, China [19,20]. Proportionally to these values, we define penalty scores (S 1 ), see Table 1.
Then, we define a Virality score (S 2 ) related to the infection rate of X-ray image (CXR score). S 2 can be the probability of the concerned class that is directly provided by the used CNN. A more refined formulation of S 2 is proposed to scrutinize the X-ray image and to consider radiographic infection patterns. Each image is divided in n sub-images where n = 9 (value for which our RNN effectively performs). After this multi-regional analysis, Fig. 3 Chest X-ray samples from the test datasets. Row 1 shows image categories. Row 2 shows various artifacts captured with chest X-rays such as writings (e.g.; letter "R") and medical devices (e.g., tubes, sensors) The sources of the "Fatality risk ratio" are [19,20] Bold entries correspond to values of interest with respect to contextual information such as best performances each sub-image will be in status virus, bacteria or normal (see Fig. 2). A score equal to 100 is assigned to the Xray image when the n sub-images are infected by a virus. Proportionally, the infection rate of the image is: where N is the number of the virus infected sub-images. The third risk factor (S 3 ) is related to diseases of a patient in addition to COVID-19. We use the values of case fatality rate during COVID-19 epidemic in China [21,22]. Proportionally to these values, we define penalty scores (S 3 ), see Table 2.
In this example, we set the critical threshold T to 200, then beyond this limit, one cannot escape fatality. The measure F can be used as follows. If F ≥ 1 then the hope to escape fatality is null. Varying F from 0 to 1, the patient gradually moves away from the hope of recovering.
The value 200 assigned to T is obtained by taking reference a patient having a cardiovascular disease and aged over 80 years. We assume that such a patient cannot fight against COVID-19. Therefore, a person having COVID-19 which reaches the score 200 cumulates too many factors to overcome the illness. The sources of the "Case fatality rate" are [21,22] Bold entries correspond to values of interest with respect to contextual information such as best performances Finally, we point out that the term S 2 of our measure F can be tuned: -S 2 can be modified to take into account a time factor. Indeed, a serie of X-ray images is observed for each COVID-19 inpatient pointed in [11,23,24]. Accordingly, S 2 can be measured at two timely spaced X-rays t 1 and t 2 to take into account the time kinetics of symptom onset and disease progression for the infected patient. For this latter case, the infection rate can be redefined as follows: where f (t) = (100/n)×N(t) is the infection rate of the chest X-ray image captured at a moment t, N(t) is the number of detected viral sub-images at a moment t, t 1 is inferior to t 2 , δ is threshold fixed to 20, bonus and malus are a gain and a penalty fixed to (−20 × f (t 2 ))/100 and (20 × f (t 2 ))/100, respectively. -S 2 can be replaced by another multi-regional CXR score, named Brixia score, that has been proposed in [25] for grading the infection according to observed lung abnormalities. Table 3 presents performance for classification of normal and infection cases by using tailored CNN-based architectures. The DenseNet169 architecture has reached best performance with an average classification accuracy of 95.72% from the Chest X-Ray Images (Pneumonia) dataset. 2 It is worth mentioning that similarly to the work from [13], the DenseNet architecture outperforms the other architectures. The classification accuracies are 97.97%, 96.62% and 92.57% for the class bacterial, virus and normal, respectively (see Table 4). The associated confusion matrix is shown in Table 5. The performance of our DenseNet model is competitive with performances obtained by [14] in average classification accuracy of bacterial and viral cases (90.7%). The histogram depicted in Fig. 4 provides a detailed overview about accuracy results obtained with architectures of different natures for the classification of chest X-ray images with 4 categories. As can be seen in Table 4, our RNN-based architecture is particularly sensitive to pneumonia cases with the blind COVID-19 test set since it detects pneumonia at 99.3% for at least 24 COVID-19 infected patients using default setting. Also, it promisingly detects viral infection for Bold entries correspond to values of interest with respect to contextual information such as best performances a Chest X-Ray Images (Pneumonia) dataset: https://www.kaggle.com/paultimothymooney/chest-xray-pneumonia

Performance of tailored CNN models
The first row reflects classification results of [14] Bold entries correspond to values of interest with respect to contextual information such as best performances Bold entries correspond to values of interest with respect to contextual information such as best performances Fig. 4 Histogram of classification accuracy obtained for each class by using varied architecture types with the Chest X-Ray Images (Pneumonia) dataset Table 6 CNN-derived infection rates S 2 estimated from real pairs of successive X-ray images for 5 COVID-19 infected patients Image pairs Fig. 5 of [11] 9/9 7 9/9 elderly man f (t 2 ) "improvements" (1,2), Fig. 1 of [23] 1/9 5 2/9 67-y-old woman f (t 2 ) "wires, attenuation" (1,3), Fig. 2 of [23] 5/9 8 5/9 36-y-old man f (t 2 ) "death" (1,2), case 1, Fig. 5 of [24] 6/9 1 9/9 "worse status" f (t 2 )+malus (1,2), case 2, Fig. 5 of [24] 7/9 4 8/9 "worse status" 60.64% considering majority voting in sequences. We stress the fact that the 145 COVID-19 images which have been extracted from [15] are highly heterogeneous. Notably, these extracted images come from at least 24 different hospitals over the world. The RNN output results show a particularly robust pneumonia detection of COVID-infected patients and satisfying viral detection in view of the diversity of exploited radiography sources. In [15], a histogram shows that significant image quantity has been acquired during the first week of the start of  Bold entries correspond to values of interest with respect to contextual information such as best performances symptoms or hospitalization. Since the quasi-totality of pneumonia are detected, our models should be able to operate at an early detection stage. Also, a histogram shows a significant image distribution in term of age in between 20 and 80 years old. Since the Chest X-Ray Images (Pneumonia) dataset 2 is principally collected from children (5,232 chest X-ray images) and since the quasi-totality of pneumonia are detected, models trained on children chest X-ray image database may be relevant for detecting pneumonia from adult chest X-ray images. Table 6 shows the RNN-derived infection rates S 2 estimated from real pairs of successive X-ray images for COVID-19 infected patients. Table 7 details examples of F calculated for 9 patients from synthetic data. Table 8 gives the distribution of the F values for a patient aged between 60 and 69 considering the possible diseases (rows) and rates of infection (columns from 0 to 9). The corresponding distribution is illustrated in Fig. 5.   Fig. 5 Graph obtained by representing the distribution of F values for a patient aged between 60 and 69 considering the possible diseases and rates of infection given in Table 8 The simulation shows that a patient having 65 years old, a cardiovascular disease and rate of infection greater than 6 has no hope to recover the health. The Patient 1 of Table 7 that has 65 years old, a cardiovascular disease and rate of infection of 3 should recover the health (F = 79.41%).

Conclusion
A comparative study is provided for performance evaluation of tailored deep learning models for the detection of pneumonia cases. Tailored models have shown promising performances since they all exceeded 84% of average accuracy on pneumonia detection cases for the pneumonia reorganized dataset. 2 Hence, a patient that has a pneumonia during the epidemic context has a high probability to be detected by these models. In particular, the InceptionRes-NetV2 model has detected the minimum of false negatives to the pneumonia on the COVID-19 blind test set (0.7%). Moreover, we have shown in our experiments that the transfer of knowledge from pediatric chest X-ray training towards infection screening of adults can be efficient. Additionally, an attempt based on realistic scenarios is done to provide easy-to-apply health indicators for evaluating infection rate and aggravation risk to the COVID-19 pneumonia. Future works may exploit our models to discern between COVID-19 viral and non-COVID-19 viral pneumonia once chest X-ray images of COVID-19 will be accessible in sufficient quantity. This should permit to specifically identify COVID-19 infected patients even in a non-epidemic context. Furthermore, reliability of proposed models must be cross-checked by RT-PCR tests and clinical tests before deployment.