Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work for Siamese networks #17

Open
GMTSE opened this issue May 19, 2020 · 0 comments
Open

Does not work for Siamese networks #17

GMTSE opened this issue May 19, 2020 · 0 comments

Comments

@GMTSE
Copy link

GMTSE commented May 19, 2020

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:
Rplot

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant