(inputs, channel=32, num_blocks=4, name='generator', reuse=False)
| 28 | |
| 29 | |
| 30 | def generator(inputs, channel=32, num_blocks=4, name='generator', reuse=False): |
| 31 | with tf.variable_scope(name, reuse=reuse): |
| 32 | |
| 33 | x = slim.convolution2d(inputs, channel, [7, 7], activation_fn=None) |
| 34 | x = tf.nn.leaky_relu(x) |
| 35 | |
| 36 | x = slim.convolution2d(x, channel*2, [3, 3], stride=2, activation_fn=None) |
| 37 | x = slim.convolution2d(x, channel*2, [3, 3], activation_fn=None) |
| 38 | x = tf.nn.leaky_relu(x) |
| 39 | |
| 40 | x = slim.convolution2d(x, channel*4, [3, 3], stride=2, activation_fn=None) |
| 41 | x = slim.convolution2d(x, channel*4, [3, 3], activation_fn=None) |
| 42 | x = tf.nn.leaky_relu(x) |
| 43 | |
| 44 | for idx in range(num_blocks): |
| 45 | x = resblock(x, out_channel=channel*4, name='block_{}'.format(idx)) |
| 46 | |
| 47 | x = slim.conv2d_transpose(x, channel*2, [3, 3], stride=2, activation_fn=None) |
| 48 | x = slim.convolution2d(x, channel*2, [3, 3], activation_fn=None) |
| 49 | |
| 50 | x = tf.nn.leaky_relu(x) |
| 51 | |
| 52 | x = slim.conv2d_transpose(x, channel, [3, 3], stride=2, activation_fn=None) |
| 53 | x = slim.convolution2d(x, channel, [3, 3], activation_fn=None) |
| 54 | x = tf.nn.leaky_relu(x) |
| 55 | |
| 56 | x = slim.convolution2d(x, 3, [7, 7], activation_fn=None) |
| 57 | #x = tf.clip_by_value(x, -0.999999, 0.999999) |
| 58 | |
| 59 | return x |
| 60 | |
| 61 | |
| 62 | def unet_generator(inputs, channel=32, num_blocks=4, name='generator', reuse=False): |
nothing calls this directly
no test coverage detected