1 INTRODUCTION

Pulmonary diseases are characterized by a wide spread and a steady rise all over the world. Taking into account the fact that the COVID-19 pandemic continues, the problem of lung disease diagnostics becomes urgent. Undoubtedly, X-ray examination is the main method and an integral part of a complex diagnostics of patients with pulmonary pathologies. In most of the cases, the data obtained prove to be crucial for establishing the character of the pathological process and evaluating its dynamics, treatment results, and subsequent prognoses. Therefore, in the mass screenings, a radiologist has to analyze a lot of X-ray images with a quality which is not always satisfactory and with a relatively low resolution. Such an analysis requires a high professionalism and presupposes the capacity of recognizing even insignificantly pronounced changes in the brightness of the the X-ray image points with the purpose of evaluating the volume of the pulmonary damage [1], as well as the capacity of revealing anomalous structures. This work is very laborious and may lead to errors because of peculiarities in the subjective visual perception of images.

Modern radiology has passed a long path of development from a simple analog X-ray tube to powerful digital technologies. Development of information decision support systems in these investigations started already in the 1950s [2]. Nowadays, the technologies based on application of the artificial intelligence (AI) and machine learning (ML) as its main part go top in the process of automation of the differential diagnostics of the thoracal pathology. At present time, it is common to consider the AI as one of the information technology directions which deals with studying and developing the systems that model the capabilities of the human intelligence such as the ability for learning, logical reasoning, drawing conclusions, and making decisions [3].

One can entirely agree with the conclusions of numerous researchers, according to which development of intellectual automation diagnostics systems (IADS) is one of the approaches contributing to a high-quality radiodiagnostics data processing [4]. The urgency of the modern research concerning development of the IADS is indisputable, first of all, from the viewpoint of the world trends, especially during the COVID-19 pandemic period. At that, the main problem of medical researchers consists in analyzing modern diagnostic techniques and formal describing the algorithms of classification of the main X-ray syndromes for determining the types of lung tissue pathologies in the visual analysis of X-ray images.

Nowadays, active investigations are being carried out in this research domain. In particular, a site is created that provides the users with the most advanced software products for their application to the practice [5]. There are numerous publications in the scientific literature about the achievements in solving this problem 69]. Despite this, no wide implementation of the developed software-algorithmic means happens. In our opinion, first of all, this is related to the attempts to develop and realize automated intellectual diagnostic systems at the same time.

The complexity of this problem is evident. The images obtained are difficult to interpret for any person that is not a radiologist. Some progress is achieved in solving the problem with the use of artificial neural networks (ANNs). As is known, their common disadvantage is the necessity of their relearning. Thus, in the process of learning with using some concrete data array, the ANNs find solutions with an acceptable accuracy; however, when dealing with other series of similar images obtained under close conditions and at similar apparatus, the diagnostics results drastically worsen.

For this reason, in this study, we propose not a conventional method for solving this problem based on diagnostics of diseases by training the ANN by using numerous examples; instead, we propose the approach using the method approved in practice for visual classification of pathologies; it is based on the decision tree and uses distinguishable features in the X-ray images (extensive or limited shading, brightening, etc.). A decision in particular tree nodes should be made under the radiologist’s control in the interactive mode. Progressively adapting to the existing conditions, the neural network will enhance the reliability of its decisions, which will allow considering them with a growing confidence, up to the slightest deviations in the conditions of registration or in the disease peculiarities.

Development and investigation of the efficiency of the algorithms of the diagnostics of lung pathologies based on the multilayer artificial neural networks of deep machine learning are a principally important step to designing intellectual automated systems that would make it possible to accelerate the process of disease diagnostics and reduce repeated examinations.

2 PROCEDURE OF DIAGNOSTICS OF LUNG PATHOLOGIES

Nowadays, artificial intellect is a hightly competitive domain of development of the next-generation technologies. Therefore, the aim of our study is creating an available software product for the most widely used screening procedures in radiodiagnostics.

To examine the patients with pulmonary diseases, as well as with lung and mediastinal injuries, it is possible to use various radiologic methods and procedures. Usually, examination of the thoracic cavity organs (TCO) begins with a classical X-ray examination. At this stage, one uses the most available main radiologic methods: X-ray radiography, photofluorography, and roentgenoscopy.

X-ray radiography of TCOs is carried out in the form of plain films in the frontal (usually, anterior) and lateral (corresponding to the affected side) projections with obtaining a shading image of all anatomical structures of this area. In the standard variant, the examination is carried out in the vertical position of the patient at the height of a deep breath (with the purpose of increasing the natural contrast of the lungs). For detailed examination of the desired areas, it is possible to take target images. In the case of digital X-ray radiography of TCOs, the corresponding information is provided in the digital electronic form and is visualized at a monitor [10].

