def G_Net_2D_v3(self, im, is_train, reuse): with tf.variable_scope('generator_im', reuse=reuse) as scope: layers = [] input = im chns = [64] + [128] * 2 + [256] * 9 + [128] * 2 + [64, 32, 2] chns = [x // 4 for x in chns[:-1]] + [chns[-1]] etas = [1] * 6 + [2, 4, 8, 16] + [1] * 7 kszs = [5] + [3] * 11 + [4, 3, 4, 3, 3] stps = [1, 2, 1, 2] + [1] * 8 + [2, 1, 2, 1, 1] dcvs = [False] * 12 + [True, False, True, False, False] usbn = [True] * 16 + [False] usrl = usbn for k in range(17): if k == 0: temp = input elif k < 9: temp = layers[-1] elif k < 15: temp = tf.concat([layers[-1], layers[15 - k]], axis=3) else: temp = layers[-1] layers += [ utils.conv_layer_2d(temp, chns[k], etas[k], kszs[k], stps[k], 'l%02d' % k, dcvs[k], usbn[k], is_train, usrl[k]) ] layers += [ tf.slice(tf.nn.softmax(layers[-1]) * 2.0 - 1.0, [0, 0, 0, 1], [-1, -1, -1, 1], name='segmented') ] return layers[-1], layers
def G_Net_2D_v0(self, im, is_train, reuse): with tf.variable_scope('generator_im', reuse=reuse) as scope: layers = [] input = im chns = [64] + [128] * 2 + [256] * 9 + [128] * 2 + [64, 32, 1] etas = [1] * 6 + [2, 4, 8, 16] + [1] * 7 kszs = [5] + [3] * 11 + [4, 3, 4, 3, 3] stps = [1, 2, 1, 2] + [1] * 8 + [2, 1, 2, 1, 1] dcvs = [False] * 12 + [True, False, True, False, False] usbn = [True] * 16 + [False] usrl = usbn for k in range(17): if k == 0: temp = input elif k < 9: temp = layers[-1] elif k < 15: temp = tf.concat([layers[-1], layers[15 - k]], axis=3) else: temp = layers[-1] layers += [ utils.conv_layer_2d(temp, chns[k], etas[k], kszs[k], stps[k], 'l%02d' % k, dcvs[k], usbn[k], is_train, usrl[k]) ] return tf.nn.tanh(layers[-1]), layers