# Enhancing an Imbalanced Lung Disease X-ray Image Classification with the CNN-LSTM Model
## 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. [PERSON], [PERSON], [PERSON], [PERSON] and F.I., understood and designed this research; [PERSON] analyzed the data and drafted this paper. All authors critically read and revised the draft and approved the final paper. All authors have read and agreed to the published version of the manuscript. The authors are grateful to the Directorate for Research and Community Service (DRPM) Universitas Padjadjaran, which supports this research under RPLK Grant no. 2203/UN6.3.1/PT.00/2022. Not applicable. Data Availability StatementData is available at Kaggle [33; 34]. The source code of this study is available at [[https://www.kaggle.com/code/jfachrel/covid19-detection-from-chest-x-ray-images-cnn-lstm](https://www.kaggle.com/code/jfachrel/covid19-detection-from-chest-x-ray-images-cnn-lstm)]([https://www.kaggle.com/code/jfachrel/covid19-detection-from-chest-x-ray-images-cnn-lstm](https://www.kaggle.com/code/jfachrel/covid19-detection-from-chest-x-ray-images-cnn-lstm)), accessed on 5 July 2022. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Architectures** & **F1 Score** & **Training Time (s/Epoch)** \\ \hline Inception-ResNet-v2 [18] & 0.8687 & 147 \\ \hline ResNet-50 [27] & 0.9485 & 82 \\ \hline VGG16 [20] & 0.9728 & 93 \\ \hline VGG19 [20] & 0.9679 & 109 \\ \hline CNN (5 convolutional blocks) & 0.9721 & 92 \\ \hline Proposed architectures (CNN-LSTM) & 0.9887 & 91 \\ \hline \hline \end{tabular}
\end{table} 
Table 12: Comparison of the proposed architectures with existing architectures.