|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 | 15 | # Xception + Composable (2016)
|
| 16 | +# Trainable params: 22,944,896 |
16 | 17 | # https://arxiv.org/pdf/1610.02357.pdf
|
17 | 18 |
|
18 | 19 | import tensorflow as tf
|
@@ -121,30 +122,7 @@ def exitFlow(x, n_classes, **metaparameters):
|
121 | 122 | """ Create the exit flow section
|
122 | 123 | x : input to the exit flow section
|
123 | 124 | n_classes : number of output classes
|
124 |
| - """ |
125 |
| - def classifier(x, n_classes): |
126 |
| - """ The output classifier |
127 |
| - x : input to the classifier |
128 |
| - n_classes : number of output classes |
129 |
| - """ |
130 |
| - # Save the encoding layer |
131 |
| - Xception.encoding = x |
132 |
| - |
133 |
| - # Global Average Pooling will flatten the 10x10 feature maps into 1D feature maps |
134 |
| - x = GlobalAveragePooling2D()(x) |
135 |
| - |
136 |
| - # Save the embedding layer |
137 |
| - Xception.embedding = x |
138 |
| - |
139 |
| - # Fully connected output layer (classification) |
140 |
| - x = Composable.Dense(x, n_classes, **metaparameters) |
141 |
| - # Save the pre-activation layer |
142 |
| - Xception.probabilities = x |
143 |
| - outputs = Activation('softmax')(x) |
144 |
| - # Save the post-activation layer |
145 |
| - Xception.softmax = outputs |
146 |
| - return outputs |
147 |
| - |
| 125 | + """ |
148 | 126 | # Remember the input
|
149 | 127 | shortcut = x
|
150 | 128 |
|
@@ -181,7 +159,7 @@ def classifier(x, n_classes):
|
181 | 159 | x = Composable.ReLU(x)
|
182 | 160 |
|
183 | 161 | # Create classifier section
|
184 |
| - x = classifier(x, n_classes) |
| 162 | + x = Composable.classifier(x, n_classes, **metaparameters) |
185 | 163 |
|
186 | 164 | return x
|
187 | 165 |
|
|
0 commit comments