Skip to content

Instantly share code, notes, and snippets.

@sdcubber
Last active July 31, 2018 11:00
Show Gist options
  • Save sdcubber/52b66bde67bf46f2f02eb24d20629f97 to your computer and use it in GitHub Desktop.
Save sdcubber/52b66bde67bf46f2f02eb24d20629f97 to your computer and use it in GitHub Desktop.
with tf.Session() as sess:
tf.keras.backend.set_session(sess)
sess.run(ds_tr_init) # initialize the generator
# Rewire network to tie it into the generator
image_input = tf.keras.Input(tensor=x)
# Model definition
...
# Specify the model
model = tf.keras.Model(inputs=image_input, outputs=[weather_output, ground_output])
# Supply the outputs of the generator as target tensors
model.compile(optimizer='adam', loss='binary_crossentropy', target_tensors=[w,g])
model.fit(steps_per_epoch=len(df_train) // batch_size, verbose=1, epochs=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment