Automatic detection of pneumonia in chest X-rays using Lobe deep residual network

: One of the critical tools for early detection and subsequent evaluation of the incidence of lung diseases is chest radiography. At a time when the speed and reliability of results, especially for COVID-19 positive patients, is important, the development of applications that would facilitate the work of untrained staff involved in the evaluation is also crucial. Our model takes the form of a simple and intuitive application, into which you only need to upload X-rays: tens or hundreds at once. In just a few seconds, the physician will determine the patient's diagnosis, including the percentage accuracy of the estimate. While the original idea was a mere binary classifier that could tell if a patient was suffering from pneumonia or not, in this paper we present a model that distinguishes between a bacterial disease, a viral infection, or a finding caused by COVID-19. The aim of this research is to demonstrate whether pneumonia can be detected or even spatially localized using a uniform, supervised classification.


Introduction
Chest radiography is an important tool for early detection and subsequent verification of lung diseases. These are devices that are easily accessible, and the price of scanning is only in the order of few dollars (Du et al. 2021). However, in the current pandemic situation of COVID-19, we encounter a lack of radiologists and trained staff to analyze the vast number of images taken. The limited availability of high-resolution computed tomography and polymerase chain reaction (RT-PCR) in countries with high patient turnover underlines the importance of chest X-rays as a suitable tool for screening and diagnosis.
To date, the most widely used method for detecting COVID-19 pneumonia is the RT-PCR test, which takes approximately 4 hours to evaluate (Gandhi et al. 2020). With the time needed for collection and transport, we can thus range in the range of days, with not every region having an evaluation center; not to mention the price of up to several hundred dollars (Du et al. 2021).
Reliability converging to 100% does not appear until the third repetition (Gandhi et al. 2020).
Another method is represented by antigen tests, which offer cheaper and faster detection, but a positive result might be shown only if the individual is at the stage of greatest risk of transmission. An increasingly common procedure is the detection of antibodies, but these are found in the body one to three weeks after the infection (Mina et al. 2021). The aim of this research is to present a deep learning approach that would eliminate the time and resources needed to develop new technologies and related algorithms. The results presented in this text suggest that the Lobe application based on the deep residual network ResNet-50 could represent an optimal solution for the detection of X-ray findings of pneumonia with a success rate of up to 99%.

Applied deep neural network architecture
It is the unpretentious and user-friendly form of the used model that is the decisive factor why we believe that the application of pulmonary findings detection mentioned below has the potential for use in practice. Despite the simple design, the program hides one of the most modern solutions for pattern recognition in image data (Papers with Code 2021). The ResNet-50 deep neural network, first presented by He et al. (2015), introduces state-of-the-art computer vision technology. This architecture uses a method of extracting features from image files, thanks to which the network learns according to which perceptions it can sort individual images into different classes. Because the findings falling under the same class show similar deviations, 3 the application uses a prediction capability, which then divides the new images into previously segmented classes. Deep convolutional networks are an ideal solution for extracting features from image data, while stacking multiple layers improves prediction capabilities to some extent. Here, however, we encounter a known limitation that prevents the convergence of networks with dozens of layers: the problem of vanishing and exploding gradient. Adding additional layers to the model can increase the error value for the training set (Feng 2017). The ResNet-50 architecture consists of five stages, each with a convolutional block and an identity block, which is primarily used as a shortcut connection (He et al. 2015). The convolution block contains three convolution layers, each identity block operating with three convolution layers. The shortcut is used to skip one or more layers, e.g. from the first layer it is possible to skip to the third layer using the shortcut. 4

Summary of previous research
Similar research can be found, for example, in Elgendi et al. (2020) who compared 17 available deep learning algorithms for easier, faster, and most importantly cheaper detection of COVID-19 using chest radiography and the DarkNet-19 deep neural network. As a result,  proved to be the optimal pre-trained network for detecting radiographic images of COVID-19 pneumonia with 94.28% accuracy in 5,854 X-rays available from the Kaggle database and 6 Dataset 3 is a collection of three large datasets that have been collected on the Kaggle datastore.
Following the needs of our research, the individual classes were reduced to a simple distinction between images with and without pneumonia findings. The motivation of this dataset can be defined as a binary classification, where the input is an X-ray of the chest, while the output is a binary label indicating the absence or presence of a finding of pneumonia.

Limitations of the used methodology
Although radiological imaging is a widely available, as well as affordable method, due to the dangers of ionizing radiation from CT and X-ray equipment, it is not suitable for frequent use, and there are other contraindications to this procedure. It is necessary to consider imaging pregnant women, other complications can be caused by the presence of metal objects, the inability of the patient to take a deep full breath or also to adapt the equipment for too thin or obese patients (Uppot 2018).
The disadvantage of all similar studies, apart from the ongoing validation that awaits this research, may be the excessive technical complexity of projects (e.g. the use of MATLAB or Python). The primary goal of this study is therefore to provide a user-friendly environment suitable for inexperienced assessors under stress, and thus help early detection and faster action in patients with more severe stages of the disease. Imaginary barriers may include the impossibility of importing through the traditional DICOM imaging format used for the transmission of biomedical image data within PACS systems. This limitation can be circumvented by implementing the med2image or pydicom libraries.

Discussion
Chest radiography is a widely available and affordable tool for screening patients with symptoms of lower respiratory tract infection or suspected pneumonia. Automatic detection using X-rays can act as an early diagnosis of the disease; this is especially true in areas facing a shortage of trained radiologists. Based on preliminary results, we demonstrate that the use of deep learning methods, hence the ResNet-50 architecture, can be a functional solution for automatic feature extraction from X-rays related to the diagnosis of viral and bacterial pneumonia, or directly to the detection of diseases caused by COVID-19.
However, it is necessary to investigate whether the extracted features segmented by a deep neural network represent reliable biomarkers that help detect lung infection. Follow-up research should focus on the sensitivity of imaging patients with mild symptoms: these symptoms may not be accurately imaged by X-rays or may not even be visible at all. It is also necessary to accept the fact that each medical or experimental workplace scans X-ray images in a different way, including image quality, angle or brightness. Although the research is conceived primarily as a source of initial estimation, we believe that using a sufficiently general dataset, this solution could present great promise for the future. While datasets often contain, for example, only one age group, our follow-up goal is to create a comprehensive database that can be used to generalize the findings.