# PELM: A Deep Learning Model for Early Detection of Pneumonia in Chest Radiography
## 3 Materials and Methods
### Contrast Enhancement with CLAHE  
To enhance the visibility of thoracic anatomical structures in low-contrast chest X-ray (CXR) images, Contrast Limited Adaptive Histogram Equalization (CLAHE) was employed as a key component of the preprocessing pipeline. The enhancement was applied specifically to the luminance (L) channel after converting the original RGB images to the LAB color space, ensuring that contrast adjustments did not introduce distortions in chromatic information.  
CLAHE was configured with a clip limit of 2.0 and a tile grid size of 8 \(\times\) 8--hyper parameters carefully selected to improve local contrast while minimizing the risk of noise over-amplification. This approach significantly improved the delineation of diagnostically relevant features such as cardiac borders, lung fields, and mediastinal structures, thereby facilitating more accurate feature extraction by deep learning models.  
To standardize image appearance across diverse datasets, a binary K-Means clustering algorithm was utilized to automatically identify white-background images, which were subsequently inverted to match the conventional dark-background format used in CXR interpretation. This consistency in preprocessing enhanced cross-dataset compatibility and improved the model's ability to generalize across varying acquisition formats. A summary of the applied augmentation techniques and their clinical motivations is provided in Table 4.  
These augmentations were applied during training to increase data diversity and reduce the risk of overfitting.  
While an ablation study isolating the individual contributions of each augmentation technique was not conducted in this work, prior literature has consistently demonstrated their utility in radiographic imaging tasks. As such, our augmentation pipeline was designed based on clinically grounded heuristics and best practices in medical image preprocessing. In future work, we intend to conduct a systematic ablation analysis to quantify the incremental performance gains attributable to each transformation. Examples of the applied data augmentation techniques, including CLAHE, are presented in Figure 5.  
As a result of the full data augmentation pipeline--including random rotation, controlled zooming, horizontal flipping, and CLAHE-based contrast enhancement--the dataset was expanded and standardized to contain 50,000 chest X-ray (CXR) images. The dataset was evenly balanced between pneumonia and non-pneumonia cases, with the latter encompassing both normal radiographs and other thoracic pathologies such as fibrosis, nodules, and cardiomegaly. Images were sourced from four publicly available datasets: NIH ChestX-ray14, CheXpert, PadChest, and Kaggle CXR Pneumonia.  
To support robust model development and evaluation, the dataset was partitioned into training (40,000 images), validation (5000 images), and testing (5000 images) subsets. Class balance was preserved across all splits to ensure fair performance comparison and  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Augmentation** & **Range/Setting** & **Clinical Purpose** \\ \hline CLAHE & clipLimit = 2.0, grid = 8 \(\times\) 8 & Enhances local contrast in low-density lung regions, improving feature visibility. \\ Horizontal Flip & 50\% chance & Simulates left/right orientation variable, compromising diagnostic integrity. \\ Translation & Max \(\pm\)12 pixels (approximately 5\%) & Models minor patient positioning variable image acquisition. \\ Rotation & Max \(\pm\)5\({}^{\circ}\) & Preserves heart silhouette stability with slight orientation tolerance. \\ Zoom & 95–105\% & Simulates small magnification changes, introducing anatomical distortion. \\ \hline \hline \end{tabular}
\end{table}
Table 4: Augmentation settings and clinical purpose.  
Figure 5: Data augmentation samples.  
mitigate sampling bias. The detailed breakdown of the augmented dataset is presented in Table 5.