deepviz
deepviz copied to clipboard
Does not work for Siamese networks
Here is a piece of code that creates a siamese network:
input_a <- layer_input(shape=input_shape, name="left")
input_b <- layer_input(shape=input_shape, name="right")
processed_a <- input_a %>% base_network
processed_b <- input_b %>% base_network
end_network <- list(processed_a,processed_b) %>%
layer_concatenate() %>%
layer_dropout(0.1) %>%
layer_dense(2, activation='softmax')
model <- keras_model(inputs=list(input_a, input_b), outputs=end_network)
Here is the (correct) output of printing the model:
15:18:27 R > model
Model
Model: "model_3"
________________________________________________________________________________________________________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
================================================================================================================================================================================================
left (InputLayer) [(None, 1)] 0
________________________________________________________________________________________________________________________________________________________________________________________________
right (InputLayer) [(None, 1)] 0
________________________________________________________________________________________________________________________________________________________________________________________________
model_2 (Model) (None, 128) 16768 left[0][0]
right[0][0]
________________________________________________________________________________________________________________________________________________________________________________________________
concatenate (Concatenate) (None, 256) 0 model_2[3][0]
model_2[4][0]
________________________________________________________________________________________________________________________________________________________________________________________________
dropout_3 (Dropout) (None, 256) 0 concatenate[0][0]
________________________________________________________________________________________________________________________________________________________________________________________________
dense_5 (Dense) (None, 2) 514 dropout_3[0][0]
================================================================================================================================================================================================
Total params: 17,282
Trainable params: 17,282
Non-trainable params: 0
________________________________________________________________________________________________________________________________________________________________________________________________
Here is the resulting graph with your tool:
Your tool missed the fact that input_right is linked to model_2.
Also, it would be great to be able to draw models recursively (e.g. see the internals of model_2 here)