(l, ch_out, stride)
| 135 | |
| 136 | |
| 137 | def resnet_bottleneck(l, ch_out, stride): |
| 138 | shortcut = l |
| 139 | if cfg.BACKBONE.STRIDE_1X1: |
| 140 | if stride == 2: |
| 141 | l = l[:, :, :-1, :-1] |
| 142 | l = Conv2D('conv1', l, ch_out, 1, strides=stride) |
| 143 | l = Conv2D('conv2', l, ch_out, 3, strides=1) |
| 144 | else: |
| 145 | l = Conv2D('conv1', l, ch_out, 1, strides=1) |
| 146 | if stride == 2: |
| 147 | l = tf.pad(l, [[0, 0], [0, 0], maybe_reverse_pad(0, 1), maybe_reverse_pad(0, 1)]) |
| 148 | l = Conv2D('conv2', l, ch_out, 3, strides=2, padding='VALID') |
| 149 | else: |
| 150 | l = Conv2D('conv2', l, ch_out, 3, strides=stride) |
| 151 | if cfg.BACKBONE.NORM != 'None': |
| 152 | l = Conv2D('conv3', l, ch_out * 4, 1, activation=get_norm(zero_init=True)) |
| 153 | else: |
| 154 | l = Conv2D('conv3', l, ch_out * 4, 1, activation=tf.identity, |
| 155 | kernel_initializer=tf.constant_initializer()) |
| 156 | ret = l + resnet_shortcut(shortcut, ch_out * 4, stride, activation=get_norm(zero_init=False)) |
| 157 | return tf.nn.relu(ret, name='output') |
| 158 | |
| 159 | |
| 160 | def resnet_group(name, l, block_func, features, count, stride): |
nothing calls this directly
no test coverage detected
searching dependent graphs…