|
4 | 4 | ********************************************** |
5 | 5 |
|
6 | 6 | .. note:: |
7 | | - This section assumes the reader has already read through :doc:`lenet` for |
| 7 | + This section assumes the reader has already read through :doc:`lenet` for |
8 | 8 | convolutional networks motivation and :doc:`fcn_2D_segm` for segmentation |
9 | | - standard network. |
| 9 | + network. |
10 | 10 |
|
11 | 11 | Summary |
12 | 12 | +++++++ |
13 | 13 |
|
14 | 14 | This tutorial provides a brief explanation of the U-Net architecture as well as a way to implement |
15 | | -it using Theano and Lasagne. U-Net is a fully convolution network (FCN) that does image segmentation. |
| 15 | +it using Theano and Lasagne. U-Net is a Fully Convolutional Network (FCN) that does image segmentation. |
16 | 16 | Its goal is then to predict each pixel's class. |
17 | | -Compared to image classification, the difficulty arise from the fact that localisation is important. |
| 17 | +Compared to image classification, the difficulty arises from the fact that localisation is important. |
18 | 18 | The network must capture the overall context and recognize very precise details. |
19 | 19 |
|
20 | 20 |
|
21 | 21 | Model |
22 | 22 | +++++ |
23 | 23 |
|
24 | 24 | The U-Net architecture is built upon the Fully Convolutional Network and modified |
25 | | -in a way that it yields better segmentation. |
26 | | -Compared to FCN-8, the main difference is the added skip connections between |
27 | | -the contracting path and the expansive path. |
28 | | -These skip connections intend to provide local information |
| 25 | +in a way that it yields better segmentation in medical imaging. |
| 26 | +Compared to FCN-8, the two main differences are (1) U-net is symmetric and (2) the skip |
| 27 | +connections between the downsampling path and the upsampling path apply a concatenation |
| 28 | +operator instead of a sum. These skip connections intend to provide local information |
29 | 29 | to the global information while upsampling. |
30 | | -Also, the large number of feature maps in the upsampling path allows the network to |
31 | | -transfer information. By comparison, the basic FCN architecture only had |
32 | | -*number of classes* feature maps in its upsampling path. |
| 30 | +Because of its symmetry, the network has a large number of feature maps in the upsampling |
| 31 | +path, which allows to transfer information. By comparison, the basic FCN architecture only had |
| 32 | +*number of classes* feature maps in its upsampling path. |
33 | 33 |
|
34 | | -The U-Net owes its name to its symmetric shape, which is different from standard |
35 | | -FCN architectures. |
| 34 | +The U-Net owes its name to its symmetric shape, which is different from other FCN variants. |
36 | 35 |
|
37 | | -U-Net architecture is separated is 2 parts: |
| 36 | +U-Net architecture is separated in 3 parts: |
38 | 37 |
|
39 | 38 | - 1 : The contracting/downsampling path |
40 | | -- 2 : The expansive/upsampling path |
| 39 | +- 2: Bottleneck |
| 40 | +- 2 : The expanding/upsampling path |
41 | 41 |
|
42 | 42 | .. figure:: images/unet.jpg |
43 | 43 | :align: center |
@@ -49,48 +49,48 @@ U-Net architecture is separated is 2 parts: |
49 | 49 | Contracting/downsampling path |
50 | 50 | ============================= |
51 | 51 |
|
52 | | -The contracting path is composed of 4 blocks. Each block is composed of |
| 52 | +The contracting path is composed of 4 blocks. Each block is composed of |
53 | 53 |
|
54 | 54 | * 3x3 Convolution Layer + activation function |
55 | 55 | * 3x3 Convolution Layer + activation function |
56 | 56 | * 2x2 Max Pooling |
57 | 57 |
|
58 | | -Note that the number of feature maps double at each pooling, starting with |
59 | | -64 feature maps for the first block, 128 for the second, and so on. |
60 | | -The purpose of this contracting path is to capture the context of the input image |
| 58 | +Note that the number of feature maps doubles at each pooling, starting with |
| 59 | +64 feature maps for the first block, 128 for the second, and so on. |
| 60 | +The purpose of this contracting path is to capture the context of the input image |
61 | 61 | in order to be able to do segmentation. This coarse contextual information will |
62 | | -then be transfered to the upsampling path with the skip connections. |
| 62 | +then be transfered to the upsampling path by means of skip connections. |
63 | 63 |
|
64 | 64 |
|
65 | | -Bottleneck path |
66 | | -=============== |
| 65 | +Bottleneck |
| 66 | +========== |
67 | 67 |
|
68 | | -This part of the network is between contracting and downsampling path. |
69 | | -The bottleneck path in simply 2 convolutional layers, with a dropout layer. |
| 68 | +This part of the network is between the contracting and expanding paths. |
| 69 | +The bottleneck is built from simply 2 convolutional layers, with dropout. |
70 | 70 |
|
71 | 71 |
|
72 | | -Expansive/upsampling path |
| 72 | +Expanding/upsampling path |
73 | 73 | ========================= |
74 | 74 |
|
75 | | -The expansive path is also composed of 4 blocks. Each of these blocks is composed of |
| 75 | +The expanding path is also composed of 4 blocks. Each of these blocks is composed of |
76 | 76 |
|
77 | | -* Deconvolution layer with stride 2 |
| 77 | +* Deconvolution layer with stride 2 |
78 | 78 | * Concatenation with the corresponding cropped feature map from the contracting path |
79 | 79 | * 3x3 Convolution layer + activation function |
80 | 80 | * 3x3 Convolution layer + activation function |
81 | 81 |
|
82 | 82 |
|
83 | | -The purpose of this expansive path is to enable precise localization combined |
| 83 | +The purpose of this expanding path is to enable precise localization combined |
84 | 84 | with contextual information from the contracting path. |
85 | 85 |
|
86 | 86 | Advantages |
87 | 87 | ========== |
88 | 88 |
|
89 | 89 | * The U-Net combines the location information from the downsampling path with the contextual information in the upsampling path to finally obtain a general information combining localisation and context, which is necessary to predict a good segmentation map. |
90 | 90 |
|
91 | | -* No dense layer, so images of different sizes can be used as input (since the only parameters to learn on convolution layers are the kernel, and the size of the kernel is independant from input image' size). |
| 91 | +* No dense layer, so images of different sizes can be used as input (since the only parameters to learn on convolution layers are the kernel, and the size of the kernel is independent from input image' size). |
92 | 92 |
|
93 | | -* The use of massive data augmentation is important is domains like biomedical segmentation, since there are not a lot of annotated examples. |
| 93 | +* The use of massive data augmentation is important in domains like biomedical segmentation, since the number of annotated samples is usually limited. |
94 | 94 |
|
95 | 95 |
|
96 | 96 | Code - Citations - Contact |
@@ -105,35 +105,35 @@ The U-Net implementation can be found in the following GitHub repo: |
105 | 105 |
|
106 | 106 | The user can now build a U-Net with a specified number of input channels and number of classes. |
107 | 107 |
|
108 | | -First include the Lasagna layer needed to define the U-Net architecture : |
| 108 | +First include the Lasagne layers needed to define the U-Net architecture : |
109 | 109 |
|
110 | 110 | .. literalinclude:: ../code/Unet_lasagne_recipes.py |
111 | 111 | :start-after: start-snippet-1 |
112 | 112 | :end-before: end-snippet-1 |
113 | 113 |
|
114 | | -The *net* variable will be a ordered dictionary containing the layers' name as key and the layer instance as value. |
115 | | -This is needed to be able to concatenate the feature maps from the contracting to expansive path. |
| 114 | +The *net* variable will be an ordered dictionary containing the layers' name as key and the layer instance as value. |
| 115 | +This is needed to be able to concatenate the feature maps from the contracting to expanding path. |
116 | 116 |
|
117 | 117 |
|
118 | | -First the downsampling path : |
| 118 | +First the contracting path : |
119 | 119 |
|
120 | 120 | .. literalinclude:: ../code/Unet_lasagne_recipes.py |
121 | 121 | :start-after: start-snippet-downsampling |
122 | 122 | :end-before: end-snippet-downsampling |
123 | | - |
124 | | -And then the bottleneck path : |
125 | | - |
| 123 | + |
| 124 | +And then the bottleneck : |
| 125 | + |
126 | 126 | .. literalinclude:: ../code/Unet_lasagne_recipes.py |
127 | 127 | :start-after: start-snippet-bottleneck |
128 | 128 | :end-before: end-snippet-bottleneck |
129 | | - |
130 | | -And finally the upsampling path : |
131 | | - |
| 129 | + |
| 130 | +Followed by the expanding path : |
| 131 | + |
132 | 132 | .. literalinclude:: ../code/Unet_lasagne_recipes.py |
133 | 133 | :start-after: start-snippet-upsampling |
134 | 134 | :end-before: end-snippet-upsampling |
135 | 135 |
|
136 | | -And the output path (to obtain *number of classes* feature maps): |
| 136 | +And finally the output path (to obtain *number of classes* feature maps): |
137 | 137 |
|
138 | 138 | .. literalinclude:: ../code/Unet_lasagne_recipes.py |
139 | 139 | :start-after: start-snippet-output |
@@ -149,10 +149,6 @@ U_Net: Convolutional Networks for Biomedical Image Segmentation |
149 | 149 |
|
150 | 150 | * `[pdf] <https://arxiv.org/pdf/1505.04597.pdf>`__ reference |
151 | 151 |
|
152 | | -Fully Convolutional Networks for Semantic Segmentation |
153 | | - |
154 | | -* `[pdf] <https://people.eecs.berkeley.edu/~jonlong/long_shelhamer_fcn.pdf>`__ reference |
155 | | - |
156 | 152 | Papers related to Theano: |
157 | 153 |
|
158 | 154 | * `[pdf] <http://www.iro.umontreal.ca/~lisa/pointeurs/nips2012_deep_workshop_theano_final.pdf>`__ Bastien, Frédéric, Lamblin, Pascal, Pascanu, Razvan, Bergstra, James, Goodfellow, Ian, Bergeron, Arnaud, Bouchard, Nicolas, and Bengio, Yoshua. Theano: new features and speed improvements. NIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2012. |
|