diff --git a/examples/AlexNet/alexnet.pdf b/examples/AlexNet/alexnet.pdf new file mode 100644 index 0000000..d214d75 Binary files /dev/null and b/examples/AlexNet/alexnet.pdf differ diff --git a/examples/AlexNet/alexnet.tex b/examples/AlexNet/alexnet.tex new file mode 100644 index 0000000..ebc1e68 --- /dev/null +++ b/examples/AlexNet/alexnet.tex @@ -0,0 +1,216 @@ +\documentclass[border=8pt, multi, tikz]{standalone} +\usepackage{import} +\subimport{../layers/}{init} +\usetikzlibrary{positioning} +\usetikzlibrary{3d} %for including external image + + +\def\ConvColor{rgb:yellow,5;red,2.5;white,5} +\def\ConvReluColor{rgb:yellow,5;red,5;white,5} +\def\PoolColor{rgb:red,1;black,0.3} +\def\UnpoolColor{rgb:blue,2;green,1;black,0.3} +\def\FcColor{rgb:blue,2;green,5;white,5} +\def\FcReluColor{blue,2;green,5;;white,4} +\def\SoftmaxColor{rgb:magenta,5;black,7} + + +\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);} + +\begin{document} +\begin{tikzpicture} +\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7] +\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7] + + +\pic[shift={(0,0,0)}] at (0,0,0) + {Box={ + name=conv0, + caption= , + xlabel={{3, }}, + zlabel=224, + fill=\ConvColor, + height=44.8, + width=3, + depth=44.8 + } + }; + + +\pic[shift={(1,0,0)}] at (conv0-east) + {Box={ + name=conv1, + caption= , + xlabel={{96, }}, + zlabel=55, + fill=\ConvColor, + height=11.0, + width=4.8, + depth=11.0 + } + }; + + +\draw [connection] (conv0-east) -- node {\midarrow} (conv1-west); + + +\pic[shift={ (0,0,0) }] at (conv1-east) + {Box={ + name=pool1, + caption= , + fill=\PoolColor, + opacity=0.5, + height=5.4, + width=1, + depth=5.4 + } + }; + + +\pic[shift={(1,0,0)}] at (pool1-east) + {Box={ + name=conv2, + caption= , + xlabel={{256, }}, + zlabel=27, + fill=\ConvColor, + height=5.4, + width=12.8, + depth=5.4 + } + }; + + +\draw [connection] (pool1-east) -- node {\midarrow} (conv2-west); + + +\pic[shift={ (0,0,0) }] at (conv2-east) + {Box={ + name=pool2, + caption= , + fill=\PoolColor, + opacity=0.5, + height=2.6, + width=1, + depth=2.6 + } + }; + + +\pic[shift={(1,0,0)}] at (pool2-east) + {Box={ + name=conv3, + caption= , + xlabel={{384, }}, + zlabel=13, + fill=\ConvColor, + height=2.6, + width=19.2, + depth=2.6 + } + }; + + +\draw [connection] (pool2-east) -- node {\midarrow} (conv3-west); + + +\pic[shift={(1,0,0)}] at (conv3-east) + {Box={ + name=conv4, + caption= , + xlabel={{384, }}, + zlabel=13, + fill=\ConvColor, + height=2.6, + width=19.2, + depth=2.6 + } + }; + + +\draw [connection] (conv3-east) -- node {\midarrow} (conv4-west); + + +\pic[shift={(1,0,0)}] at (conv4-east) + {Box={ + name=conv5, + caption= , + xlabel={{256, }}, + zlabel=13, + fill=\ConvColor, + height=2.6, + width=12.8, + depth=2.6 + } + }; + + +\draw [connection] (conv4-east) -- node {\midarrow} (conv5-west); + + +\pic[shift={ (0,0,0) }] at (conv5-east) + {Box={ + name=pool3, + caption= , + fill=\PoolColor, + opacity=0.5, + height=1.2, + width=1, + depth=1.2 + } + }; + + +\pic[shift={(1,0,0)}] at (pool3-east) + {Box={ + name=Fc1, + caption= , + xlabel={{1, }}, + zlabel=4096, + fill=\FcColor, + height=1, + width=1, + depth=40.96 + } + }; + + +\draw [connection] (pool3-east) -- node {\midarrow} (Fc1-west); + + +\pic[shift={(2,0,0)}] at (Fc1-east) + {Box={ + name=Fc2, + caption= , + xlabel={{1, }}, + zlabel=4096, + fill=\FcColor, + height=1, + width=1, + depth=40.96 + } + }; + + +\draw [connection] (Fc1-east) -- node {\midarrow} (Fc2-west); + + +\pic[shift={(3,0,0)}] at (Fc2-east) + {Box={ + name=soft1, + caption=SOFT, + xlabel={{" ","dummy"}}, + zlabel=1000, + fill=\SoftmaxColor, + opacity=0.8, + height=3, + width=1.5, + depth=25 + } + }; + + +\draw [connection] (Fc2-east) -- node {\midarrow} (soft1-west); + + +\end{tikzpicture} +\end{document} diff --git a/examples/AlexNet/alexnet_data.png b/examples/AlexNet/alexnet_data.png new file mode 100644 index 0000000..e0b7d97 Binary files /dev/null and b/examples/AlexNet/alexnet_data.png differ diff --git a/examples/LeNet/lenet.pdf b/examples/LeNet/lenet.pdf new file mode 100644 index 0000000..ed7f755 Binary files /dev/null and b/examples/LeNet/lenet.pdf differ diff --git a/examples/LeNet/lenet.tex b/examples/LeNet/lenet.tex new file mode 100644 index 0000000..411053d --- /dev/null +++ b/examples/LeNet/lenet.tex @@ -0,0 +1,152 @@ +\documentclass[border=8pt, multi, tikz]{standalone} +\usepackage{import} +\subimport{../layers/}{init} +\usetikzlibrary{positioning} +\usetikzlibrary{3d} %for including external image + + +\def\ConvColor{rgb:yellow,5;red,2.5;white,5} +\def\ConvReluColor{rgb:yellow,5;red,5;white,5} +\def\PoolColor{rgb:red,1;black,0.3} +\def\UnpoolColor{rgb:blue,2;green,1;black,0.3} +\def\FcColor{rgb:blue,5;red,2.5;white,5} +\def\FcReluColor{rgb:blue,5;red,5;white,4} +\def\SoftmaxColor{rgb:magenta,5;black,7} + + +\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);} + +\begin{document} +\begin{tikzpicture} +\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7] +\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7] + + +\pic[shift={(0,0,0)}] at (0,0,0) + {Box={ + name=conv0, + caption= , + xlabel={{1, }}, + zlabel=32, + fill=\ConvColor, + height=32, + width=1, + depth=32 + } + }; + + +\pic[shift={(1,0,0)}] at (conv0-east) + {Box={ + name=conv1, + caption= , + xlabel={{6, }}, + zlabel=28, + fill=\ConvColor, + height=28, + width=6, + depth=28 + } + }; + + +\draw [connection] (conv0-east) -- node {\midarrow} (conv1-west); + + +\pic[shift={ (0,0,0) }] at (conv1-east) + {Box={ + name=pool1, + caption= , + fill=\PoolColor, + opacity=0.5, + height=14, + width=6, + depth=14 + } + }; + + +\pic[shift={(1,0,0)}] at (pool1-east) + {Box={ + name=conv2, + caption= , + xlabel={{16, }}, + zlabel=10, + fill=\ConvColor, + height=10, + width=16, + depth=10 + } + }; + + +\draw [connection] (pool1-east) -- node {\midarrow} (conv2-west); + + +\pic[shift={ (0,0,0) }] at (conv2-east) + {Box={ + name=pool2, + caption= , + fill=\PoolColor, + opacity=0.5, + height=5, + width=16, + depth=5 + } + }; + + +\pic[shift={(1,0,0)}] at (pool2-east) + {Box={ + name=conv3, + caption= , + xlabel={{1, }}, + zlabel=120, + fill=\ConvColor, + height=1, + width=1, + depth=120 + } + }; + + +\draw [connection] (pool2-east) -- node {\midarrow} (conv3-west); + + +\pic[shift={(2,0,0)}] at (conv3-east) + {Box={ + name=conv4, + caption= , + xlabel={{1, }}, + zlabel=84, + fill=\ConvColor, + height=1, + width=1, + depth=84 + } + }; + + +\draw [connection] (conv3-east) -- node {\midarrow} (conv4-west); + + +\pic[shift={(3,0,0)}] at (conv4-east) + {Box={ + name=soft1, + caption=SOFT, + xlabel={{" ","dummy"}}, + zlabel=10, + fill=\SoftmaxColor, + opacity=0.8, + height=3, + width=1.5, + depth=25 + } + }; + + +\draw [connection] (conv4-east) -- node {\midarrow} (soft1-west); + + +\end{tikzpicture} +\end{document} diff --git a/examples/LeNet/lenet.txt b/examples/LeNet/lenet.txt new file mode 100644 index 0000000..8f063fa --- /dev/null +++ b/examples/LeNet/lenet.txt @@ -0,0 +1,8 @@ +input(32, 32, 1) +conv(28, 28, 6) +pool(14, 14, 6) +conv(10, 10, 16) +pool(5, 5, 16) +conv(1,1,120) +fullyconn(1,1,84) +softmax(1,1,10) \ No newline at end of file diff --git a/examples/LeNet/lenet_data2.png b/examples/LeNet/lenet_data2.png new file mode 100644 index 0000000..01ccfb2 Binary files /dev/null and b/examples/LeNet/lenet_data2.png differ