神经网络画图工具

参考博客:
使用PlotNeuralNet绘制深度学习网络图_Zhanglw882的博客-CSDN博客

用到的软件:

1、Download and install MikTeX(Getting MiKTeX),下载MikTeX软件

2、Download and install bash runner on Windows, recommends Git bash ,下载Git bash

源代码参考:PlotNeuralNet源代码链接:https://github.com/HarisIqbal88/PlotNeuralNet

参考图:

神经网络画图工具_第1张图片

 

效果图:神经网络画图工具_第2张图片

代码:


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

# defined your arch
arch = [
    to_head( '..' ),
    to_cor(),
    to_begin(),
    to_input('2.jpg',width=12, height=12),
    to_Conv("conv1", 64, 64, offset="(0,0,0)", to="(0,0,0)", height=64, depth=64, width=4, caption="Conv1"),
    to_Pool("pool1", offset="(4,0,0)", to="(conv1-east)",width=4, height=32, depth=32, caption="Maxpooling1"),
    to_Conv("conv2", 32, 64, offset="(3,0,0)", to="(pool1-east)", height=32, depth=32, width=4, caption="Conv2"),
    to_Pool("pool2", offset="(2,0,0)", to="(conv2-east)",width=4, height=16, depth=16, caption="Maxpooling2"),
    to_Conv("conv3", 16, 64, offset="(2,0,0)", to="(pool2-east)", height=16, depth=16, width=4, caption="Conv3"),
    to_Conv("conv4", 16, 64, offset="(1,0,-6)", to="(conv3-east)", height=16, depth=16, width=4, caption="Conv4"),
    to_Pool("pool3", offset="(3,0,6)", to="(conv4-east)",width=4, height=16, depth=16, caption="Concat"),
    to_Pool("pool4", offset="(0,0,0)", to="(pool3-east)",width=4, height=16, depth=16),
    to_Pool("pool5", offset="(2,0,0)", to="(pool4-east)",width=4, height=8, depth=8, caption="Maxpooling3"),
    to_Pool("pool6", offset="(0,0,0)", to="(pool5-east)",width=4, height=8, depth=8),
    to_SoftMax("soft1", 64 ,"(2,0,0)", "(pool6-east)", caption="FC"  ),
    to_SoftMax("soft2", 2 ,"(4,0,0)", "(pool6-east)", caption="Softmax"  ),
    to_connection("conv1", "pool1"),
    to_connection("pool1", "conv2"),
    to_connection("conv2", "pool2"),
    to_connection("pool2", "conv3"),
    to_connection("conv3", "conv4"),
    to_connection("conv3", "pool3"),
    to_connection("conv4", "pool3"),
    to_connection("pool4", "pool5"),
    to_connection("pool6", "soft1"),
    to_connection("soft1", "soft2"),
    to_end()
    ]

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

if __name__ == '__main__':
    main()
 

 

你可能感兴趣的:(神经网络,人工智能,深度学习)