Hyperparameter Optimization for COVID-19 Chest X-Ray Classification

Ibraheem Hamdi, Muhammad Ridzuan, Mohammad YaqubarXiv 2022

Abstract

Despite the introduction of vaccines, Coronavirus disease (COVID-19) remains a worldwide dilemma, continuously developing new variants such as Delta and the recent Omicron. The current standard for testing is through polymerase chain reaction (PCR). However, PCRs can be expensive, slow, and/or inaccessible to many people. X-rays on the other hand have been readily used since the early 20th century and are relatively cheaper, quicker to obtain, and typically covered by health insurance. With a careful selection of model, hyperparameters, and augmentations, we show that it is possible to develop models with 83% accuracy in binary classification and 64% in multi-class for detecting COVID-19 infections from chest x-rays.

Introduction

While vaccines have changed the landscape of the pandemic, rapid and accessible testing remains a global challenge. The current standard, Polymerase Chain Reaction (PCR), is highly accurate but suffers from high costs—sometimes exceeding $400—slow turnaround times, and limited accessibility in many regions.

Chest X-rays (CXRs) offer a compelling alternative: they are inexpensive, results are available in minutes, and the infrastructure already exists worldwide. However, interpreting these images for COVID-19 requires specialized radiological expertise. This research explores how to automate that interpretation using deep learning, specifically focusing on fine-tuning models to overcome the performance plateaus often encountered in medical imaging tasks. By leveraging the Optuna framework for hyperparameter optimization (HPO), we identify specific configurations that maximize diagnostic accuracy.

Methodology

The study employed a DenseNet-121 architecture, chosen for its efficiency in feature propagation in medical imaging. Rather than training from scratch, the team utilized the TorchXRayVision library, which provides models pre-trained on massive datasets such as CheXpert and NIH.

The core of the approach was a transition from manual experimentation to a structured, automated pipeline using:

  • Hydra-Lightning-Template: For managing complex configurations via YAML files.
  • Optuna: An automated HPO framework using the Tree-structured Parzen Estimator (TPA) sampler to efficiently search the parameter space.
  • Weights & Biases (Wandb): For real-time experiment tracking and logging.

The HPO search space included learning rates, dropout rates, batch sizes, and geometric augmentations (rotation, scaling, shear, and translation) designed to mimic real-world positioning errors in X-ray machines.

Datasets

The study utilized a dataset provided by a Kaggle competition involving the Society for Imaging Informatics in Medicine (SIIM), FISABIO, BIMCV, and RSNA. The dataset comprised over 6,000 DICOM format scans categorized into four labels: 'Negative for Pneumonia', 'Typical Appearance', 'Indeterminate Appearance', and 'Atypical Appearance'. For binary experiments, the data was balanced 50/50 between "Negative" and a composite of the other three classes. A 70:20:10 split was used for training, validation, and testing.

Results and Discussion

Pre-training and Model Selection

A key finding was the impact of pre-training data. Among various versions of DenseNet-121, the model pre-trained on a combination of all available X-ray datasets (the "ALL" model) consistently provided the highest baseline accuracy. This suggests that diverse pre-training data is crucial for specialized medical tasks.

Validation accuracy across different pre-trained DenseNet-121 models.

Hyperparameter Optimization

The HPO process revealed several critical insights:

  • Learning Rate: The model's performance was highly sensitive to the learning rate. Optimization identified a peak validation accuracy at approximately 1.737e-4.
  • Batch Size: Validation accuracy peaked at a batch size of 64 for binary classification and 32 for multi-class. Larger batches tended to degrade generalization.
  • Regularization: Interestingly, adding dropout decreased performance in binary classification but provided a slight boost in multi-class tasks, highlighting that general computer vision "best practices" may not always apply to specific medical binary tasks.
Optimization of the learning rate hyperparameter.

Performance Summary

Through HPO, the researchers achieved a peak accuracy of 83% for binary classification. Multi-class classification proved significantly more challenging, reaching a peak accuracy of 64.38%. The optimization process pushed multi-class accuracy from a baseline of 62.15% to nearly 65% by identifying optimal geometric augmentations, such as specific scale (+/- 1.4%), shear (+/- 5.2%), and translation (27.6%) parameters.

Conclusion

This study demonstrates that optimized deep learning models can transform ubiquitous chest X-rays into a fast, accurate screening tool for COVID-19. While a performance ceiling was observed in multi-class classification—likely due to data scarcity in specific categories—the results underscore the power of automated hyperparameter optimization. Future work will explore GAN-based augmentation to address data imbalances and alternative loss functions to further refine diagnostic precision.

Summary updated

Abstract

Despite the introduction of vaccines, Coronavirus disease (COVID-19) remains a worldwide dilemma, continuously developing new variants such as Delta and the recent Omicron. The current standard for testing is through polymerase chain reaction (PCR). However, PCRs can be expensive, slow, and/or inaccessible to many people. X-rays on the other hand have been readily used since the early 20th century and are relatively cheaper, quicker to obtain, and typically covered by health insurance. With a careful selection of model, hyperparameters, and augmentations, we show that it is possible to develop models with 83% accuracy in binary classification and 64% in multi-class for detecting COVID-19 infections from chest x-rays.
BibTeX
@misc{hamdi2022hyperparameter,
  author = {Ibraheem Hamdi and Muhammad Ridzuan and Mohammad Yaqub},
  title = {{Hyperparameter Optimization for COVID-19 Chest X-Ray Classification}},
  year = {2022},
  eprint = {2201.10885},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2201.10885},
}
Figure