PlotNeuralNet绘图


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

# defined your arch
arch = [
    to_head( '..' ), #初始化
    to_cor(),  #颜色设置
    to_begin(), #开始标志
    # to_input('1.png',width=8, height=8,name="cat"), #参数分别是图片路径名称、宽、高、以及名称
    to_Conv("conv1", 512, 64, offset="(0,0,0)", to="(0,0,0)", height=64, depth=64, width=2 ), #添加一层卷积层  (to_ConvConvRelu	添加一层带有relu操作的卷积层)
    to_Pool("pool1", offset="(0,0,0)", to="(conv1-east)"), #添加一层池化层
    #to是坐标、位置  offset则是偏移位置 (个人理解)
    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="(conv2-east)"--在con2层的东侧 #opacity=0.9
    to_SoftMax("soft1", 10 ,"(3,0,0)", "(pool1-east)", caption="SOFT"  ), #添加SoftMax
    to_connection("pool2", "soft1"),    #使用箭头连接指定的两层
    to_Sum("sum1", offset="(1.5,0,0)", to="(soft1-east)", radius=2.5, opacity=0.6), #添加一个 “+” 按钮sum1
    to_connection("soft1", "sum1"),
    to_end() #结束标志
    ]
    #to_skip 跳过指定的两层  连接
def main():
    namefile = str(sys.argv[0]).split('.')[0]
    to_generate(arch, namefile + '.tex' )

if __name__ == '__main__':
    main()


模型图片

如图所示,此模型的卷积层、池化层等都是由长方体组成的,我们将其定义为长宽高,长为depth,宽为width,高为hegiht,图中的64,512则是s_filer,n_filer

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值