0
$\begingroup$

I am new to deep learning models, and I am trying to figure out the best way to draw a visual representation of the following model. I found a few tools that allow you to draw a model, but I am confused about what the 'best' way to draw this particular model would be.

enter image description here

Any suggestions or recommendations would be great.

Thanks!

$\endgroup$

2 Answers 2

1
$\begingroup$

You should Go along with Tensorboard, it looks more professional than the rest and it is easier to understand the model.

May I ask your exact purpose for the visualization? You could check others material with the similar purpose and go along with the general choice! Many would go for draw_convnet or PlotNeuralNet if the final use-case was to publish a blog. It also depends on which libraries and softwares you are using!

$\endgroup$
2
  • $\begingroup$ thanks for the response! The visualization is for a presentation. I have never drawn a model like this before, and i'm confused about the layers. I can give TensorBoard a try, can you recommend a tutorial for me to follow? $\endgroup$
    – Pythoner
    Aug 28, 2020 at 16:56
  • $\begingroup$ It's okay to be confused, everyone is at the beginning! Here is the link: tensorflow.org/tensorboard/graphs It was in the link you provided yourself! $\endgroup$
    – Academic
    Aug 29, 2020 at 0:09
0
$\begingroup$

You can use tf.keras.utils.plot_model. For instance this example given in the tensorflow doc:

import tensorflow as tf

input = tf.keras.Input(shape=(100,), dtype='int32', name='input')
x = tf.keras.layers.Embedding(
    output_dim=512, input_dim=10000, input_length=100)(input)
x = tf.keras.layers.LSTM(32)(x)
x = tf.keras.layers.Dense(64, activation='relu')(x)
x = tf.keras.layers.Dense(64, activation='relu')(x)
x = tf.keras.layers.Dense(64, activation='relu')(x)
output = tf.keras.layers.Dense(1, activation='sigmoid', name='output')(x)
model = tf.keras.Model(inputs=[input], outputs=[output])
dot_img_file = 'model_1.png'
tf.keras.utils.plot_model(model, to_file=dot_img_file, show_shapes=True)

you get the following:

enter image description here

For this function to work you need to install the dependencies:

  • pydot (pip3 install pydot)
  • an graphviz (install will depend on your OS) have a look at this link
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.