Photofluorography of TCOs is used mainly for preventive mass screenings with the purposes of early recognition of the pulmonary tuberculosis and lung cancer above all. The main advantage of this procedure is its economy; its capacity is up to 150 people per hour. Owing to the possibility of obtaining a large-frame image (\(100\times 100\) mm, \(110\times 110\) mm), photofluorography is now used as a diagnostic procedure. The advantages of X-ray radiography and photofluorography are their high resolving power, objective documentation of the revealed changes, which makes it possible to judge reliably about their dynamics, comparing the current images with the previous or subsequent images.

Roentgenoscopy of TCOs is carried out only according to strict medical indications after analyzing X-ray images and fluorograms. The use of roentgenoscopy is limited because of a significant radiation exposure of the patient, the absence of documentation, and its less resolving power [11].

Taking into account the fact that modern digital fluorographs are widely spread in the subjects of the Russian Federation, photofluorography is chosen as the main method for examination of TCOs in this study.

To classify the diseases according to the X-ray images, it is proposed to use artificial neural networks with machine learning, whose characteristic feature is model learning by numerous examples of solving similar problems instead of their direct solving. In the process of machine learning with no assistance of people, recognition of inner (hidden) regularities is carried out. Based on them, the trained neural network makes a decision about attributing the classified objects to this or that class. The more training data are processed by such a neural network, the more accurate result of its operation will be obtained.

Owing to the adaptive character of machine learning, it corresponds well to the scenarios in which the data are permanently varying, the properties of requests or tasks are unstable, and the development of concrete algorithms for solving diagnostics problems is practically impossible, which is observed when interpreting roentgenograms and fluorograms. Deep learning is a specialized form of machine learning used for tuning the parameters of multilayer neural networks, which make it possible to classify information in the same way as the human brain does. The majority of modern AI systems are based on such neural networks.

Various algorithms of X-ray image classification are often grouped according to the machine learning methods used in them: supervised learning, unsupervised learning, and reinforcement learning. In the supervised learning, the algorithms provide forecasting based on a set of labeled examples. This procedure can be used in the case where the number of such examples is sufficiently large.

Unsupervised learning is applied when the information about the classes of objects in the training data set is absent. The algorithm labels them automatically based on their distribution in the used feature space.

In the reinforcement learning, the used algorithms have a feedback and are trained with the use of the results obtained [12]. After each made decision, the algorithm receives the response that helps to determine if the made choice is correct, neutral, or incorrect and to correct its parameters. This makes it possible to adapt the classification algorithm to the data obtained and leads to a gradual improvement of its accuracy. To solve the problem of differential diagnostics of the lung pathologies based on X-ray images, it is necessary to collect and prepare a data set, train the model, test it, make its additional training, and interpret the results obtained. At the first stage, after X-ray image collection, the information is compiled; as a result of the analysis, anomalies are revealed and the data integrity problem is solved. At the second stage, the X-ray images from the prepared databases are divided into the set for training (learning sample) and the set for testing. The learning sample is a large part of the data used for training the neural network model. The second set is used to evaluate the accuracy of the network in the learning process and after its completion. In the learning process, the images from the first set are put to the model’s input and the results obtained are used to correct the configuration and coefficients of the neural network so as to minimize its total error. As each cycle (learning epoch) is completed, the integral estimation of the accuracy of classification is performed for the learning and test data sets. With this purpose, all the images from each set are put sequentially to the input of the model with current coefficients and the accuracy of classification is determined as the part of the correctly classified X-ray images.

When the learning procedure is completed, the efficiency and accuracy of the model are estimated. With this purpose, newly registered images are put to the model’s input and the classification efficiency is verified by a radiologist. After processing the current series of X-ray images, the additional training of the previously formed model is carried out with the use of the positive and negative examples of the last series.

At the interpretation stage, the data obtained are analyzed for determining the operating capacity of the IADS and prognosis of its efficiency.

Radiologic manifestations of pathological processes in the lungs are multiform; however, they are based only on four phenomena: shading or brightening of the lung fields; changes in the lung pattern, and changes in the lung roots. Having revealed these pathological changes on the X-ray images, it is possible to determine their correspondence to radiological syndromes.

In radiology, one can distinguish nine syndromes [13] that reflect all the multiform pathology of the respiratory organs (Fig. 1):

Fig. 1
figure 1

