这是GitHub项目地址
偷了几张项目中的展示图感受下,要是喜欢这个风格,就继续往下看:
该项目我只在Ubuntu18成功运行过,Windows试过没有成功。
进入pyexamples文件夹,这里存放了测试程序
然后运行测试程序
cd pyexamples/
bash ../tikzmake.sh test_simple
程序成功运行后,会自动弹出PDF展示,在pyexamples生产一个"test_simple.pdf"文件
mkdir my_project
cd my_project
vim my_arch.py
import sys
sys.path.append('../')
from pycore.tikzeng import *
# defined your arch
arch = [
to_head( '..' ),
to_cor(),
to_begin(),
# 这里才构建自己的网络结构
to_Conv("input", 48,1, offset="(0,0,0)", to="(0,0,0)", height=48, depth=48, width=1,caption="input"),
to_Conv("conv1", 48,64, offset="(3,0,0)", to="(input-east)", height=48, depth=48, width=3 ,caption="Conv"),
to_Conv("conv2", 48,64, offset="(0.5,0,0)", to="(conv1-east)", height=48, depth=48, width=3 ,caption="Conv"),
to_Pool("pool3", offset="(0.5,0,0)",height=24, depth=24, width=3 , to="(conv2-east)",caption="Pool"),
to_Conv("conv7", 12,256, offset="(2,0,0)", to="(pool3-east)", height=12, depth=12, width=12 ,caption="Conv"),
to_Conv("conv8", 12,256, offset="(0.5,0,0)", to="(conv7-east)", height=12, depth=12, width=12 ,caption="Conv"),
to_Pool("pool9", offset="(0.5,0,0)",height=6, depth=6, width=12 , to="(conv8-east)",caption="Pool"),
to_SoftMax("soft1", 7 ,"(2,0,0)", "(pool9-east)", caption="FC" ),
to_SoftMax("soft2", 7 ,"(2,0,0)", "(soft1-east)", caption="FC" ),
to_connection( "pool3", "conv7"),
to_connection( "pool9", "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()
to_Conv("conv1", 48,64, offset="(3,0,0)", to="(input-east)", height=48, depth=48, width=3 ,caption="Conv"),
to_Pool("pool3", offset="(0.5,0,0)",height=24, depth=24, width=3 , to="(conv2-east)",caption="Pool"),
to_connection( "pool3", "conv7"),
使用以下命令运行,成功后会产生pdf文件,并自动打开pdf展示;失败则会卡在命令行中,无反应;
bash ../tikzmake.sh my_arch
更多的层函数封装在pycore/tikzeng.py
文件中,examples
文件夹中也有网络样例,在github项目中也有更多的信息。