# Acute-Ischemic-Stroke-Segmentation

This documentation outlines the Ischemic Stroke Core Segmentation model, which is designed to segment ischemic stroke core regions in medical images. The model is trained using two datasets: ISLES 2022 and expert-annotated photos. Three deep learning models have been implemented: FPN (Feature Pyramid Network), U-Net, and ResNext50.

## Datasets

### ISLES 2022 Dataset
- Publicly available dataset containing medical images relevant to ischemic stroke core segmentation.
- Used as the initial training dataset.

### Expert-Annotated Dataset
- Dataset consisting of photos annotated by experts for ischemic stroke core segmentation.
- Utilized for further training and fine-tuning of the models after initial training on the ISLES 2022 dataset.

## Models Implemented

### 1. FPN (Feature Pyramid Network)
- FPN architecture is employed for its ability to capture multiscale features effectively.
- Implemented for ischemic stroke core segmentation.

### 2. U-Net
- U-Net architecture is known for its effectiveness in biomedical image segmentation tasks.
- Implemented to segment ischemic stroke core regions with high accuracy.

### 3. ResNext50
- ResNext50 architecture, a variant of ResNet, is utilized due to its strong performance in various computer vision tasks.
- Implemented to segment ischemic stroke core regions with robustness and efficiency.

## Training Process

1. **Initial Training on ISLES 2022 Dataset:**
   - Models are trained using the ISLES 2022 dataset to learn the fundamental features of ischemic stroke core regions.

2. **Training and Fine-Tuning on Expert-Annotated Dataset:**
   - The pre-trained models are further trained and fine-tuned using the expert-annotated dataset.
   - Fine-tuning helps adapt the models to the specifics of the expert annotations, potentially improving segmentation accuracy.


## Metrics and Loss Functions

### 1. `dice_coef_metric`

The `dice_coef_metric` function computes the Dice coefficient metric for evaluating the performance of segmentation models. The Dice coefficient, also known as the Intersection over Union (IoU), measures the similarity between two sets by calculating the ratio of their intersection to their union.


### 2. `dice_coef_loss`

The `dice_coef_loss` function computes the Dice coefficient loss, which is used as a loss function for training segmentation models. It measures the dissimilarity between predicted and ground truth segmentation masks based on the Dice coefficient.


### 3. `bce_dice_loss`

The `bce_dice_loss` function computes the combined Binary Cross-Entropy and Dice coefficient loss. It combines the standard Binary Cross-Entropy loss with the Dice coefficient loss to provide a comprehensive loss function for training segmentation models.


**Note**: It is recommended to run the code on a GPU for faster training and testing.