-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenerator.py
36 lines (27 loc) · 1.06 KB
/
Generator.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
#implement Generator
#######################################################################
from __future__ import print_function, division
from keras.layers import Input, Dense, Reshape, Concatenate, Activation,LeakyReLU
from keras.models import Sequential, Model
#######################################################################
def build_generator():
##########################################
latent_dim = 312
attribute_dim = 85
features_dim = 2048
in_dim = attribute_dim + latent_dim
out_shape = (features_dim,)
##########################################
model = Sequential()
model.add(Dense(4096, input_dim=in_dim))
model.add(LeakyReLU(alpha=0.01))
model.add(Dense(2048))
model.add(Activation("relu"))
model.add(Reshape(out_shape))
model.summary()
##########################################
noise = Input(shape=(latent_dim,))
label = Input(shape=(attribute_dim,))
model_input = Concatenate()([noise, label])
img = model(model_input)
return Model([noise, label], img)