(l, ch_out, stride)
| 87 | |
| 88 | |
| 89 | def se_bottleneck(l, ch_out, stride): |
| 90 | shortcut = l |
| 91 | l = Conv2D('conv1', l, ch_out, 1, activation=BNReLU) |
| 92 | l = Conv2D('conv2', l, ch_out, 3, strides=stride, activation=BNReLU) |
| 93 | l = Conv2D('conv3', l, ch_out * 4, 1, activation=get_bn(zero_init=True)) |
| 94 | |
| 95 | squeeze = GlobalAvgPooling('gap', l) |
| 96 | squeeze = FullyConnected('fc1', squeeze, ch_out // 4, activation=tf.nn.relu) |
| 97 | squeeze = FullyConnected('fc2', squeeze, ch_out * 4, activation=tf.nn.sigmoid) |
| 98 | data_format = get_arg_scope()['Conv2D']['data_format'] |
| 99 | ch_ax = 1 if data_format in ['NCHW', 'channels_first'] else 3 |
| 100 | shape = [-1, 1, 1, 1] |
| 101 | shape[ch_ax] = ch_out * 4 |
| 102 | l = l * tf.reshape(squeeze, shape) |
| 103 | out = l + resnet_shortcut(shortcut, ch_out * 4, stride, activation=get_bn(zero_init=False)) |
| 104 | return tf.nn.relu(out) |
| 105 | |
| 106 | |
| 107 | def resnext32x4d_bottleneck(l, ch_out, stride): |
nothing calls this directly
no test coverage detected