def consistentG(g): with tf.variable_scope('Consistency'): g_const = util.catConst(g) conv = ml.convLrelu(g_const, 16, 3, 1, name='g_conv1') conv = ml.convLrelu(conv, 32, 3, 1, name='g_conv2') conv = ml.convLrelu(conv, 3, 3, 1, name='g_conv3') return ml.tanh(conv)
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))
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))
def Gs3(x, ksz=3, s=2, init='he_uniform', reuse=False): with tf.variable_scope('Generator', reuse=reuse): enc_h = ml.convLrelu(x, 64, ksz, s, 'same', name='g_enc1') #(64,256) enc_m = ml.convLrelu(enc_h, 128, ksz, s, 'same', name='g_enc2') #(32,128) enc1 = lrelu(conv2d(enc_m, 256, ksz, s, 'same', name='g_enc3')) #(16,64) enc2 = lrelu(conv2d(enc1, 256, ksz, s, 'same', name='g_enc4')) #(8,32) enc3 = lrelu(conv2d(enc2, 256, ksz, s, 'same', name='g_enc5')) #(4,16) enc4 = lrelu(conv2d(enc3, 512, ksz, s, 'same', name='g_enc6')) #(2,8) enc5 = lrelu(conv2d(enc4, 512, ksz, s, 'same', name='g_enc7')) #(1,4) dec1 = lrelu(conv2d(enc5, 512, ksz, s, 'same', name='g_dec1')) #(2,8) dec2 = lrelu( conv2d(dstack(dec1, enc4), 512, ksz, s, 'same', name='g_dec2')) #(4,16) dec3 = lrelu( conv2d(dstack(dec2, enc3), 256, ksz, s, 'same', name='g_dec3')) #(8,32) dec4 = lrelu( conv2d(dstack(dec3, enc2), 256, ksz, s, 'same', name='g_dec4')) #(16,64) dec5 = lrelu( conv2d(dstack(dec4, enc1), 128, ksz, s, 'same', name='g_dec5')) #(32,128) dec6 = lrelu( conv2d(dstack(dec5, enc_m), 64, ksz, s, 'same', name='g_dec6')) #(64,128) # Output high dec_h = tanh( deconv2d(dstack(dec6, enc_h), 3, ksz, s, 'same', name='im_h')) #(128,256) # Output med #1x1 conv dec_m = tanh(deconv2d(dec6, 3, 1, 1, 'same', name='im_m')) # Output small #1x1 conv dec_s = tanh(deconv2d(dec5, 3, 1, 1, 'same', name='im_s')) return dec_s, dec_m, dec_h