Skip to content

Instantly share code, notes, and snippets.

@sdcubber
Created September 15, 2018 14:10
Show Gist options
  • Save sdcubber/3f1daf3ca47582e4bd8f20ad7a40a859 to your computer and use it in GitHub Desktop.
Save sdcubber/3f1daf3ca47582e4bd8f20ad7a40a859 to your computer and use it in GitHub Desktop.
sequence_input = keras.layers.Input((100, 5)) # 100 timesteps, 5 features
image_input = keras.layers.Input((128, 128, 3)) # 128x128 pixels, 3 channels
auxiliary_input = keras.layers.Input((10,)) # Additional vector input
sequence_module = keras.layers.LSTM(128)(sequence_input)
image_module = keras.layers.Conv2D(32, 1)(image_input)
image_features = keras.layers.Flatten()(image_module)
concat = keras.layers.Concatenate()([sequence_module, image_features, auxiliary_input])
classification_output = keras.layers.Dense(1, activation='sigmoid')(concat)
regression_output = keras.layers.Dense(12)(concat)
# Wrap in a model instance, specify lists of inputs and outputs
model = keras.models.Model(inputs=[sequence_input, image_input, auxiliary_input], outputs=[classification_output,
regression_output])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment