# Enhancing an Imbalanced Lung Disease X-ray Image Classification with the CNN-LSTM Model
###### Abstract  
Lung diseases have a significant impact on respiratory health, causing various symptoms and posing challenges in diagnosis and treatment. This research presents a methodology for classifying lung diseases using chest X-ray images, specifically focusing on COVID-19, pneumonia, and normal cases. The study introduces an optimal architecture for convolutional neural network (CNN) and long short-term memory (LSTM) models, considering evaluation metrics and training efficiency. Furthermore, the issue of imbalanced datasets is addressed through the application of some image augmentation techniques to enhance model performance. The most effective model comprises five convolutional blocks, two LSTM layers, and no augmentation, achieving an impressive F1 score of 0.9887 with a training duration of 91 s per epoch. Misclassifications primarily occurred in normal cases, accounting for only 3.05% of COVID-19 data. The pneumonia class demonstrated excellent precision, while the normal class exhibited high recall and an F1 score. Comparatively, the CNN-LSTM model outperformed the CNN model in accurately classifying chest X-ray images and identifying infected lungs. This research provides valuable insights for improving lung disease diagnosis, enabling timely and accurate identification of lung diseases, and ultimately enhancing patients' outcomes. lung diseases; COVID-19; pneumonia; X-ray; convolutional neural networks; long short-term memory +
Footnote †: journal: Applied  
0000-0001-9227-381X-38227. 0000-0001-9227-381X-38227. 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.