Example #1
0
def decoder(inputs, decode_layer):
    net = tflearn.fully_connected(inputs, (side // 2**2)**2 * 32,
                                  name='DecFC1')
    d = tf.transpose(net.W)
    print "Decoder Weights shape", d.get_shape()
    net = tflearn.batch_normalization(net, name='DecBN1')
    net = tflearn.elu(net)
    print "========================"
    print "dec-L1", net.get_shape()
    print "========================"

    net = tflearn.reshape(net, (-1, side // 2**2, side // 2**2, 32))
    net = tflearn.conv_2d(net, 32, 3, name='DecConv1')
    net = tflearn.batch_normalization(net, name='DecBN2')
    net = tflearn.elu(net)
    print "========================"
    print "dec-L2", net.get_shape()
    print "========================"
    net = tflearn.conv_2d_transpose(net,
                                    16,
                                    3, [side // 2, side // 2],
                                    strides=2,
                                    padding='same',
                                    name='DecConvT1')
    net = tflearn.batch_normalization(net, name='DecBN3')
    net = tflearn.elu(net)
    print "========================"
    print "dec-L3", net.get_shape()
    print "========================"
    net = tflearn.conv_2d(net, 16, 3, name='DecConv2')
    net = tflearn.batch_normalization(net, name='DecBN4')
    net = tflearn.elu(net)
    print "========================"
    print "dec-L4", net.get_shape()
    print "========================"
    net = tflearn.conv_2d_transpose(net,
                                    channel,
                                    3, [side, side],
                                    strides=2,
                                    padding='same',
                                    activation='sigmoid',
                                    name='DecConvT2')

    print "========================"
    print "output layer", net.get_shape()
    print "========================"
    return [net, d]
Example #2
0
def encoder(inputs, hidden_layer):
    nb_feature = 64
    net = tflearn.conv_2d(inputs, 16, 3, strides=2)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L1", net.get_shape()
    print "========================"

    net = tflearn.conv_2d(net, 16, 3, strides=1)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L2", net.get_shape()
    print "========================"

    net = tflearn.conv_2d(net, 32, 3, strides=2)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L3", net.get_shape()
    print "========================"
    net = tflearn.conv_2d(net, 32, 3, strides=1)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L4", net.get_shape()
    print "========================"
    net = tflearn.flatten(net)
    #net = tflearn.fully_connected(net, nb_feature,activation="sigmoid")
    net = tflearn.fully_connected(net, nb_feature)

    h = net.W
    print "Encoder Weights shape", h.get_shape()

    net = tflearn.batch_normalization(net)
    net = tflearn.sigmoid(net)
    print "========================"
    print "hidden", net.get_shape()
    print "========================"

    return [net, h]
def decoder(inputs):
    net = tflearn.fully_connected(inputs, 1200 * 32, name='DecFC1')
    net = tflearn.batch_normalization(net, name='DecBN1')
    net = tflearn.elu(net)
    print "========================"
    print "dec-L1",net.get_shape()
    print "========================"

    net = tflearn.reshape(net, (-1, side1 // 2**2, side2 // 2**2, 32))
    net = tflearn.conv_2d(net, 32, 3, name='DecConv1')
    net = tflearn.batch_normalization(net, name='DecBN2')
    net = tflearn.elu(net)
    print "========================"
    print "dec-L2",net.get_shape()
    print "========================"

    net = tflearn.conv_2d_transpose(net, 16, 3, [side1 // 2, side2 // 2],
                                        strides=2, padding='same', name='DecConvT1')
    net = tflearn.batch_normalization(net, name='DecBN3')
    net = tflearn.elu(net)
    print "========================"
    print "dec-L3",net.get_shape()
    print "========================"

    net = tflearn.conv_2d(net, 16, 3, name='DecConv2')
    net = tflearn.batch_normalization(net, name='DecBN4')
    net = tflearn.elu(net)
    print "========================"
    print "dec-L4",net.get_shape()
    print "========================"

    net = tflearn.conv_2d_transpose(net, channel, 3, [side1, side2],
                                        strides=2, padding='same', activation='sigmoid',
                                        name='DecConvT2')
    decode_layer = net
    print "========================"
    print "output layer",net.get_shape()
    print "========================"

    return [net,decode_layer]
def encoder(inputs,hidden_layer):
    net = tflearn.conv_2d(inputs, 16, 3, strides=2)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L1",net.get_shape()
    print "========================"

    net = tflearn.conv_2d(net, 16, 3, strides=1)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L2",net.get_shape()
    print "========================"

    net = tflearn.conv_2d(net, 32, 3, strides=2)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L3",net.get_shape()
    print "========================"
    net = tflearn.conv_2d(net, 32, 3, strides=1)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L4",net.get_shape()
    print "========================"
    net = tflearn.flatten(net)
    #net = tflearn.fully_connected(net, nb_feature,activation="sigmoid")
    net = tflearn.fully_connected(net, nb_feature)
    hidden_layer = net
    net = tflearn.batch_normalization(net)
    net = tflearn.sigmoid(net)
    print "========================"
    print "hidden",net.get_shape()
    print "========================"

    return [net,hidden_layer]
Example #5
0
File: RCAE.py Project: kiminh/AMAD
	def encoder(self,inputs,hidden_layer):
		net = tflearn.conv_2d(inputs, 16, 3, strides=2)
		net = tflearn.batch_normalization(net)
		net = tflearn.elu(net)
		print "========================"
		print "enc-L1",net.get_shape()
		print "========================"

		net = tflearn.conv_2d(net, 16, 3, strides=1)
		net = tflearn.batch_normalization(net)
		net = tflearn.elu(net)
		print "========================"
		print "enc-L2",net.get_shape()
		print "========================"

		net = tflearn.conv_2d(net, 32, 3, strides=2)
		net = tflearn.batch_normalization(net)
		net = tflearn.elu(net)
		print "========================"
		print "enc-L3",net.get_shape()
		print "========================"
		net = tflearn.conv_2d(net, 32, 3, strides=1)
		net = tflearn.batch_normalization(net)
		net = tflearn.elu(net)
		print "========================"
		print "enc-L4",net.get_shape()
		print "========================"
		net = tflearn.flatten(net)
		#net = tflearn.fully_connected(net, nb_feature,activation="sigmoid")
		net = tflearn.fully_connected(net, self.instance_dim)
		hidden_layer = net
		net = tflearn.batch_normalization(net)
		net = tflearn.sigmoid(net)
		print "========================"
		print "hidden",net.get_shape()
		print "========================"

		return [net,hidden_layer]
def encoder(inputs):
    net = tflearn.conv_2d(inputs, 16, 3, strides=2)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L1",net.get_shape()
    print "========================"

    net = tflearn.conv_2d(net, 16, 3, strides=1)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L2",net.get_shape()
    print "========================"

    net = tflearn.conv_2d(net, 32, 3, strides=2)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "enc-L3",net.get_shape()

    net = tflearn.conv_2d(net, 32, 3, strides=1)
    net = tflearn.batch_normalization(net)
    net = tflearn.elu(net)
    print "========================"
    print "enc-L4",net.get_shape()
    print "========================"

    net = tflearn.flatten(net)
    net = tflearn.fully_connected(net, nb_feature)
    hidden_layer = net
    net = tflearn.batch_normalization(net)
    net = tflearn.sigmoid(net)
    print "========================"
    print "enc-hidden_L",net.get_shape()
    print "========================"


    return [net,hidden_layer]
Example #7
0
File: RCAE.py Project: kiminh/AMAD
	def decoder(self,inputs,decode_layer):
		net = tflearn.fully_connected(inputs, self.hidden_dim, name='DecFC1')
		net = tflearn.batch_normalization(net, name='DecBN1')
		net = tflearn.elu(net)
		print "========================"
		print "dec-L1",net.get_shape()
		print "========================"

		net = tflearn.reshape(net, (-1, 1, 1, self.hidden_dim))
		net = tflearn.conv_2d(net, 32, 3, name='DecConv1')
		net = tflearn.batch_normalization(net, name='DecBN2')
		net = tflearn.elu(net)
		print "========================"
		print "dec-L2",net.get_shape()
		print "========================"
		net = tflearn.conv_2d_transpose(net, 16, 3, [1, self.hidden_dim],
		                                    strides=2, padding='same', name='DecConvT1')
		net = tflearn.batch_normalization(net, name='DecBN3')
		net = tflearn.elu(net)
		print "========================"
		print "dec-L3",net.get_shape()
		print "========================"
		net = tflearn.conv_2d(net, 16, 3, name='DecConv2')
		net = tflearn.batch_normalization(net, name='DecBN4')
		net = tflearn.elu(net)
		print "========================"
		print "dec-L4",net.get_shape()
		print "========================"
		net = tflearn.conv_2d_transpose(net, 1, 3, [1, self.hidden_dim],
		                                    strides=2, padding='same', activation='sigmoid',
		                                    name='DecConvT2')
		decode_layer = net
		print "========================"
		print "output layer",net.get_shape()
		print "========================"
		return [net,decode_layer]