Switch to unified view

a/README.md b/README.md
1
# CT-Heart-Segmentation
1
# CT-Heart-Segmentation
2
2
3
## **Overview**  
3
## **Overview**  
4
This project focuses on **automated heart segmentation** from **CT scans** using deep learning. We applied **data augmentation** techniques using the **Albumentations library** to enhance model generalization and trained a **U-Net model** to segment heart structures accurately.  
4
This project focuses on **automated heart segmentation** from **CT scans** using deep learning. We applied **data augmentation** techniques using the **Albumentations library** to enhance model generalization and trained a **U-Net model** to segment heart structures accurately.  
5
5
6
Medical image segmentation is crucial in **cardiovascular disease diagnosis**, treatment planning, and surgical interventions. This project aims to provide a robust and efficient deep learning pipeline for **heart segmentation from CT images**.  
6
Medical image segmentation is crucial in **cardiovascular disease diagnosis**, treatment planning, and surgical interventions. This project aims to provide a robust and efficient deep learning pipeline for **heart segmentation from CT images**.  
7
7
8
---
8
---
9
9
10
## **Dataset** 
10
## **Dataset** 
11
The dataset consists of **CT scan images** with corresponding segmentation masks representing heart structures. The images undergo preprocessing and augmentation before being fed into the segmentation model.  
11
The dataset consists of **CT scan images** with corresponding segmentation masks representing heart structures. The images undergo preprocessing and augmentation before being fed into the segmentation model.  
12
12
13
### **Kaggle link for Dataset:** https://www.kaggle.com/datasets/nikhilroxtomar/ct-heart-segmentation
13
### **Kaggle link for Dataset:** https://www.kaggle.com/datasets/nikhilroxtomar/ct-heart-segmentation
14
14
15
### **Preprocessing Steps:**
15
### **Preprocessing Steps:**
16
✅ Resizing images to a fixed resolution  
16
✅ Resizing images to a fixed resolution  
17
✅ Normalizing pixel values for stable training  
17
✅ Normalizing pixel values for stable training  
18
18
19
---
19
---
20
20
21
## **Data Augmentation using Albumentations**  
21
## **Data Augmentation using Albumentations**  
22
To improve the model's generalization and performance, we applied **data augmentation** using the **Albumentations** library. This helps to create diverse training samples, reducing overfitting and improving robustness.  
22
To improve the model's generalization and performance, we applied **data augmentation** using the **Albumentations** library. This helps to create diverse training samples, reducing overfitting and improving robustness.  
23
23
24
### **Augmentations Applied:**
24
### **Augmentations Applied:**
25
✅ **RandomBrightnessContrast** → Adjusts brightness and contrast randomly to simulate variations in scanning conditions  
25
✅ **RandomBrightnessContrast** → Adjusts brightness and contrast randomly to simulate variations in scanning conditions  
26
✅ **HueSaturationValue** → Modifies the hue, saturation, and value of the image to introduce color variations  
26
✅ **HueSaturationValue** → Modifies the hue, saturation, and value of the image to introduce color variations  
27
✅ **RGBShift** → Shifts the red, green, and blue channels to create different color variations  
27
✅ **RGBShift** → Shifts the red, green, and blue channels to create different color variations  
28
✅ **RandomGamma** → Randomly adjusts gamma levels to enhance or darken image regions  
28
✅ **RandomGamma** → Randomly adjusts gamma levels to enhance or darken image regions  
29
✅ **CLAHE (Contrast Limited Adaptive Histogram Equalization)** → Enhances local contrast to improve visibility of structures  
29
✅ **CLAHE (Contrast Limited Adaptive Histogram Equalization)** → Enhances local contrast to improve visibility of structures  
30
✅ **ChannelShuffle** → Randomly shuffles color channels to increase diversity in training samples  
30
✅ **ChannelShuffle** → Randomly shuffles color channels to increase diversity in training samples  
31
31
32
---
32
---
33
33
34
## **Model Architecture: U-Net for Segmentation**  
34
## **Model Architecture: U-Net for Segmentation**  
35
We implemented a U-Net model, a well-known CNN-based architecture for biomedical image segmentation. U-Net is effective in capturing both local and global spatial information using its encoder-decoder structure with skip connections.  
35
We implemented a U-Net model, a well-known CNN-based architecture for biomedical image segmentation. U-Net is effective in capturing both local and global spatial information using its encoder-decoder structure with skip connections.  
36
36
37
### **U-Net Architecture Highlights:**
37
### **U-Net Architecture Highlights:**
38
🔹 **Encoder** (Contracting Path) → Captures spatial features using convolutional layers  
38
🔹 **Encoder** (Contracting Path) → Captures spatial features using convolutional layers  
39
🔹 **Bottleneck** → Connects the encoder and decoder with high-level feature maps  
39
🔹 **Bottleneck** → Connects the encoder and decoder with high-level feature maps  
40
🔹 **Decoder** (Expanding Path) → Recovers spatial resolution for precise segmentation  
40
🔹 **Decoder** (Expanding Path) → Recovers spatial resolution for precise segmentation  
41
🔹 **Skip Connections** → Retains fine-grained details by merging encoder features  
41
🔹 **Skip Connections** → Retains fine-grained details by merging encoder features  
42
42
43
---
43
---
44
44
45
## **Training Process **  
45
## **Training Process **  
46
The model was trained using TensorFlow/Keras with the following setup:  
46
The model was trained using TensorFlow/Keras with the following setup:  
47
✅ Loss Function → Dice Loss  
47
✅ Loss Function → Dice Loss  
48
✅ Optimizer → Adam optimizer for efficient learning  
48
✅ Optimizer → Adam optimizer for efficient learning  
49
✅ Learning Rate Scheduling → Reduces learning rate on plateaus  
49
✅ Learning Rate Scheduling → Reduces learning rate on plateaus  
50
✅ Evaluation Metrics → Dice Coefficient, IoU, Accuracy   
50
✅ Evaluation Metrics → Dice Coefficient, IoU, Accuracy   
51
51
52
52
53
### Examples of CT Segmentation
54
Below are results of Unet segmentation:
55
56
the image from validation set is structred as [Image - True mask - Predicted mask] 
57
![Heart Segmentation Visualization](results/CT1.png)  
58
![Heart Segmentation Visualization](results/CT3.png)
59
60
the image from test set is structred as [Image - Predicted mask] 
61
![Heart Segmentation Visualization](results/CT7.png)  
62
![Heart Segmentation Visualization](results/CT8.png)