38

Is there any software used to draw figures in academic papers describing the structure of neural networks (specifically convolutional networks)?

The closest solution to what I want is the TikZ LaTeX library which can produce diagrams like this with a description of the network using code (it can't handle convolutional layers):

tikz-neural-net Source

Other software that describes network structure but does not visualise in 3D are:

The diagrams I want to construct follow a similar pattern, so am interested to know if there exists software more specialised than GIMP/GraphViz/Gephi/InkScape or even Powerpoint to achieve this. It would be great if it was programmable like TikZ.

Here are some examples of figures I'd like to construct (with their sources below):

enter image description here Source

LeNet5 Source

DeepFace Source

4
  • 1
    I'm sure that tikz can produce those graph given enough effort — you can find some amazing examples of tikz usage on TeX - LaTeX and texample. I could see that the input format might not be what you'd like though. Could you clarify what you mean by “it can't handle convolutional layers”? Commented Jan 24, 2016 at 12:57
  • Tikz would be great, though I haven't found an example. The convolutional layers bit is just the layered squares, or rectangular prisms in the examples. Commented Jan 24, 2016 at 13:45
  • Do you want to programmatically drive the diagraming, or are you OK laying out the diagram using a GUI interface? Also do you want it on a specific platform? Is 3D a requirement as well?
    – kenjikato
    Commented Jan 29, 2016 at 11:46
  • I need to be able to visualize 3D as shown in examples (no need to be able to view diagram from different angles). GUI is fine so long as it is simple to come back and remove a layer or add a layer without it taking too much time e.g. in second example diagram with an A - I want to remove F6 and S2 layers, I should be able to do this by deleting and connections will work themselves out. Commented Jan 29, 2016 at 12:02

3 Answers 3

34

I wrote a simple python script to draw convnet, with adjustable parameters. https://github.com/gwding/draw_convnet

draw_convnet Example Image

It might be useful to you, if you just need some simple/non-fancy illustration. It copies the style of Figure 2 in "gradient based learning applied to document recognition"

7
  • Thank you for taking the time to write this and share it. Commented Mar 1, 2016 at 10:12
  • @gwding Thank you sir for this useful post. I'm trying to play with the parameters in the code but I'm getting errors related to index out of bounds. Do you have a more illustrative guide to change these parameters? Commented Sep 27, 2016 at 0:40
  • @IbrahimAmer I don't have any written instructions. if you can put your error message into a github issue in that repo, I might be able to help
    – gwding
    Commented Sep 28, 2016 at 14:42
  • @gwding How did you get 18x18 dimensions when performing convolutions with 5x5 kernel? I assume that the text below each step designates what is performed there to get the next image, as can be concluded with Flatten step. Commented Aug 10, 2017 at 12:19
  • @AleksandarJovanovic the size would depend on kernel size, stride size and padding. i don't remember the exact set ups. but it is likely due to stride
    – gwding
    Commented Aug 11, 2017 at 17:31
17

I wrote an in-browser tool for this as well: NN-SVG and you can find the source here. Choose from FCNN layout, LeNet layout, and AlexNet layout.

enter image description here

3
4

This is great: https://github.com/HarisIqbal88/PlotNeuralNet. Solves my problem well, and is written in python/tex.

Your Answer

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

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