|
1 | | -# U-Net Brain Tumor Segmentation |
2 | | - |
3 | | -This repo show you how to train a U-Net for brain tumor segmentation. By default, you need to download the training set of [BRATS 2017](http://braintumorsegmentation.org) dataset, which have 210 HGG and 75 LGG volumes, and put the data folder along with all scripts. |
4 | | - |
5 | | -```bash |
6 | | -data |
7 | | - -- Brats17TrainingData |
8 | | - -- train_dev_all |
9 | | -model.py |
10 | | -train.py |
11 | | -... |
12 | | -``` |
13 | | - |
14 | | -### About the data |
15 | | - |
16 | | -<div align="center"> |
17 | | - <img src="https://github.com/zsdonghao/u-net-brain-tumor/blob/master/example/brain_tumor_data.png" width="80%" height="50%"/> |
18 | | - <br> |
19 | | - <em align="center">Fig 1: Brain Image</em> |
20 | | -</div> |
21 | | - |
22 | | -* Each volume have 4 scanning images: FLAIR、T1、T1c and T2. |
23 | | -* Each volume have 4 segmentation labels: |
24 | | - |
25 | | -``` |
26 | | -Label 0: background |
| 1 | +# U-Net Brain Tumor Segmentation |
| 2 | + |
| 3 | +This repo show you how to train a U-Net for brain tumor segmentation. By default, you need to download the training set of [BRATS 2017](http://braintumorsegmentation.org) dataset (Note that according to the license, user have to apply the dataset from BRAST, please do not contact me for the dataset. Many thanks.), which have 210 HGG and 75 LGG volumes, and put the data folder along with all scripts. |
| 4 | + |
| 5 | +```bash |
| 6 | +data |
| 7 | + -- Brats17TrainingData |
| 8 | + -- train_dev_all |
| 9 | +model.py |
| 10 | +train.py |
| 11 | +... |
| 12 | +``` |
| 13 | + |
| 14 | +### About the data |
| 15 | + |
| 16 | +<div align="center"> |
| 17 | + <img src="https://github.com/zsdonghao/u-net-brain-tumor/blob/master/example/brain_tumor_data.png" width="80%" height="50%"/> |
| 18 | + <br> |
| 19 | + <em align="center">Fig 1: Brain Image</em> |
| 20 | +</div> |
| 21 | + |
| 22 | +* Each volume have 4 scanning images: FLAIR、T1、T1c and T2. |
| 23 | +* Each volume have 4 segmentation labels: |
| 24 | + |
| 25 | +``` |
| 26 | +Label 0: background |
27 | 27 | Label 1: necrotic and non-enhancing tumor |
28 | 28 | Label 2: edema |
29 | | -Label 4: enhancing tumor |
30 | | -``` |
31 | | - |
32 | | -The `prepare_data_with_valid.py` split the training set into 2 folds for training and validating. By default, it will use only half of the data for the sake of training speed, if you want to use all data, just change `DATA_SIZE = 'half'` to `all`. |
33 | | - |
34 | | -### About the method |
35 | | - |
36 | | -- Network and Loss: In this experiment, as we use [dice loss](http://tensorlayer.readthedocs.io/en/latest/modules/cost.html#dice-coefficient) to train a network, one network only predict one labels (Label 1,2 or 4). We evaluate the performance using [hard dice](http://tensorlayer.readthedocs.io/en/latest/modules/cost.html#hard-dice-coefficient) and [IOU](http://tensorlayer.readthedocs.io/en/latest/modules/cost.html#iou-coefficient). |
37 | | - |
38 | | -- Data augmenation: Includes random left and right flip, rotation, shifting, shearing, zooming and the most important one -- [Elastic trasnformation](http://tensorlayer.readthedocs.io/en/latest/modules/prepro.html#elastic-transform) which is borrowed from ["Automatic Brain Tumor Detection and Segmentation Using U-Net Based Fully Convolutional Networks"](https://arxiv.org/pdf/1705.03820.pdf). |
39 | | - |
40 | | -<div align="center"> |
41 | | - <img src="https://github.com/zsdonghao/u-net-brain-tumor/blob/master/example/brain_tumor_aug.png" width="80%" height="50%"/> |
42 | | - <br> |
43 | | - <em align="center">Fig 2: Data augmentation</em> |
44 | | -</div> |
45 | | - |
46 | | -### Start training |
47 | | - |
48 | | -We train HGG and LGG together, as one network only have one task, set the `task` to `all`, `necrotic`, `edema` or `enhance`, "all" means learn to segment all tumors. |
49 | | - |
50 | | -``` |
51 | | -python train.py --task=all |
52 | | -``` |
53 | | - |
54 | | -Note that, if the loss stick on 1 at the beginning, it means the network doesn't converge to near-perfect accuracy, please try restart it. |
| 29 | +Label 4: enhancing tumor |
| 30 | +``` |
| 31 | + |
| 32 | +The `prepare_data_with_valid.py` split the training set into 2 folds for training and validating. By default, it will use only half of the data for the sake of training speed, if you want to use all data, just change `DATA_SIZE = 'half'` to `all`. |
| 33 | + |
| 34 | +### About the method |
| 35 | + |
| 36 | +- Network and Loss: In this experiment, as we use [dice loss](http://tensorlayer.readthedocs.io/en/latest/modules/cost.html#dice-coefficient) to train a network, one network only predict one labels (Label 1,2 or 4). We evaluate the performance using [hard dice](http://tensorlayer.readthedocs.io/en/latest/modules/cost.html#hard-dice-coefficient) and [IOU](http://tensorlayer.readthedocs.io/en/latest/modules/cost.html#iou-coefficient). |
| 37 | + |
| 38 | +- Data augmenation: Includes random left and right flip, rotation, shifting, shearing, zooming and the most important one -- [Elastic trasnformation](http://tensorlayer.readthedocs.io/en/latest/modules/prepro.html#elastic-transform) which is borrowed from ["Automatic Brain Tumor Detection and Segmentation Using U-Net Based Fully Convolutional Networks"](https://arxiv.org/pdf/1705.03820.pdf). |
| 39 | + |
| 40 | +<div align="center"> |
| 41 | + <img src="https://github.com/zsdonghao/u-net-brain-tumor/blob/master/example/brain_tumor_aug.png" width="80%" height="50%"/> |
| 42 | + <br> |
| 43 | + <em align="center">Fig 2: Data augmentation</em> |
| 44 | +</div> |
| 45 | + |
| 46 | +### Start training |
| 47 | + |
| 48 | +We train HGG and LGG together, as one network only have one task, set the `task` to `all`, `necrotic`, `edema` or `enhance`, "all" means learn to segment all tumors. |
| 49 | + |
| 50 | +``` |
| 51 | +python train.py --task=all |
| 52 | +``` |
| 53 | + |
| 54 | +Note that, if the loss stick on 1 at the beginning, it means the network doesn't converge to near-perfect accuracy, please try restart it. |
0 commit comments