Skip to content

This repository contains the image classification followed by semantic segmentation of Chest X-Rays to detect a clinical condition called Pneumothorax.

Notifications You must be signed in to change notification settings

NamrataThakur/SIIM-PCR-Pneumothorax-Segmentation

Repository files navigation

SIIM-PCR-Pneumothorax-Segmentation

BLOG : https://namrata-thakur893.medium.com/medical-image-classification-and-segmentation-a-case-study-approach-6b5c7a73b9f5

Demo Deployed App:

Final Product

Business Problem:

Pneumothorax is a medical condition which arises when air leaks into the space between the lung and the chest wall. This air pushes on the outside of the lung and makes it collapse. Thus, pneumothorax can be a complete lung collapse or a portion of the lungs may be collapsed. Pneumothorax can be caused by a blunt chest injury, damage from underlying lung disease, or sometimes for no obvious reason at all. It can be a life-threatening event. Pneumothorax is usually diagnosed by a radiologist on a chest x-ray, and can sometimes be very difficult to confirm. The problem that this case study is dealing with predicts whether the condition exists in the chest x-ray image given and if present it segments the portion of the lungs that is affected. An accurate prediction would be useful in a lot of clinical scenarios to triage chest radiographs for priority interpretation, or to provide a more confident diagnosis for non-radiologists.

Mapping the real world problem as a Deep Learning problem:

The data is comprised of images in DICOM format containing run-length-encoded (RLE) masks. The instances of pneumothorax are indicated by encoded binary masks in the annotations. Some training images have multiple annotations depicting the multiple locations of the event. Images without pneumothorax have a mask value of -1. The task is to predict the mask of pneumothorax in the given X-ray image. This task can be mapped as a Semantic Image Segmentation problem.

Data set Analysis:

Data Source : https://www.kaggle.com/c/siim-acr-pneumothorax-segmentation/overview

Files given: train-rle.csv, stage_2_sample_submission.csv (test_data), train_images, test_images.

Total File Size : 4GB

Total number of records: 12,954 (train_data), 3204 (test_data)

The train-rle.csv contains image IDs and their corresponding RLE masks and the test csv file only contains the image IDs.

Real World Business Constraints:

• Low latency is important.

• Mis-classification/ mis-segmentation cost is considerably high as we are dealing with medical data and thus it is very sensitive to such errors.

Performance Metric:

Metric(s):

  • Dice Coefficient (IntersectionOverUnion/IOU)

  • Combo Loss – (Binary Cross Entropy + Dice Loss/ F1 loss)

  • Confusion Matrix

  • Classification Metrics -- AUC, Precision, Recall

This repository contains the following solution :

  • A) First we classify the Chest X-Rays as either No Pneumothorax Present (Label:0) or Pneumothorax Present (Label:1). This part is the image classification part where we are applying transfer learning technique using the pre-trained model CheXNet (a 121 layer DenseNet model that is fine-tuned on Chest X-Ray images) to classify the images.

  • B) Then, we build the segmentation part where we apply different segmentation models (Unet, Nested Unet and Double Unet with pre-trained VGG19 as backbone encoder) to predict the masks.

  • C) Finally, we build the end pipeline where given an image we predict the label (0/1) and if the label is 1 we pass the image through the segmentation model to get the mask.

Classfication Metrics:

Classification Metrics

Classification ROC

Classification CV CM

Classification Average_Precision_Cureve

Segmentation Metrics:

  • Nested Unet :

Segment_Unet++

  • Weighted Nested Unet :

Segmentation_Metrics

FINAL PIPELINE OUTPUT IMAGES :

  • Positive Prediction :

Final_Inference_Positive

Final_Inference_Positive_2

Final_Inference_Positive_3

Final_Inference_Positive_4

  • Negative Prediction :

Final_Inference_Negative

  • Failure Case :

Failure Cases

THIS REPO IS WORK IN PROGRESS. NEW ADDITION/UPDATION IS DONE EVERYDAY.

About

This repository contains the image classification followed by semantic segmentation of Chest X-Rays to detect a clinical condition called Pneumothorax.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages