1. Introduction
Lung diseases encompass a wide range of disorders that are prevalent and linked to significant morbidity and mortality [
1]. These disorders can significantly impact the respiratory system, including the lungs, airways, and pulmonary blood vessels. As critical organs responsible for the respiration process, the lungs play an essential role in providing oxygen to the body and eliminating carbon dioxide. However, lung diseases can interrupt this vital process, causing uncomfortable symptoms, such as fatigue, shortness of breath, wheezing, coughing, and chest pain. Diagnosing and treating lung diseases can be challenging due to the wide range of possible causes and symptoms [
2]. Nevertheless, it is critical to identify and treat them early to enhance patient outcomes and lessen the burden of these conditions on society. With ongoing research and advances in technology, there is optimism for improving our understanding and management of various lung diseases.
One of the most widely discussed topics in the field of lung diseases today is COVID-19. The global impact of COVID-19 on lung health has been significant, resulting in a large number of hospitalizations and fatalities worldwide. COVID-19 has served as a painful reminder of the importance of respiratory health and the need for continued study, preparation, and cooperation to successfully handle lung diseases. The global response to the COVID-19 pandemic has stressed the interconnectedness between lung health and public health, pressing on the importance of ongoing study and joint efforts in the field of lung diseases. It is worth mentioning that many people who died from COVID-19 had severe chest congestion and a consequent large decrease in oxygen levels, which raised the risk of massive heart attacks [
3]. On another note, pneumonia is also a type of lung disease characterized by inflammation in the small air sacs within the lungs. It can be caused by different pathogens, including bacteria, viruses, or fungi [
4]. Interestingly, the signs and symptoms of pneumonia have similarities with COVID-19 [
5]. Given this similarity and the fact that different diseases require different treatments [
6], it becomes crucial to accurately identify specific diseases. This ensures that appropriate and distinct treatment approaches can be employed based on the specific lung disease. Because of that, this research aims to identify the classes as COVID-19, pneumonia, and normal.
Radiological images of the lungs provide an alternative approach to diagnosing lung infections. Clinical diagnostic tools, such as X-rays and computed tomography (CT), can effectively assess and describe the condition of the lungs. Although CT scans offer better detection sensitivity, X-ray radiography is more commonly utilized in clinical settings due to its advantages and conveniences, including lower cost and widespread availability in general hospitals [
7]. Thus, X-ray radiography is preferred in many cases, serving as a practical and efficient method for diagnosing lung infections.
Detecting and classifying lung diseases using chest X-ray images is a challenging and complex task. To aid radiologists and accelerate the identification process, researchers have developed deep-learning models [
8,
9,
10]. These models utilize advanced machine learning algorithms and neural networks to analyze and categorize X-ray images based on distinct patterns and features associated with various lung diseases. Furthermore, the emergence of COVID-19 has significantly increased the patient load, placing additional demands on radiologists to accurately identify and diagnose cases. This surge in cases has necessitated more time and energy from radiologists, highlighting the need for efficient and effective diagnostic tools. Deep learning is hoped to be a valuable tool in this context, enabling radiologists to handle the growing workload.
The goal of this study is to create an image classification model that uses deep-learning techniques to speed up the identification of lung diseases, thereby reducing the effort and time involved in the diagnostic process. This model will aid in effectively identifying patients exposed to COVID-19 and those with pneumonia. The major objective is to reduce mistakes and misdiagnoses in lung disease treatment, thereby improving patient care and outcomes. By enhancing the accuracy and efficiency of disease detection, this study endeavors to contribute to the overall optimization of lung disease management and reduce the potential for mishandling of such conditions.
The main contributions of this research are two-fold:
Implementation and selection of the optimal architecture of convolutional neural network (CNN) and long short-term memory (LSTM) deep-learning models for the classification of lung diseases using chest X-ray images. The selection process is based on evaluation metrics and training time, ensuring that the models are efficient and effective in accurately identifying different lung diseases;
Addressing the challenge of an imbalanced dataset by applying various image augmentation techniques. Imbalanced datasets, where certain classes have significantly fewer samples than others, can pose challenges in model training. By employing appropriate image augmentation methods, this research aims to improve the performance of the deep-learning models by artificially expanding the dataset and creating a more balanced representation of different lung diseases.
The remainder of this paper is structured as follows.
Section 2 provides a comprehensive review of the existing scientific literature related to this research.
Section 3 outlines the methodology employed in this research, including the collection and splitting of the dataset.
Section 4 presents the results obtained from the experiments conducted in this study.
Section 5 offers a comprehensive discussion of the findings, conclusions, and recommendations for future research.
2. The Literature Review
Tekerek and Al-Rawe [
11] introduced a classification method based on deep learning to identify lung diseases from chest X-ray images, with a specific emphasis on detecting COVID-19. This approach aims to categorize chest X-ray images into three groups: normal; COVID-19; and viral pneumonia. It employs an eight-layer convolutional neural network that combines MobileNet [
12] and DenseNet [
13] models. The research findings indicate a precision value of 1.00 for COVID-19 and normal cases while achieving a precision of 0.79 for viral pneumonia. The recall values are 1.00 for normal and viral pneumonia and 0.69 for COVID-19. The F1 score is found to be 1.00 for normal, 0.79 for COVID-19, and 0.85 for viral pneumonia. The proposed method achieves an impressive accuracy of 96% and a ROC AUC score of 0.94. These outcomes showcase the remarkable accuracy of the proposed approach in diagnosing and classifying chest X-ray images, surpassing the performance of traditional CNN and MobileNet methods. The method’s high precision and F1 score are particularly important for minimizing false negatives, thereby aiding in the prevention of disease transmission.
Gupta et al. [
14] presented a method that uses deep-learning models, pre-processing techniques, and lung segmentation to improve the precision of COVID-19 detection in chest X-ray images. The study uses InceptionV3 [
15] and U-Net [
16], which are deep-learning models, to process and identify chest X-ray images as either COVID-19-negative or positive. By adding lung segmentation during pre-processing, this study aims to remove irrelevant surrounding information that could introduce bias and create inaccurate results. The results of this study show an amazing accuracy rate of approximately 99% for the most effective models in spotting COVID-19. However, this study also shows the effect of visual noise on model bias and underscores the value of lung segmentation in reducing bias and ensuring more consistent results. This study admits that the current models strongly rely on visible abnormalities in the lungs as signs of COVID-19, and further improvements are necessary to address this weakness.
Badrahadipura et al. [
17] conducted a study utilizing the Inception ResNet-v2 [
18] architecture and transfer learning to classify chest X-ray images into three categories: normal; viral pneumonia; and COVID-19. The dataset consisted of 3616 COVID-19 cases, 10,192 of normal cases, and 1345 cases of viral pneumonia. The model underwent two rounds of training. Initially, the Inception ResNet-v2 layers were frozen, preserving the weights and biases learned from the ImageNet dataset. Only the additional layers were added after the Inception ResNet-v2 was trained. In the second training phase, all layers were unfrozen, allowing for further fine-tuning of the entire model. This research highlighted that the model performed better in classifying images belonging to viral pneumonia and normal classes compared to the COVID-19 class, as indicated by higher precision, recall, and F1 scores. The overall accuracy of the model was reported to be 0.966, with an F1 score of 0.97. These findings demonstrate the potential of using the Inception ResNet-v2 architecture and transfer learning for accurate classification of chest X-ray images, particularly in distinguishing between viral pneumonia, normal, and COVID-19 cases, contributing to advancements in medical imaging and healthcare applications.
Abbas et al. [
19] conducted a study to investigate the application of transfer learning using the DeTraC (Decompose, Transfer, and Compose) deep CNN architecture for COVID-19 chest X-ray classification. DeTraC incorporates a class decomposition mechanism to address irregularities presented in the image dataset. This study demonstrates the effectiveness of DeTraC in accurately classifying COVID-19 cases while also showcasing its robustness in handling data irregularities and the limited availability of training images. Through validation experiments with various pre-trained CNN models, VGG19 [
20] emerged as the most successful model within the DeTraC framework. The experimental results highlight the impressive performance of DeTraC in detecting COVID-19 cases, achieving an accuracy of 93.1% with a sensitivity of 100% in accurately distinguishing COVID-19 X-ray images from both normal and severe acute respiratory syndrome cases.
Goyal and Singh [
5] proposed a framework for detecting COVID-19 and pneumonia in chest X-ray images. The framework is divided into multiple steps, which include dataset gathering, picture quality improvement, ROI estimation, feature extraction, and illness classification. Two publicly accessible chest X-ray datasets are used, and picture quality is improved by utilizing such techniques as median filtering and histogram equalization. Various characteristics, such as visual, shape, texture, and intensity, are retrieved and normalized from each ROI picture. Soft computing approaches, such as ANN [
21], SVM [
22], KNN [
23], ensemble classifiers [
24], and a deep-learning classifier dubbed F-RNN-LSTM, are used for classification. The F-RNN-LSTM deep-learning architecture combines RNN and LSTM for enhanced disease categorization. Experiment findings show that the suggested framework is successful. When compared to previous approaches, the F-RNN-LSTM model achieves an accuracy of roughly 95% while requiring less computing effort.
Demir [
25] introduced an innovative method for detecting COVID-19 from X-ray images by utilizing a deep LSTM model. The model is developed from scratch, offering a unique architecture specifically designed for this purpose. To enhance the model’s performance, the study incorporates such pre-processing techniques as the Sobel gradient and marker-controlled watershed segmentation. This research conducts experiments on a combined public dataset consisting of 361 COVID-19, 500 pneumonia, and 200 normal chest X-ray images. The dataset is divided randomly into training and testing sets, with different ratios tested. The most favorable results are obtained when using an 80% training and 20% testing split. Impressively, the proposed model achieves a perfect 100% success rate across all performance metrics, including accuracy, sensitivity, specificity, and F-score. These findings are particularly remarkable considering the small size of the dataset used in the study.
Pustokhin et al. [
26] introduced the RCAL-BiLSTM model, which combines ResNet [
27], a class attention layer (CAL) [
28], and a Bi-LSTM. The model comprises several stages, including preprocessing, using bilateral filtering [
29], feature extraction, using RCAL-BiLSTM, and classification employing SoftMax. Feature extraction involves ResNet for extracting features, CAL for capturing discriminative class-based features, and Bi-LSTM for modeling class dependencies in both directions. The SoftMax layer is then used to classify the feature vectors into their respective feature maps. Experimental validation is performed on a dataset of chest X-ray images, and the results illustrate the superior performance of the RCAL-BiLSTM model. It achieves high sensitivity (93.28%), specificity (94.61%), precision (94.90%), accuracy (94.88%), F-score (93.10%), and kappa value (91.40%), highlighting the effectiveness of the proposed model for COVID-19 diagnosis.
Hamza et al. [
30] proposed a CNN-LSTM architecture combined with an improved optimization algorithm to address the challenges of multisource fusion and redundant features. The dataset consisted of four classes: COVID-19; normal, viral pneumonia, and lung opacity. The framework includes contrast enhancement and data augmentation to improve the quality and quantity of training samples. Deep transfer learning is utilized in training a CNN-LSTM model and fine-tuning an EfficientNet [
31] model for feature extraction. The overall accuracy achieved was 98.5%.
Fachrel et al. [
32] compared two deep-learning models, namely, convolutional neural networks (CNN) and a combination of CNN and long short-term memory (LSTM). The dataset consists of 4095 CXR images (1400 of normal conditions, 1350 of COVID-19, and 1345 of pneumonia). Both CNN and CNN-LSTM models are evaluated using a confusion matrix and compared in terms of performance. The experimental results demonstrate that the CNN-LSTM model outperforms the CNN model, achieving an overall accuracy of approximately 98.78%. It also exhibits high precision and recall, reaching 99% and 98%, respectively. These findings suggest that the proposed CNN-LSTM model can contribute to fast and accurate COVID-19 detection.
The previous studies primarily focused on the development of deep-learning algorithms and certain preprocessing methods to classify lung diseases. Furthermore, the utilization of LSTM networks has been recognized as an effective approach to achieving higher performance scores [
5,
25,
26,
30,
32]. To the best of our knowledge, the problem of imbalanced datasets has been given limited consideration in these studies. Therefore, our research aims to address this gap by focusing on selecting the optimal architecture for the CNN-LSTM model and tackling the challenges associated with imbalanced datasets. We plan to employ various image augmentation techniques to improve the model’s performance and enhance its ability to handle imbalanced data.
5. Conclusions
The analysis of chest X-ray images for COVID-19, pneumonia, and normal cases was conducted using a combination of convolutional neural network (CNN) and long short-term memory (LSTM) models. These findings highlight the significant potential of deep-learning models, particularly the CNN-LSTM architecture, in greatly enhancing the accuracy of lung disease classification. This research emphasizes the critical importance of selecting appropriate architectures tailored to specific tasks and underscores the numerous advantages of employing CNN-LSTM models in medical image analysis.
Among the evaluated models, the one with five convolutional blocks, two LSTM layers, and no augmentation emerged as the most effective, achieving an impressive F1 score of 0.9887 with a training duration of 91 s per epoch. It is worth noting that the main source of misclassifications was observed in 11 COVID-19 datasets mistakenly labeled as normal, accounting for 3.05% of the COVID-19 data. The pneumonia class demonstrated the highest precision (1.00), while the normal class exhibited the highest recall (1.00) and F1 score (0.99). Through k-fold cross-validation with 10 folds, the average precision, recall, and F1 score were calculated to be 0.97, 0.96, and 0.9776, respectively. Overall, incorporating an LSTM layer into the CNN model can improve the classification of chest X-ray images and effectively identify infected lungs. The addition of the LSTM layer allows the model to capture temporal dependencies and effectively model sequential information present in the images. By considering both spatial and temporal information, the CNN-LSTM architecture enhances the accuracy and robustness of the classification task. This combination of CNN and LSTM networks proves to be valuable in medical image analysis, particularly for the detection and diagnosis of lung diseases.
The results of this research provide valuable insights for future studies. To improve the accuracy and reliability of the model, it is recommended that the next study focus on cleaning and organizing the data prior to modeling. This step can help reduce misclassification and enhance the model’s performance. Additionally, for further development and to broaden the scope of the study, it is suggested to include more types of lung data, such as lung cancer and tuberculosis. This would enable the model to identify a wider range of lung diseases and provide more comprehensive and accurate results.