The main radiological syndromes of the affection of the respiratory system: 1—total (subtotal) shading of the lung field, 2—limited shading, 3—round shade, 4—ring-shaped shade (round cavity), 5—nodes and limited nodal disseminations, 6—extensive nodal disseminations, 7—extensive brightening, 8—change in the lung pattern, 9—change in the lung roots.

(1) total (subtotal) shading of the lung field;

(2) limited shading;

(3) round shade;

(4) ring-shaped shade (round cavity);

(5) nodes and limited nodal disseminations;

(6) extensive nodal disseminations;

(7) extensive brightening;

(8) change in the lung pattern;

(9) change in the lung roots.

At first, it is necessary to divide the X-ray images into the groups corresponding to nine above-indicated syndromes and then, to work with each group separately. So, it is needed to carry out the intra-syndrome differential diagnostics, determine the general character of the pathological process, and establish a concrete form of disease. According to these syndromes, classification of the radiograms with no pathologies and those with various features of thoracic pathology is carried out; then, the reference X-ray images (with no combined pathology) are selected from 100–300 radiograms for each feature (with a subsequent augmentation of their number).

In radiology, the decision tree algorithm is used quite successfully and actively. This algorithm is one of the most effective tools of intellectual data analysis and predictive analytics, which allow solving the classification problems. They are hierarchic tree-type structures that consists of the decision rules of the form ‘‘if …, then …’’ and perform verification of the correspondence of the analyzed X-ray images to some feature of the training set. An example of the algorithm of differential diagnostics of diseases with the extensive shadowing syndrome is shown in Fig. 2 (the mediastinal organs are not displaced—displaced; the displacement is towards the shadowing—in the opposite direction etc.).

Fig. 2
figure 2

Algorithm of differential radio diagnostics of the lung diseases with a syndrome of extensive shadowing.

According to the same principle, the decision trees are formed for other thoracic pathology syndromes. In addition, the mechanism of determining the syndrome of cavity formation from the main radiologic parameters is introduced into the algorithm of diagnostics (Fig. 3).

It is reasonable to use the proposed approach for development of the software-algorithmic support of the differential automated diagnostics of complicated lung diseases such as pulmonary tuberculosis, different forms of which combine various radiologic syndromes (Fig. 4). At that, it is necessary to take into account the results of interpretation made by radiologists.

Fig. 3
figure 3

Stages of cavity formation: (a) cavity is being formed, (b) formed new (elastic) cavity, (c) old (fibrous) cavity.

Fig. 4
figure 4

Formes of pulmonary tuberculosis in the radiologic image: (a) tuberculous primary complex, (b) tuberculosis of the intrathoracic lymphatic nodes (infiltrative form), (c) tuberculosis of the intrathoracic lymphatic nodes (tumor-like form), (d) nodal pulmonary tuberculosis, (e) miliary tuberculosis, (f) disseminated tuberculosis, (g) infiltrative tuberculosis (lobitis), (h) infiltrative tuberculosis in the lysis phase.

So, to create intellectual systems of lung pathology classification from radiologic images based on the decision tree realized with the use of multilayer neural networks of deep learning, it is necessary to form the databases for learning the main syndromes and particular features of differential radio diagnostics. For each feature, it is necessary to have several hundreds of positive examples with a subsequent augmentation of their number in the process of the ANN operation under the control of radiologists.

3 EXPERIMENTAL INVESTIGATIONS

To demonstrate the efficiency of using the neural network technologies in lung disease diagnostics, let us take an example of distinguishing between the radiograms of healthy people and those with tuberculosis. The investigations were performed with the use of the commonly accessible X-ray database of TCO created by a group of researchers of Qatar University (Doha, Qatar) and University of Dhaka (Bangladesh) together with their colleagues from Malaysia in collaboration with doctors from Bangladesh and Hamad Medical Corporation [14]. This database contains 3500 X-ray images of healthy people and 3500 X-ray images of those with tuberculosis. It should be noted that this group of researchers succeeded in classifying the tuberculosis and normal chest X-ray images with an accuracy of 98.6\(\%\) [15].

As a ANN, they used the model of the AlexNet neural network preliminarily trained by using the ImageNet set of images and taken from the PyTorch library [16]; it consists of five convolutional layers sequentially performing convolution of X-ray images with a small kernel and three fully connected layers performing classification itself.

All the images were randomly divided into two sets. The first of them was used for additional training of the network model; the second, for estimation of its accuracy in the process and after the completion of this procedure. At that, the weight coefficients were tuned only for three fully connected layers of the classifier. In the training process, X-ray images from the first set were put to the model’s input in the cycle and the weight coefficient were corrected, according to the results of its operation so as to minimize the total network error. After the completion of each cycle of presentation of learning examples (training epoch), the integral estimation of the classification accuracy was performed for the training and test sets. With this purpose, to the model input with current coefficients, all the images of each set were put successively and the classification accuracy was determined as the part of correctly classified X-ray images. The learning process was limited by 20 epochs. The accuracies obtained in the process of performing the above procedures (after each training epoch) are shown in Fig. 5.

