Try the live demo here => https://pneumonia-detection-dl.herokuapp.com/
This project aims to detect pneumonia from chest radio graph images. This project uses data from the RSNA Pneumonia Detection Challenge. The results and evaluation metric plots presented here also uses the same metric as was in the competition.
Feel free to improve upon the project by using the TRAINING Kaggle notebook and TEST Kaggle notebook.
This project used the PyTorch deep learning framework. Use PyTorch version >= 1.4 to reproduce the results.
Get the competition data from here.
The following is the directory structure of the project. You will be able to directly
───faster_rcnn_resnet_final_project
│ │ dataset.py
│ │ dcm_to_jpg.py
│ │ engine..py
│ │ fasterrcnn_resnet50_fpn.pth
│ │ loss.png
│ │ model.py
│ │ precision.png
│ │ README.md
│ │ submission.csv
│ │ test.py
│ │ train.py
├───input
│ │ stage_2_detailed_class_info.csv
│ │ stage_2_sample_submission.csv
│ │ stage_2_train_labels.csv
│ ├───images
│ ├───samples
├───test_predictions
faster_rcnn_resnet_final_project
: This contains all the files including the python scripts that you see in this repository.input
: This contains the training images in JPG format in theimages
folder and test images in thesamples
folder.test_predictions
will contain all the predicted bounding box results on the test images after you runtest.py
- I have made this really simple.
- Clone this repository to your local disk.
- Run the
requirements.txt
file usingpip install -r requirements.txt
. - Run the
app.py
script usingpython app.py
. - Open
127.0.0.1:12000
in your browser. - Choose a lung x-ray image from your disk and click on the
Predict
button.
- First run
dcm_to_jpg.py
to convert all the DICOM images to JPG images and save them in theinout/images
folder. Change the paths according to your need if want to structure your project differently. - Then run
train.py
to train a Faster RCNN ResNet50 backbone model on the data. I have trained the model for 30 epochs to obtain the results. You may train for longer if you want to. - Finally run
test.py
to predict on the test images present in theinput/samples
folder.
If You Want to Directly Predict on the Test Images, Then Download the Weights from THIS KAGGLE NOTEBOOK.
You will also find the test notebook here.
-
The following the private and public leaderboard score as per the competition metric of Average Precision.
Private Leaderboard Public Leaderboard Average Precision 0.12993 0.11904 -
Validation Precision Plot
-
Loss Plot
-
Detection on a Test Image