PlotNeuralNet README

The project's README from github.com/HarisIqbal88/PlotNeuralNet. As one markdown file: README.md.

PlotNeuralNet

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.

Examples

Following are some network representations:

FCN-8 (view on Overleaf)

FCN-32 (view on Overleaf)

Holistically-Nested Edge Detection (view on Overleaf)

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](https://miktex.org/download).
2. Download and install bash runner on Windows, recommends [Git bash](https://git-scm.com/download/win) or Cygwin(https://www.cygwin.com/)
  1. Execute the example as followed.
    cd pyexamples/
    bash ../tikzmake.sh test_simple
    

TODO

Latex usage

See examples directory for usage.

Python usage

First, create a new directory and a new Python file:

$ mkdir my_project
$ cd my_project
vim my_arch.py

Add the following code to your new file:

import sys
sys.path.append('../')
from pycore.tikzeng import *

# defined your arch
arch = [
    to_head( '..' ),
    to_cor(),
    to_begin(),
    to_Conv("conv1", 512, 64, offset="(0,0,0)", to="(0,0,0)", height=64, depth=64, width=2 ),
    to_Pool("pool1", offset="(0,0,0)", to="(conv1-east)"),
    to_Conv("conv2", 128, 64, offset="(1,0,0)", to="(pool1-east)", height=32, depth=32, width=2 ),
    to_connection( "pool1", "conv2"),
    to_Pool("pool2", offset="(0,0,0)", to="(conv2-east)", height=28, depth=28, width=1),
    to_SoftMax("soft1", 10 ,"(3,0,0)", "(pool1-east)", caption="SOFT"  ),
    to_connection("pool2", "soft1"),
    to_end()
    ]

def main():
    namefile = str(sys.argv[0]).split('.')[0]
    to_generate(arch, namefile + '.tex' )

if __name__ == '__main__':
    main()

Now, run the program as follows:

bash ../tikzmake.sh my_arch

PlotNeuralNet (HarisIqbal88/PlotNeuralNet)

Searching Database…

这是干什么的?PlotNeuralNet 是一套用来画神经网络示意图的 LaTeX 代码,适合写报告和做演示,里面还带了 FCN-8、FCN-32 这样现成的例子。
也就是说我不用在编辑器里手动画图——那它具体是怎么工作的?你用代码描述你的网络,TikZ 会把它渲染成矢量图:可以直接写 LaTeX(examples 目录里有示范),也可以用它自带的 Python 接口。
怎么把它跑起来?先装好 TeX 工具链:Ubuntu 16.04/18.04 按它列出的软件包安装,Windows 上装 MikTeX,再配一个 bash 运行环境,比如 Git bash 或 Cygwin。然后用 bash ../tikzmake.sh myarch 跑一个例子。
我得是 LaTeX 高手才能用吗?不用。除了 examples 目录里演示的直接用 LaTeX 的方式,还有 Python 接口:写一个像 myarch.py 这样的脚本描述你的各个层,然后运行 bash ../tikzmake.sh myarch。
有什么它还画不了的吗?TODO 列表里还有:方便的图例功能、更多层的形状(比如 TruncatedPyramid 和 2DSheet),以及 RNN 这类网络的示例;Python 接口本身已经做完了。
在我的 Mac 上能用吗,还是只支持 Linux 和 Windows?README 只给了 Ubuntu 16.04/18.04 的安装步骤,以及 Windows 上通过 MikTeX 加 Git bash 或 Cygwin 的做法;没有提到 macOS。
现成的例子展示了哪些网络?README 列出了 FCN-8、FCN-32 和 Holistically-Nested Edge Detection 作为示例网络,并让你去 examples 目录查看每个网络具体是怎么搭建的。
作者为什么把这个项目公开出来?为了让大家共享改进:README 希望用户把自己的改进和 bug 修复整合回这个项目,让这些代码帮到更多人。
Size
2.2 MB
Stars
25K
Age
8y
Commits · 90 Days