mukhinaks / deepplot

Latex code for making neural networks diagrams

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deepplot

Link to original project: DOI

Latex code for drawing neural networks for reports and presentation. Have a look into examples to see how they are made. Additionally, lets consolidate any improvements that you make and fix any bugs to help more people with this code.

Difference from original

  • If layer setting is not defined default box will be drawn
  • You can change color of layers

TODO

  • Easy color usage
  • Arrow modification
  • Automatic legend
  • Add examples

Getting Started

  1. Install the following packages on Ubuntu.

    • Ubuntu 16.04

      sudo apt-get install texlive-latex-extra
      
    • Ubuntu 18.04.2 Base on this website, please install the following packages.

      sudo apt-get install texlive-latex-base
      sudo apt-get install texlive-fonts-recommended
      sudo apt-get install texlive-fonts-extra
      sudo apt-get install texlive-latex-extra
      
    • Windows

    1. Download and install MikTeX.
    2. Download and install bash runner on Windows, recommends Git bash or Cygwin(https://www.cygwin.com/)
    • Mac

      Install MacTex from here.

Python usage

import sys
sys.path.append('..')

from core.texpage import *
import subprocess

# Define tex page
page = TexPage()

# Add layers to model
page.model.addLayer('Conv2D','c1', 2, 64, 64)
page.model.addLayer('MaxPool', 'pool1', 2, 32, 32)
page.model.addLayer('Conv2D', 'c2', 2, 32, 32)
page.model.addLayer('MaxPool', 'pool2', 1, 28, 28)
page.model.addLayer('SoftMax', 'soft', 1, 28, 28)
page.model.addConnection('pool1', 'c2')
page.model.addConnection('pool2', 'soft')

# Create tex file
namefile = str(sys.argv[0]).split('.')[0]
page.generate(namefile + '.tex' )

# Run tex to get pdf
return_value = subprocess.call(['pdflatex', namefile + '.tex'], shell=False)

Examples

Following are some network representations:

FCN-8

FCN-32

Holistically-Nested Edge Detection

About

Latex code for making neural networks diagrams

License:Other


Languages

Language:Python 53.7%Language:TeX 46.3%