Exemple #1
0
def DfromNoise(x, init='random_normal', reuse=False):
    with tf.variable_scope('DiscriminatorNoise', reuse=reuse):
        leaky = tf.nn.leaky_relu
        d = tf.layers.conv2d(x, 32, 3, 2, padding='same', name='d1')
        d = tf.layers.batch_normalization(d)
        d = leaky(d)
        d = tf.layers.dropout(d)

        d = tf.layers.conv2d(d, 64, 3, 2, padding='same', name='d2')
        d = tf.layers.batch_normalization(d)
        d = leaky(d)
        d = tf.layers.dropout(d)

        d = tf.layers.conv2d(d, 128, 3, 2, padding='same', name='d3')
        d = tf.layers.batch_normalization(d)
        d = leaky(d)
        d = tf.layers.dropout(d)

        d = tf.layers.conv2d(d, 128, 3, 2, padding='same', name='d4')
        d = tf.layers.batch_normalization(d)
        d = leaky(d)
        d = tf.layers.dropout(d)

        d = tf.layers.flatten(d)
        d = tf.layers.dense(d, 1, name='d5')
        return d, tf.reduce_mean(ml.sigmoid(d))
Exemple #2
0
def DverticalS(x, reuse=False):
    init = tf.random_normal_initializer(stddev=0.02)
    with tf.variable_scope('DiscriminatorVS', reuse=reuse):
        d = ml.convLrelu(x, 32, 3, 2, 'same', init=init, name='d_enc1')
        d = ml.convLrelu(d, 64, 3, 2, 'same', init=init, name='d_enc2')
        d = ml.convLrelu(d, 64, 3, 2, 'same', init=init, name='d_enc3')
        d = ml.convLrelu(d, 64, 3, 2, 'same', init=init, name='d_enc4')
        d = ml.dropout(d, 0.5, name='drop1')
        d = ml.fullConn(d, 1, init=init, name='d_fc1')
        return d, tf.reduce_mean(ml.sigmoid(d))
Exemple #3
0
def Dm(x, ksz=5, s=2, prob=0.5, reuse=False):
    init = tf.random_normal_initializer(stddev=0.02)
    with tf.variable_scope('DiscriminatorM', reuse=reuse):
        d = ml.convLrelu(x, 64, ksz, s, 'same', init=init,
                         name='dm_enc1')  #(32,128)
        d = ml.convLrelu(d, 128, ksz, s, 'same', init=init,
                         name='dm_enc2')  #(16,64)
        d = ml.convLrelu(d, 128, ksz, s, 'same', init=init,
                         name='dm_enc3')  #(8,32)
        d = ml.convLrelu(d, 128, ksz, s, 'same', init=init,
                         name='dm_enc4')  #(4,16)
        #d = ml.flatten(d)
        d = ml.dropout(d, prob, name='drop1')
        d = ml.fullConn(d, 1, init=init, name='d_fc1')
        return d, tf.reduce_mean(ml.sigmoid(d))
Exemple #4
0
def Drefine(x, prob, reuse=False):
    init = tf.random_normal_initializer(stddev=0.02)
    keep_prob = prob
    with tf.variable_scope('DiscriminatorRef', reuse=reuse):
        d = ml.lrelu(ml.conv(x, 32, 3, 2, init=init, name='dconv1'))
        d = ml.lrelu(ml.conv(d, 64, 3, 2, init=init, name='dconv2'))
        d = ml.lrelu(ml.conv(d, 128, 3, 2, init=init, name='dconv3'))
        d = ml.lrelu(ml.conv(d, 128, 3, 2, init=init, name='dconv4'))
        d = ml.lrelu(ml.conv(d, 128, 3, 2, init=init, name='dconv5'))
        # d = ml.leaky(ml.conv(d,256,3,1,name='dconv5'))
        # d = ml.leaky(ml.conv(d,256,3,2,name='dconv6'))
        # d = ml.leaky(ml.conv(d,512,3,2,name='dconv7'))
        # d = ml.leaky(ml.conv(d,512,3,2,name='dconv8'))
        d = ml.fullConn(d, 1, name='dconv6')
        return d, tf.reduce_mean(ml.sigmoid(d))