Пример #1
0
def discriminator2_32X32_dc(x,
                            training=True,
                            reuse=True,
                            name="discriminator"):

    # Network Architecture is exactly same as in infoGAN (https://arxiv.org/abs/1606.03657)
    # Architecture : (64)4c2s-(128)4c2s_BL-FC1024_BL-FC1_S
    with tf.variable_scope(name, reuse=reuse):
        net = lrelu(conv2d(x, 64, 4, 4, 2, 2, name='d_conv1'))
        net = lrelu(
            bn(conv2d(net, 64 * 2, 4, 4, 2, 2, name='d_conv2'),
               is_training=training,
               scope='d_bn2'))
        net = lrelu(
            bn(conv2d(net, 64 * 4, 4, 4, 2, 2, name='d_conv3'),
               is_training=training,
               scope='d_bn3'))
        net = lrelu(
            bn(conv2d(net, 64 * 8, 4, 4, 2, 2, name='d_conv4'),
               is_training=training,
               scope='d_bn4'))
        # net = tf.reshape(net, [batch_size, -1])
        # net = lrelu(bn(linear(net, 1024, scope='d_fc3'), is_training=training, scope='d_bn3'))
        # net = fc(net, 1024)
        # net = lrelu(bn(net, is_training=training, scope='d_bn5'))
        # net = fc(net, 1024)
        # net = lrelu(bn(net, is_training=training, scope='d_bn3'))
        # out_logit = linear(net, 1, scope='d_fc4')
        # out_logit = linear(tf.reshape(net, [64, -1]), 1, 'd_h4_lin')
        # out_logit = linear(net, 1, scope='d_fc4')
        # out = tf.nn.sigmoid(out_logit)
        out_logit = fc(net, 1)
        return out_logit
def mgan_dis(x, training=True, reuse=True, name = "discriminator"):
    with tf.variable_scope(name, reuse=reuse):
        net = lrelu(conv2d(x, 128, 5, 5, 2, 2, name='d_conv1'))
        net = lrelu(bn(conv2d(net, 256, 5, 5, 2, 2, name='d_conv2'), is_training=training, scope='d_bn2'))
        net = lrelu(bn(conv2d(net, 512, 5, 5, 2, 2, name='d_conv3'), is_training=training, scope='d_bn3'))
        # net = tf.reshape(net, [batch_size, -1])
        # net = lrelu(bn(linear(net, 1024, scope='d_fc3'), is_training=training, scope='d_bn3'))
        out_logit = fc(net,1)
        # net = lrelu(bn(net, is_training=training, scope='d_bn3'))
        # out_logit = linear(net, 1, scope='d_fc4')
        return out_logit