Builds Inception-A block for Inception v4 network.
(inputs, scope=None, is_train=False)
| 17 | |
| 18 | |
| 19 | def block_inception_a(inputs, scope=None, is_train=False): |
| 20 | """Builds Inception-A block for Inception v4 network.""" |
| 21 | # By default use stride=1 and SAME padding |
| 22 | |
| 23 | with tf.variable_scope(name_or_scope=scope, default_name='BlockInceptionA', values=[inputs]): |
| 24 | with tf.variable_scope('Branch_0'): |
| 25 | branch_0, _ = conv_module( |
| 26 | inputs, n_out_channel=96, filter_size=(1, 1), strides=(1, 1), padding='SAME', batch_norm_init=None, |
| 27 | is_train=is_train, use_batchnorm=True, activation_fn='ReLU', name='Conv2d_0a_1x1' |
| 28 | ) |
| 29 | |
| 30 | with tf.variable_scope('Branch_1'): |
| 31 | branch_1, _ = conv_module( |
| 32 | inputs, n_out_channel=64, filter_size=(1, 1), strides=(1, 1), padding='SAME', batch_norm_init=None, |
| 33 | is_train=is_train, use_batchnorm=True, activation_fn='ReLU', name='Conv2d_0a_1x1' |
| 34 | ) |
| 35 | |
| 36 | branch_1, _ = conv_module( |
| 37 | branch_1, n_out_channel=96, filter_size=(3, 3), strides=(1, 1), padding='SAME', batch_norm_init=None, |
| 38 | is_train=is_train, use_batchnorm=True, activation_fn='ReLU', name='Conv2d_0b_3x3' |
| 39 | ) |
| 40 | |
| 41 | with tf.variable_scope('Branch_2'): |
| 42 | branch_2, _ = conv_module( |
| 43 | inputs, n_out_channel=64, filter_size=(1, 1), strides=(1, 1), padding='SAME', batch_norm_init=None, |
| 44 | is_train=is_train, use_batchnorm=True, activation_fn='ReLU', name='Conv2d_0a_1x1' |
| 45 | ) |
| 46 | |
| 47 | branch_2, _ = conv_module( |
| 48 | branch_2, n_out_channel=96, filter_size=(3, 3), strides=(1, 1), padding='SAME', batch_norm_init=None, |
| 49 | is_train=is_train, use_batchnorm=True, activation_fn='ReLU', name='Conv2d_0b_3x3' |
| 50 | ) |
| 51 | |
| 52 | branch_2, _ = conv_module( |
| 53 | branch_2, n_out_channel=96, filter_size=(3, 3), strides=(1, 1), padding='SAME', batch_norm_init=None, |
| 54 | is_train=is_train, use_batchnorm=True, activation_fn='ReLU', name='Conv2d_0c_3x3' |
| 55 | ) |
| 56 | |
| 57 | with tf.variable_scope('Branch_3'): |
| 58 | branch_3 = tl.layers.MeanPool2d( |
| 59 | inputs, filter_size=(3, 3), strides=(1, 1), padding='SAME', name='AvgPool_0a_3x3' |
| 60 | ) |
| 61 | |
| 62 | branch_3, _ = conv_module( |
| 63 | branch_3, n_out_channel=96, filter_size=(1, 1), strides=(1, 1), padding='SAME', batch_norm_init=None, |
| 64 | is_train=is_train, use_batchnorm=True, activation_fn='ReLU', name='Conv2d_0b_1x1' |
| 65 | ) |
| 66 | |
| 67 | return tl.layers.ConcatLayer([branch_0, branch_1, branch_2, branch_3], concat_dim=3, name='concat_layer') |
| 68 | |
| 69 | |
| 70 | def block_reduction_a(inputs, scope=None, is_train=False): |
no test coverage detected
searching dependent graphs…