-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathautoencoder_model_db.py
73 lines (69 loc) · 5.53 KB
/
autoencoder_model_db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import tensorflow as tf
def get_model_1(model_in, encoder_lname, decoder_lname):
tf_out = tf.layers.Conv2D(16, 4, 2, activation=tf.nn.leaky_relu, padding='valid', name='Conv_1')(model_in)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_2')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_3')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_4')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(64, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_5')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(64, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_6')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(64, 3, strides=1,
activation=tf.nn.leaky_relu, padding='valid', name=encoder_lname)(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(64, 3, strides=1,
activation=tf.nn.leaky_relu, padding='valid', name='Deconv_1')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(64, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_2')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(64, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_3')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_4')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_5')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_6')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(1, 4, 2, activation=tf.nn.leaky_relu, padding='valid', name=decoder_lname)(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
return tf_out
def get_model_2(model_in, encoder_lname, decoder_lname):
tf_out = tf.layers.Conv2D(16, 4, 2, activation=tf.nn.leaky_relu, padding='valid', name='Conv_1')(model_in)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_2')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_3')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_4')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(64, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_5')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(64, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_6')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(64, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Conv_7')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2D(32, 1, strides=1,
activation=tf.nn.leaky_relu, padding='valid', name=encoder_lname)(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(32, 1, strides=1,
activation=tf.nn.leaky_relu, padding='valid', name='Deconv_1')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(64, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_2')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(64, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_3')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(64, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_4')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_5')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_6')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(32, 3, 1, activation=tf.nn.leaky_relu, padding='valid', name='Deconv_7')(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
tf_out = tf.layers.Conv2DTranspose(1, 4, 2, activation=tf.nn.leaky_relu, padding='valid', name=decoder_lname)(tf_out)
print('{}\'s shape {}'.format(tf_out.name, tf_out.shape))
return tf_out