Support system for diagnosing pneumonia and COVID-19 through Artificial Intelligence
Perform your test
To make a prediction through a personal image is necessary to upload the desired data. The diagnostic forecast is given as soon as possible.
You can save and test one of our images below:
There are 4 system classification terms. The classes and their descriptions:
Invalid image – The image sent does not correspond to an x-ray image or is incompatible with the size or type requirements (.jpg or .png).
Healthy – The image has typical characteristics of a healthy patient.
Features characteristics of Pneumonia – The image has similar features to images of patients with pneumonia.
Features characteristics of COVID-19 – The image shows similarities with images of patients diagnosed with COVID-19.
In the image analysis, the team opted to develop a tool for detecting patients with COVID-19 using X-ray images. In the first phase of the project, the system identifies whether the patient has a characteristic pneumonia condition, so that in a later stage the correlation with COVID-19 is evaluated. The second phase should start from the collection of a greater number of X-ray images with specific characteristics of COVID-19.
X-ray images were chosen because of their wide availability in health centers and low cost in relation to other existing technologies. Thus, the objective is to create a tool for diagnosing pneumonia cases for wide use by health experts in a simple, easy and fast way.
The purpose of the project is to provide the specialist a diagnosis of the patient’s condition using only an X-ray image in order to assist in the final diagnosis of the patient.
The tool works in a simple and fast way. The person who wants to use the system must insert a frontal x-ray image of the patient’s chest.
Model Elaboration Process
The procedure for preparing the detectors begins with the search for robust databases, which have quality X-ray images and associated diagnosis. Considering the existing correlation between patients with pneumonia and COVID-19, the first stage of the project consisted on identifying whether the patient has pneumonia or not. The system was trained to perform a binary classification. In order to do this, three databases extracted from public platforms were used: Chest X-Ray Images, RSNA Pneumonia Detection Challenge, and Covid Chestxray Dataset. We have a total of approximately 30 thousand x-ray images of varied patients, 55% with pneumonia, 45 % without the condition and 147 records were from patients with COVID-19.
The bar diagram below shows the distribution of the number of samples per class for the pneumonia databases. We can notice the imbalance between the number of samples per class.
Data set used (Total number of images for training)
Chest X-Ray Images
RSNA Pneumonia Detection Challenge
Quantitative images of each class: ‘1’ for people with pneumonia and ‘0’ for people without pneumonia. The image on the left shows the Chest X-Ray database and the image on the right side shows the RSNA Pneumonia Detection Challenge database. We can notice that both databases are out of balance.
The first task consisted on organizing the images through the oversampling process in order to achieve a balance between the number of classes.
Once identified if the person has a characteristic pneumonia, another classifier is responsible for determining whether the type of pneumonia corresponds to the characteristics associated with COVID-19. In this last stage of the process, the model was trained with images of patients with pneumonia associated with other diseases, being viral or bacterial type, in addition to the images of COVID-19.
In general, both systems were designed using Deep Learning neural networks of convolutive topology. Naturally, a neural network is composed of several layers and each one has a specific function in extracting information from the image. Generally, complex problems require more extensive and equally complex topologies, consistent with the case addressed.
The training stage is equivalent to a repetitive network test process. An image of the database is inserted into the network and the result is compared to the real value. As the network fails, the correction and updating of its internal parameters are performed to improve its predictive effectiveness. At the end of this training process, the chosen neural network will serve as a forecasting model.
The figures below show the performance curves of the network during the training and test stages, in the first table the accuracy is shown and in the following table the loss function. It is observed that the neural network achieves a good prediction accuracy, reaching around 94% accuracy in the training base and the training curve reaching an average value of approximately 92% accuracy.
Accuracy curves of the model throughout the training phase. The blue curve is for training with the database part and the orange curve represents the validation with the other part of the set of images.
Curves of the model’s loss function throughout the training phase. The blue curve is for training with the database part and the orange curve represents the validation with the other part of the set of images.
Receiver Operation Characteristic Curve, ROC in English. Representing the model’s performance in the diagnosis of pneumonia.
The following are selected some examples of images that compose or database for training the neural network.
Figure: The images in the left spine were diagnosed without pneumonia and those in the right spine have a diagnosis of pneumonia.
Forecasts and results
The system must be powered by a single image at a time in order to perform inference. Initially the image passes over a filter where it only allows the x-ray images to be tested, otherwise the result of the image will be classified as ‘Incompatible image’.
Therefore, the system generates the patient’s diagnosis as possible results, and can be classified as ‘Healthy’, with ‘Pneumonia characteristics’ or ‘COVID-19 characteristics’. In addition to these classification terms, the reliability value of such an inference is also displayed. The higher the percentage value, the greater the certainty of the patient’s diagnosis.
Capabilities and limitations
The system performs the diagnosis using x-ray images of the instantaneous state. An x-ray image obtained at an early stage of the disease may not clearly show the characteristics of pneumonia or COVID-19, even if the patient has symptoms and this has led the specialist to perform an x-ray image. x.
It is worth mentioning that the system requires sending x-ray images only. It is possible that tomography or even magnetic resonance images will be accepted violating the filter, however, this does not guarantee the proper diagnosis of the test.
Embedding of Images
To improve something using machine learning we often need to be able to measure it. TensorBoard is a tool to provide the necessary measurements and visualizations during the machine learning workflow. It allows us to track metrics of experiments such as loss and accuracy, view the model graph, design incorporations in a lower dimensional space and much more.