MCPcopy Create free account
hub / github.com/commaai/research / encoder

Function encoder

models/autoencoder.py:70–97  ·  view source on GitHub ↗
(batch_size, df_dim, ch, rows, cols)

Source from the content-addressed store, hash-verified

68
69
70def encoder(batch_size, df_dim, ch, rows, cols):
71
72 model = Sequential()
73 X = Input(batch_shape=(batch_size, rows[-1], cols[-1], ch))
74 model = Convolution2D(df_dim, 5, 5, subsample=(2, 2), border_mode="same",
75 name="e_h0_conv", dim_ordering="tf", init=normal)(X)
76 model = LeakyReLU(.2)(model)
77
78 model = Convolution2D(df_dim*2, 5, 5, subsample=(2, 2), border_mode="same",
79 name="e_h1_conv", dim_ordering="tf")(model)
80 model = BN(mode=2, axis=3, name="e_bn1", gamma_init=mean_normal, epsilon=1e-5)(model)
81 model = LeakyReLU(.2)(model)
82
83 model = Convolution2D(df_dim*4, 5, 5, subsample=(2, 2), name="e_h2_conv", border_mode="same",
84 dim_ordering="tf", init=normal)(model)
85 model = BN(mode=2, axis=3, name="e_bn2", gamma_init=mean_normal, epsilon=1e-5)(model)
86 model = LeakyReLU(.2)(model)
87
88 model = Convolution2D(df_dim*8, 5, 5, subsample=(2, 2), border_mode="same",
89 name="e_h3_conv", dim_ordering="tf", init=normal)(model)
90 model = BN(mode=2, axis=3, name="e_bn3", gamma_init=mean_normal, epsilon=1e-5)(model)
91 model = LeakyReLU(.2)(model)
92 model = Flatten()(model)
93
94 mean = Dense(z_dim, name="e_h3_lin", init=normal)(model)
95 logsigma = Dense(z_dim, name="e_h4_lin", activation="tanh", init=normal)(model)
96 meansigma = Model([X], [mean, logsigma])
97 return meansigma
98
99
100def discriminator(batch_size, df_dim, ch, rows, cols):

Callers 1

get_modelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected