Skip to content

rigvedrs/Pneumonia-Detection-from-X-Ray-Images

Repository files navigation

Pneumonia-Detection-from-X-Ray-Images🩺

Detection of pneumonia from X Ray images using Pytorch

The architectures used are ResNet9, ResNet18 and other custom CNN models. The final model selected for use is ResNet18. Hyperparameters have been selected using optuna. Evaluation has been done using k fold cross validation for the final ResNet model. Ensembling used for 5 ResNet models trained on 5 different fold of the training Dataset

Dataset 📂

  • The dataset has been taken from Kaggle Chest X-Ray Images (Pneumonia) dataset which consists of Chest X-ray images (anterior-posterior) selected from retrospective cohorts of pediatric patients of one to five years old from Guangzhou Women and Children’s Medical Center, Guangzhou.
  • The dataset is organized into 3 folders (train, test, val) and contains subfolders for each image category (Pneumonia/Normal). There are 5,863 X-Ray images (JPEG) and 2 categories (Pneumonia/Normal)

Pneumonia Images (grayscaled) 🔬

pneumonia images

Normal Images (grayscaled) 🔬

Normal images

Pneumonia vs Normal Images 📊

Pneumonia vs Normal

Notebook 📙

Ideas and Techniques Implemented 💭

  • Basic Data preprocessing involving:
    • Understanding data
    • Transforming data
      • Applying Random Rotations
      • Normalizing RGB values
      • Resizing
  • Models used:
    • ResNet9
    • ResNet18
    • Other custom CNN models
  • Weight decay
  • Automatized Hyperparameter search using optuna
  • K Fold Cross Validation
  • Ensembling, by dividing the training data into 5 folds and training 5 ResNet18 models seperately with the seperate folds of data and using the average of their outputs as the final prediction.

Losses and accuracies recorded 📈

ResNet9:

ResNet9

Custom CNN model:

Custom

ResNet18:

ResNet18

Final Outputs:

output

Accuracies Recorded: 🎓

  • ResNet9:
    • Training 56%
    • Testing 51%
  • Custom CNN:
    • Training 97%
    • Testing 84%
  • ResNet18:
    • Training 96%
    • Testing 91%
    • After ensembling 94%

About

Detection of pneumonia from X Ray images using Pytorch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published