You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I really like your tool. For me, it is the very good way to visualize my networks. Currently, I am using a model with multiple input branches that are concatenated at a later stage. Unfortunately, Net2Vis assumes all input layers to be a split of the same input (even if the shapes differ). I would appreciate if your tool could support multiple input branches.
Please find attached the graphical output and my model code.
# You can freely modify this file.# However, you need to have a function that is named get_model and returns a Keras Model.importkerasfromkerasimportmodelsfromkerasimportlayersfromkerasimportutilsdefget_model():
window=65variables=9n_branches=4input_shape= [(window, 1, variables),
(window, 1, variables),
(window, 1, variables),
(window, 1, variables+1)]
output_shape=4conf= [64, 32, 16]
bn=Falseactivation=keras.layers.ReLUactivation_output=keras.layers.Activationdropout=Truedropout_rate=0.2# input tail 0x_input_b0=keras.layers.Input(shape=input_shape[0])
x_in_b0=keras.layers.Flatten()(x_input_b0)
forlayer, n_hiddeninenumerate(conf):
x_in_b0=keras.layers.Dense(n_hidden)(x_in_b0)
ifbnisTrue:
x_in_b0=keras.layers.BatchNormalization()(x_in_b0)
x_in_b0=activation()(x_in_b0)
ifdropoutisnotNone:
x_in_b0=keras.layers.Dropout(dropout_rate)(x_in_b0)
# input tail 1x_input_b1=keras.layers.Input(shape=input_shape[1])
x_in_b1=keras.layers.Flatten()(x_input_b1)
forlayer, n_hiddeninenumerate(conf):
x_in_b1=keras.layers.Dense(n_hidden)(x_in_b1)
ifbnisTrue:
x_in_b1=keras.layers.BatchNormalization()(x_in_b1)
x_in_b1=activation()(x_in_b1)
ifdropoutisnotNone:
x_in_b1=keras.layers.Dropout(dropout_rate)(x_in_b1)
# input tail 2x_input_b2=keras.layers.Input(shape=input_shape[2])
x_in_b2=keras.layers.Flatten()(x_input_b2)
forlayer, n_hiddeninenumerate(conf):
x_in_b2=keras.layers.Dense(n_hidden)(x_in_b2)
ifbnisTrue:
x_in_b2=keras.layers.BatchNormalization()(x_in_b2)
x_in_b2=activation()(x_in_b2)
ifdropoutisnotNone:
x_in_b2=keras.layers.Dropout(dropout_rate)(x_in_b2)
# input tail 3x_input_b3=keras.layers.Input(shape=input_shape[3])
x_in_b3=keras.layers.Flatten()(x_input_b3)
forlayer, n_hiddeninenumerate(conf):
x_in_b3=keras.layers.Dense(n_hidden)(x_in_b3)
ifbnisTrue:
x_in_b3=keras.layers.BatchNormalization()(x_in_b3)
x_in_b3=activation()(x_in_b3)
ifdropoutisnotNone:
x_in_b3=keras.layers.Dropout(dropout_rate)(x_in_b3)
# concat all inputsx_input= [x_input_b0, x_input_b1, x_input_b2, x_input_b3]
x_concat=keras.layers.Concatenate()([x_in_b0, x_in_b1, x_in_b2, x_in_b3])
# output tailn_neurons_concat=int(conf[-1]) *n_brancheslayer_concat=0forexpinreversed(range(2, n_branches+1)):
n_neurons=output_shape**expifn_neurons<n_neurons_concat:
layer_concat+=1x_concat=keras.layers.Dense(n_neurons)(x_concat)
ifbnisTrue:
x_concat=keras.layers.BatchNormalization()(x_concat)
x_concat=activation()(x_concat)
ifdropoutisnotNone:
x_concat=keras.layers.Dropout(dropout_rate)(x_concat)
x_concat=keras.layers.Dense(output_shape)(x_concat)
out=activation_output("linear")(x_concat)
model=keras.Model(inputs=x_input, outputs=[out])
returnmodel
The text was updated successfully, but these errors were encountered:
Dear developers,
I really like your tool. For me, it is the very good way to visualize my networks. Currently, I am using a model with multiple input branches that are concatenated at a later stage. Unfortunately, Net2Vis assumes all input layers to be a split of the same input (even if the shapes differ). I would appreciate if your tool could support multiple input branches.
Please find attached the graphical output and my model code.
The text was updated successfully, but these errors were encountered: