|
a/README.md |
|
b/README.md |
1 |
# Brain tumor segmentation in MRI images using U-Net |
1 |
# Brain tumor segmentation in MRI images using U-Net |
2 |
|
2 |
|
3 |
Here, I have implemented a U-Net from the paper ["U-Net: Convolutional Networks for Biomedical |
3 |
Here, I have implemented a U-Net from the paper ["U-Net: Convolutional Networks for Biomedical
|
4 |
Image Segmentation"](https://arxiv.org/pdf/1505.04597.pdf) to segment tumor in MRI images of brain. |
4 |
Image Segmentation"](https://arxiv.org/pdf/1505.04597.pdf) to segment tumor in MRI images of brain. |
5 |
|
5 |
|
6 |
There are 3 types of brain tumor: |
6 |
There are 3 types of brain tumor:
|
7 |
1. meningioma |
7 |
1. meningioma
|
8 |
2. glioma |
8 |
2. glioma
|
9 |
3. pituitary tumor |
9 |
3. pituitary tumor |
10 |
|
10 |
|
11 |
## Examples of predicted tumor segment by the current U-Net implementation. |
11 |
## Examples of predicted tumor segment by the current U-Net implementation.
|
12 |
meningioma | glioma | pituitary tumor |
12 |
meningioma | glioma | pituitary tumor
|
13 |
:-------------------------:|:-------------------------:|:------------------------: |
13 |
:-------------------------:|:-------------------------:|:------------------------:
|
14 |
 |  |  |
14 |
 |  |  |
15 |
 |  |  |
15 |
 |  | 
|
16 |
 |  |  |
16 |
 |  |  |
17 |
|
17 |
|
18 |
## Getting Started |
18 |
## Getting Started
|
19 |
Here I will explain how to get the data and convert it into the usable form. You can run the train and run model using [notebook](https://github.com/adityajn105/brain-tumor-segmentation-unet/blob/master/brain-tumor-segmentation.ipynb). |
19 |
Here I will explain how to get the data and convert it into the usable form. You can run the train and run model using [notebook](https://github.com/adityajn105/brain-tumor-segmentation-unet/blob/master/brain-tumor-segmentation.ipynb). |
20 |
|
20 |
|
21 |
### Prerequisites |
21 |
### Prerequisites
|
22 |
You will need Python 3.X.X with some packages which you can install direclty using requirements.txt. |
22 |
You will need Python 3.X.X with some packages which you can install direclty using requirements.txt.
|
23 |
> pip install -r requirements.txt |
23 |
pip install -r requirements.txt |
24 |
|
24 |
|
25 |
### Get the Dataset |
25 |
### Get the Dataset
|
26 |
I have used brain-tumor segment dataset which is available on the internet. You can run [download_data.sh](https://github.com/adityajn105/brain-tumor-segmentation-unet/blob/master/download_data.sh) shell script to download all data. It contains 3064 MRI images and 3064 masks. |
26 |
I have used brain-tumor segment dataset which is available on the internet. You can run [download_data.sh](https://github.com/adityajn105/brain-tumor-segmentation-unet/blob/master/download_data.sh) shell script to download all data. It contains 3064 MRI images and 3064 masks.
|
27 |
> bash tumor-segmentation-unet/download_data.sh |
27 |
bash tumor-segmentation-unet/download_data.sh |
28 |
|
28 |
|
29 |
After that run the following command to convert data in useable form. |
29 |
After that run the following command to convert data in useable form.
|
30 |
> python tumor-segmentation-unet/mat_to_numpy.py brain_tumor_dataset/ |
30 |
python tumor-segmentation-unet/mat_to_numpy.py brain_tumor_dataset/ |
31 |
|
31 |
|
32 |
## Model Architecture |
32 |
## Model Architecture
|
33 |
I have used combination of multiple losses which includes binary crossentropy, dice loss with equal weightage. Also I have used Conv2D transpose layers for upsampling. |
33 |
I have used combination of multiple losses which includes binary crossentropy, dice loss with equal weightage. Also I have used Conv2D transpose layers for upsampling. |
34 |
|
34 |
|
35 |
I have used the metric called IOU (Intersection over Union) metric to track progress of training and trained Unet with Adam optimizer for 40-60 epochs with decaying learning rate between 1e-3 to 1e-4. I have also performed only one Image augmentation i.e. horizontal flip. Train and test split was stratified using type of tumor. |
35 |
I have used the metric called IOU (Intersection over Union) metric to track progress of training and trained Unet with Adam optimizer for 40-60 epochs with decaying learning rate between 1e-3 to 1e-4. I have also performed only one Image augmentation i.e. horizontal flip. Train and test split was stratified using type of tumor. |
36 |
|
36 |
|
37 |
 |
37 |
 |
38 |
|
38 |
|
39 |
|
39 |
|
40 |
Detailed architecure is given below. |
40 |
Detailed architecure is given below.
|
41 |
 |
41 |
 |
42 |
|
42 |
|
43 |
## Possible Improvements |
43 |
## Possible Improvements
|
44 |
1. Can use transfer learning to utilize state-of-the-art model like VGG, Inception, Resnet. |
44 |
1. Can use transfer learning to utilize state-of-the-art model like VGG, Inception, Resnet.
|
45 |
2. We can use more types of image augmentation like vertical flip, brightness, zoom etc. |
45 |
2. We can use more types of image augmentation like vertical flip, brightness, zoom etc.
|
46 |
3. Include lovasz loss with higher weightage. |
46 |
3. Include lovasz loss with higher weightage.
|
47 |
4. Learn and use Hypercolumns |
47 |
4. Learn and use Hypercolumns |
48 |
|
48 |
|
49 |
## Author: |
49 |
## Author:
|
50 |
* Aditya Jain : [Portfolio](https://adityajain.me) |
50 |
* Aditya Jain : [Portfolio](https://adityajain.me) |
51 |
|
51 |
|
52 |
## To Read: |
52 |
## To Read:
|
53 |
1. [U-Net: Convolutional Networks for Biomedical Image Segmentation](https://arxiv.org/pdf/1505.04597.pdf) |
53 |
1. [U-Net: Convolutional Networks for Biomedical Image Segmentation](https://arxiv.org/pdf/1505.04597.pdf)
|
54 |
2. [Image Segmentation, ConvNet, FCN, Unet](https://towardsdatascience.com/understanding-semantic-segmentation-with-unet-6be4f42d4b47) |
54 |
2. [Image Segmentation, ConvNet, FCN, Unet](https://towardsdatascience.com/understanding-semantic-segmentation-with-unet-6be4f42d4b47)
|
55 |
3. [Up-sampling with Transposed Convolution](https://towardsdatascience.com/up-sampling-with-transposed-convolution-9ae4f2df52d0) |
55 |
3. [Up-sampling with Transposed Convolution](https://towardsdatascience.com/up-sampling-with-transposed-convolution-9ae4f2df52d0)
|
56 |
4. [Lovasz Loss](https://arxiv.org/abs/1705.08790) |
56 |
4. [Lovasz Loss](https://arxiv.org/abs/1705.08790)
|
57 |
5. [Jaccard Index - Intesection over Union](https://www.jeremyjordan.me/evaluating-image-segmentation-models/) |
57 |
5. [Jaccard Index - Intesection over Union](https://www.jeremyjordan.me/evaluating-image-segmentation-models/)
|
58 |
6. [Understanding Dice Loss](https://forums.fast.ai/t/understanding-the-dice-coefficient/5838) |
58 |
6. [Understanding Dice Loss](https://forums.fast.ai/t/understanding-the-dice-coefficient/5838)
|
59 |
7. [Another Image Segmentation Problem](https://github.com/adityajn105/TGS-Salt-Identification-Image-Segmentation-) |
59 |
7. [Another Image Segmentation Problem](https://github.com/adityajn105/TGS-Salt-Identification-Image-Segmentation-) |