harshwalia36 / Segmentation_and_classification_of_Covid-19-lungs-CT-Scan

Deep Learning Project which help us to identify a Person is Covid or non-Covid and Segment the Infection in the Lungs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segmentation_and_classification_of_Covid-19-lungs-CT-Scan

Brief Description and Main Features of this Project are -

This Project includes 3 Task :-

TASK 1- Covid 19 Infection Segmentation
TASK 2- Covid 19 Classification
TASK 3- Covid 19 Lung Segmentation
Sample data

--------------------------------------------------------------------------------------------------------------------------------

Details of the 3 Tasks are:-

In this Project, we have been given 20 3D CT Scans and their Masks. We have taken some 2D slices of the images.
Before Training the Model for any of the subtasks, we have to do PreProcessing on images, and then this same Preprocessing can be used in tasks and then feed into the model.

  • Task 1:- This Task First do some PreProcessing of the images and then do the Infection Segmentation from the Patient Lungs.The model used for Segmentation is the UNET model.
  • Task 2:- Task 2 contains a Classification model using CNN, which classifies CT Scan as Covid or Non-Covid Person.
  • Task 3:- Task 3 contains the Lung Segmentation from their respective CT scans. Here also for Lung Segmentation, we used the Segmentation model

-----------------------------------------------------------------------------------------------------------------------------------------

Preprocessing Stage

1.) Removing incomplete and fauty images(Removed initial 25% and ending 25% slices from the 3D CT Scans)
2.) For image enhancement we used Contrast Limited Adaptive Histogram Equalization(CLAHE) method ()
3.) Cropping the Region of Interst (ROI)
4.) Data Augmentation

Faulty and Blurry Images


After Removing faulty images we get cleared image


Enhanced CT Scan


Cropped Lungs


Augmentated CT Scans (Task: 1)
Augmented Infections Masks (Task: 1)
Augmentated CT Scans (Task: 3)
Augmented Lung Masks (Task: 3)

-----------------------------------------------------------------------------------------------------------------------------------------

Results

RESULT TABLE
+----------------------------------------+----------------------------+-----------------------+---------------------------+---------------
|                                    |    Dice       |   IOU     |  Precision   |   Recall    |  AUCROC |   F1 Score   | Accuracy |
+----------------------------------------+----------------------------+-----------------------+---------------------------+----------------
| Task1: Infection Segmentation      |    0.867      |  0.765    |    0.861     |   0.873     |    -    | same as dice |     -    |
+----------------------------------------+----------------------------+-----------------------+---------------------------+----------------
|       Task2: Classification        |      -        |     -     |    0.963     |   0.980     |   0.971 |     0.971    |          |
+----------------------------------------+----------------------------+-----------------------+---------------------------+----------------
|       Task3: Lung Segmentation     |  0.978        |    0.958  |     0.977    |    0.980    |    -    | same as dice |     -    |
+----------------------------------------+----------------------------+-----------------------+---------------------------+----------------
|                                        | Note: precision and recall | values are as per the | best threshold for dice   |       |
+--------------------------------------+------------------------+-----------------------------------------+-------------------+------------+

Results with UNet (Task: 1-Infection Segmentation)

Trianing curve for Dice Coefficient Training curve for BCE+Dice Loss
Optimizing threshold for dice and IOU
Precision and recall curves v/s thresholds
Some Actual Vs Predicted Masks

Results with CNN (Task: 2- Covid 19 Classification)

Classification loss curve
Confusion matrix
Precision vs Recall

ROC Curve

Results with UNet (Task: 3- Lungs Segmentation)

Training curve for Dice Coefficient Training curve for BCE + Dice Loss
Optimizing threshold for Dice and IOU
Actual v/s Predicted Lung Masks
Precision and recall curves v/s thresholds

-----------------------------------------------------------------------------------------------------------------------------------------

Tech Stack and Concept Used in the Project

Important tools/libraries used for this task are:

  • Numpy, Pandas, Matplotlib, Nibabel, imgaug, sklearn, skimage, TensorFlow, Keras, cv2, SMOTE, PIL, seaborn,segmentation_model(only to calculate precision and recall in Segmentation) & joblib.

  • For Segmentation we used the UNET Model to Segment the Infection and Lungs From the given CT Scan.

    • The UNet architecture was used for BioMedical Image segmentation. The introduced architecture had two main parts that were contraction and Expansion. The contraction is all about the covenant layers followed by pooling operation. It is used to extract the factors in the image. The second part Expansion, uses transposed convolution to permit localization. It is again an F.C connected layers network.

  • For Classification, we use simple CNN(Convolution Neural Network) architecture to classify an image into covid or Non-Covid.

----------------------------------------------------------------------------------------------------------------------------------------

Thought behind the Project

  • Covid-19 is a once in century thing. We all saw what hardships were faced by different nations while dealing with it. We thought of doing this Project because this is a very new disease & we had to work with NIfTY files, which in itself was a task. So, this project can help to detect Covid or Non-Covid patients with the help of CT scans and Localized the area of infection in the lungs.

SETUP STEPS

  • This Project contains 3 .ipynb files for 3 individual Tasks
  • Any necessary package to be installed is placed on top of each of the three notebooks.
  • Notebooks are using kaggle and Colab collectively so will contain some operations importing data from kaggle to colab needs a unique API key, mounting drive and authentication etc.

---------------------------------------------------------------------------------------------------------------------------------------

About

Deep Learning Project which help us to identify a Person is Covid or non-Covid and Segment the Infection in the Lungs.


Languages

Language:Jupyter Notebook 100.0%