Fig. 5
figure 5

Network accuracy at different stages of learning: (1) for the training set, (2) for the test set.

It is seen that in the process of learning, the classification accuracy of both the training and test X-ray image sets grows progressively from one epoch to another and reaches the values of 99.5\(\%\) in the first case and 98\(\%\) in the second case. It follows from this that the resulting model is capable of distinguishing the X-ray images of the healthy and ill people with the above indicated accuracy. At that, it is important for the X-ray images presented for the diagnostics to be related to the same forms of tuberculosis and contain similar radiological syndromes as the X-ray images of the training set. A necessary condition is also the consistency of the data formats and parameters.

In the presented experiment, this requirement is fulfilled, since the training and test sets were formed from the same data set. In the general case, it may be not fulfilled. In particular, the X-ray images obtained at different equipment can have different brightness, contrast, and digit width of the data, as well as a nonlinearly distorted transfer characteristic. To reduce the influence of the latter factor on the classification accuracy, before presentation of images to the model input, they were reduced to the identical spatial resolution and digit width; their brightness was transformed by matching histograms.

Figure 6 shows the example of operation of the ANN model for eight images registered with the help of equipment of the Siberian Branch of the Russian Academy of Sciences, Berdsk Municipal Clinical Hospital no. 1, Berdsk Central Clinical Hospital, OOO MSC VEGA (Berdsk). Here, for each image, the number of the class chosen by the model and the reliability of the made decision in percentage terms are indicated.

Fig. 6
figure 6

Result of model operation for eight X-ray images: (a) class 1 (88.58\(\%\)), (b) class 2 (91.32\(\%\)), (c) class 2 (91.52\(\%\)), (d) class 1 (88.62\(\%\)), (e) class 1 (64.41\(\%\)), (f) class 2 (89.53\(\%\)), (g) class 1 (67.50\(\%\)), (h) class 1 (97.82\(\%\)).

In this case, four images with obvious signs of tuberculosis (Figs. 6b, 6c, 6f, and 6g), two images with no pathologies (Figs. 6a and 6h), and two images (Figs. 6d and 6e) with deviations other than tuberculosis were used. The analysis of the results shows that the model trained on the public X-ray image database [8] has successfully solved the diagnostics problem for seven images of the presented set. An error was made only for one image (Fig. 6g) that contained a small low-contrast calcification in the region of the second rib in the left-hand part of the lung, which is difficult for recognition in the visual observation as well. At that, the use of such an ANN model for classification of a set of 50 images obtained with the help of the same equipment at the initial stages of disease (with weakly pronounced symptoms) has shown that it is unable to solve this problem.

4 CONCLUSIONS

Creation of large databases of radiologic images allows proceeding to designing the intellectual systems of differential diagnostics of lung pathologies with a control of their efficiency. To determine the type of lung tissue pathologies, it is proposed to use in such systems the tree-decision algorithm used by diagnosticians in the visual analysis of X-ray images and based on estimation of the quantitative characteristics of pathological structures. It is a hierarchic tree-like structure consisting of the rules of the form ‘‘if …, then …’’. The solving rules at each node verify the correspondence of the X-ray image to some criterion based on the binary classification with the use of neural network technologies. The formalized description of the algorithm for determining the type of lung tissue pathologies is presented.

By the example of classification of the X-ray images of healthy people and those with tuberculosis, the efficiency of the use of neural network technologies for diagnostics of lung diseases is demonstrated. The experimental investigations performed with the use of the public chest X-ray image database allowed reaching a classification accuracy that exceeds 98\(\%\). At that, it is important that the images presented for diagnosis must be related to the same form of tuberculosis and contain similar radiologic syndromes as the images of the training set.

It should be noted that ANN learning requires quite a long time. Thus, 20 epochs of training of the AlexNet network by a set of 7000 images at the computer (with a processor Intel Core i3 3.60 Hz, random-access memory of 16.0 Gb without GPU) took about 50 min. However, the procedure of diagnostics of one X-ray image is performed for centiseconds.

It is convenient to use the results when developing automated intellectual systems of differential diagnostics of pulmonary diseases with application of multilayer neural networks. This gives a possibility of creating clinically relevant applications that perform the analysis of the general regularities of diseases, correlation analysis of revealed symptoms, and generation of radiologic reports.