A deep learning approach that reads XRay chest images and predicts whether the chest is affected by pneumonia or not using PyTorch.
Property | Values |
---|---|
Pretrained Model | Alexnet |
Optimizer used | Adam optimizer |
Loss function Used | Binary Cross Entropy |
Learning rate | 0.01 |
Mini Batch Size | 16 |
Epochs | 10 |
Seed | 1 |
The dataset is from huggingspace chest-xray-classification. It has up to 5 820 images of labeled Xray Chest images. The data is downloaded within the approach so you don't have to download it yourself.
The above code can be used for Deep Transfer Learning on any Image dataset to train using whether Alexnet or Efficient Net B7 as the PreTrained network.
- Run any model you want that are available (currently Alexnet and Efficient Net B7 are available) and choose the hyperparameters you want
python train.py --model_name <MODEL NAME> --batch_size <BATCH SIZE> --lr <Learning Rate> --epochs <EPOCHS> --seed <SEED>
- A folder called runs will be created in your directory. It's an ouput created bu the SummaryWriter instance of Tensorboard that saves the train/test accuracy/loss values.
To visualise these values, run
%load_ext tensorboard
and then!tensorboard --logdir runs"
.
Make sure to check out the application that I've created in huggingspace using Gradio by clicking here. You can upload any ChestXray image you like and check out what the model predicts!
If you want to contribute and add new feature feel free to send Pull request here
To report any bugs or request new features, head over to the Issues page
- Add loggers functionality.
- Add more models and find better accuracy.
- Add Data augmentation.