40 Commits

Author SHA1 Message Date
schihei 8681618345 Added LeNet5 example 2020-06-10 11:59:50 +02:00
schihei 7b457f21b5 Adoption to macOS environment 2020-06-10 11:59:03 +02:00
Haris Iqbal eff3a197d1 Merge pull request #72 from jackyko1991/master
add windows install instruction
2020-04-22 19:19:10 +02:00
Haris Iqbal 361d5596c1 Update README.md 2020-04-22 19:18:15 +02:00
Ka Long Ko bbaf4900aa add windows install instruction 2020-02-24 10:49:47 +08:00
Haris Iqbal 62aebe7116 fix minor bugs 2020-01-17 16:31:36 +01:00
Haris Iqbal 5aba09f025 Merge pull request #40 from mbrukman/fix-readme
Fix spelling and formatting in README [skip ci]
2019-07-30 11:20:25 +02:00
Haris Iqbal 40801a8148 Merge pull request #41 from StevenShi-23/master
fix xdg-open not found error on MacOS
2019-07-30 11:19:11 +02:00
Haris Iqbal cea5a7010b Merge pull request #44 from Brandon-HY-Lin/master
doc: add instructions of getting started in README.md
2019-07-30 11:18:07 +02:00
Haris Iqbal 7a37c72315 Merge pull request #45 from Lotayou/master
Fixing os.path.join '\' issue for Windows compatibility
2019-07-30 11:17:32 +02:00
Eric Yang c03e6565a3 Fixing os.path.join '\' issue for Windows compatibility 2019-04-14 17:08:03 +08:00
Brandon Lin a8617c7367 doc: add instructions of getting started in README.md
* Add instructions for installing pdflatex package.
* Add commands for executing example.
2019-04-13 22:33:17 +08:00
Ziji Shi (Steven) fb2b1376b1 fix xdg-open not found error on MacOS 2019-04-01 12:33:33 +08:00
Misha Brukman 431321dc43 Fix spelling and formatting in README [skip ci]
* Add link to `examples` directory
* Convert text to complete sentences for readability
* Separate bash and Python code for better understanding
* Add Python syntax highlighting
* Add explicit instructions to help users get started easier
2019-03-28 16:43:11 -04:00
Haris Iqbal ccb9a4791a Merge pull request #23 from lukasliebel/patch-1
Added option to name input image node
2019-03-20 14:29:28 +01:00
Haris Iqbal 894567fae4 Merge pull request #29 from weiji14/master
Quickfix to remove pos hardcoding in to_skip function
2019-03-20 14:26:18 +01:00
Wei Ji fa2ba3d6ff Quickfix to remove pos hardcoding in to_skip func 2019-03-14 21:26:49 +01:00
Haris Iqbal 597e4af7f5 Update README.md 2019-03-11 10:15:52 +01:00
Lukas Liebel c33f57f9df Added option to name input image node
Adding a `name` parameter to `to_input` allows referencing the input image, e.g., for drawing connectors or relative positioning. I dislike `temp` as the default name but didn't change it in order to preserve backward compatibility.
2019-02-28 13:24:52 +01:00
Haris Iqbal 040af954b2 Update README.md 2019-02-21 11:34:10 +01:00
Haris Iqbal b052d8a4df evince to xdg-open,name of core to pycore and test to pyexamples 2019-02-21 11:31:54 +01:00
Haris Iqbal 6177655106 Update README.md 2019-02-21 08:49:57 +01:00
Haris Iqbal 80b72db87a Merge pull request #11 from pedrodiamel/master
python interface
2019-02-11 10:05:57 +01:00
pedro 4bcd91db5e Merge branch 'master' of https://github.com/pedrodiamel/PlotNeuralNet 2019-02-01 14:51:15 -03:00
pedro 9e0c6774a0 add res block 2019-02-01 14:50:48 -03:00
pedro b3c7cbd03f add add input python layer 2019-01-31 20:33:30 -03:00
Pedro Diamel Marrero Fernández e8b3dcb3d7 Update README.md 2019-01-31 18:50:32 -03:00
pedro cf7f9298aa update 2019-01-31 18:46:28 -03:00
pedro 3ec6f4c617 python interface 2019-01-31 18:11:55 -03:00
Haris Iqbal 595cd2b4fe Update README.md 2018-12-25 22:20:28 +01:00
Haris Iqbal 889999af27 Update README.md 2018-12-25 22:10:33 +01:00
Haris Iqbal 81757e5999 [Unimportant]fixed unet_ushape folder name 2018-12-24 17:23:11 +01:00
Haris Iqbal 2eddc268e2 added Unet in Ushape example 2018-12-24 17:20:36 +01:00
Haris Iqbal 2c1a03f58b added Unet example 2018-12-24 16:02:07 +01:00
Haris Iqbal 4866879ee9 Merge branch 'master' of https://github.com/HarisIqbal88/PlotNeuralNet 2018-12-20 21:28:54 +01:00
Haris Iqbal 079aadd2fd Fixed labelling z-axis 2018-12-20 21:27:29 +01:00
HarisIqbal88 5741cb56c7 Update README.md
changed the images to the ones formed by new code
2018-12-20 21:21:32 +01:00
Haris Iqbal d0ec7cf242 Included example in fcn8s to add external image in the diagram 2018-12-20 21:13:27 +01:00
Haris Iqbal 07d256361b Merge branch 'master' of https://github.com/HarisIqbal88/PlotNeuralNet 2018-12-20 20:33:36 +01:00
Haris Iqbal f0e1e511f3 Moved from specific definitions(Conv,ConvRelu) to Generic(Box,BandedBox). Also refactored and cleaned the code 2018-12-20 20:28:44 +01:00
58 changed files with 1577 additions and 1784 deletions
+82
View File
@@ -1,3 +1,85 @@
*.aux *.aux
*.log *.log
*.gz *.gz
__pycache__
books
project
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
+90 -4
View File
@@ -1,15 +1,101 @@
# PlotNeuralNet # PlotNeuralNet
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2526396.svg)](https://doi.org/10.5281/zenodo.2526396)
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. 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: Following are some network representations:
<p align="center"><img src="https://user-images.githubusercontent.com/17570785/47255280-adabab00-d46e-11e8-9978-510a3505f065.png" width="85%" height="85%"></p> <p align="center"><img src="https://user-images.githubusercontent.com/17570785/50308846-c2231880-049c-11e9-8763-3daa1024de78.png" width="85%" height="85%"></p>
<h6 align="center">FCN-8</h6> <h6 align="center">FCN-8</h6>
<p align="center"><img src="https://user-images.githubusercontent.com/17570785/47255283-c6b45c00-d46e-11e8-8d9d-c4474796c947.png" width="85%" height="85%"></p> <p align="center"><img src="https://user-images.githubusercontent.com/17570785/50308873-e2eb6e00-049c-11e9-9587-9da6bdec011b.png" width="85%" height="85%"></p>
<h6 align="center">FCN with Domain Transform</h6> <h6 align="center">FCN-32</h6>
<p align="center"><img src="https://user-images.githubusercontent.com/17570785/47255288-e3509400-d46e-11e8-938d-6b6152dd28ca.png" width="85%" height="85%"></p> <p align="center"><img src="https://user-images.githubusercontent.com/17570785/50308911-03b3c380-049d-11e9-92d9-ce15669017ad.png" width="85%" height="85%"></p>
<h6 align="center">Holistically-Nested Edge Detection</h6> <h6 align="center">Holistically-Nested Edge Detection</h6>
## 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](https://gist.github.com/rain1024/98dd5e2c6c8c28f9ea9d), 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/)
2. Execute the example as followed.
```
cd pyexamples/
bash ../tikzmake.sh test_simple
```
## TODO
- [X] Python interface
- [ ] Add easy legend functionality
- [ ] Add more layer shapes like TruncatedPyramid, 2DSheet etc
- [ ] Add examples for RNN and likes.
## Latex usage
See [`examples`](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:
```python
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
Binary file not shown.
-127
View File
@@ -1,127 +0,0 @@
\documentclass[border=15pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import}
\subimport{../../layers/}{init}
\usetikzlibrary{positioning}
\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]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Encoder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1
\pic[shift={(0,0,0)}] at (0,0,0) {ConvReluPool={blockname=crp1,%
numFilters={{"64","64","32"}},height=40,width={2,2},depth=40,zlabel=I}};
% conv2_1,conv2_2,pool2
\pic[shift={(1.6,0,0)}] at (crp1-east) {ConvReluPool={blockname=crp2,%
numFilters={{"128","128"}},height=35,width={2.5,2.5},depth=35,zlabel=I/2}};
%% conv3_1,conv3_2,conv3_3,pool3
\pic[shift={(1.2,0,0)}] at (crp2-east) {ConvReluPool={blockname=crp3,%
numFilters={{"256","256","256"}},height=30,width={3.3,3.3,3.3},depth=30,zlabel=I/4}};
%% conv4_1,conv4_2,conv4_3,pool4
\pic[shift={(1,0,0)}] at (crp3-east) {ConvReluPool={blockname=crp4,%
numFilters={{"512","512","512"}},height=23,width={4.5,4.5,4.5},depth=23,zlabel=I/8}};
%% conv5_1,conv5_2,conv5_3
\pic[shift={(1,0,0)}] at (crp4-east) {ConvReluPool={blockname=crp5,%
numFilters={{"512","512","512"}},height=12,width={4.5,4.5,4.5},depth=12,zlabel=I/16}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Bottleneck
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% conv5_1,conv5_2,conv5_3
\pic[shift={(1,0,0)}] at (crp5-east) {ConvRelu={blockname=cp,%
numFilters={{"4096","4096"}},height=5,width={7,7},depth=5,zlabel=I/8}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Dencoder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% conv5_1r,conv5_2r,conv5_3r
\pic[shift={(2,0,0)}] at (cp-east) {UpConvRelu={blockname=ucp5r,%
numFilters={{"512","512","512"}},height=12,width={4.5,4.5,4.5},depth=12,zlabel=I/16,%
fillcolor = {rgb:blue,5;green,2.5;white,5},upcolor={rgb:blue,15}}};
%% up32
\pic[shift={(1.5,0,0)}] at (ucp5r-east) {UpConvRelu={blockname=ucp4r,%
numFilters={{"512","512","512"}},height=23,width={4.5,4.5,4.5},depth=23,zlabel=,%
fillcolor = {rgb:blue,5;green,2.5;white,5},upcolor={rgb:blue,15}}};
%% up16
\pic[shift={(2,0,0)}] at (ucp4r-east) {UpConvRelu={blockname=ucp3r,%
numFilters={{"256","256","256"}},height=30,width={3.3,3.3,3.3},depth=30,zlabel=,%
fillcolor = {rgb:blue,5;green,2.5;white,5},upcolor={rgb:blue,15}}};
%% up8
\pic[shift={(2,0,0)}] at (ucp3r-east) {UpConvRelu={blockname=ucp2r,%
numFilters={{"128","128"}},height=35,width={2.5,2.5},depth=35,zlabel=,%
fillcolor = {rgb:blue,5;green,2.5;white,5},upcolor={rgb:blue,15}}};
%% up4
\pic[shift={(2,0,0)}] at (ucp2r-east) {UpConvRelu={blockname=ucp1r,%
numFilters={{"64","64"}},height=40,width={2,2},depth=40,zlabel=,%
fillcolor = {rgb:blue,5;green,2.5;white,5},upcolor={rgb:blue,15}}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Draw score producer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% score
%\pic[shift={(2,0,0)}] at (ucp1r-east) {Conv={blockname=score,%
% numFilters={{"21",""}},height=40,width={2},depth=40,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east) -- node {\midarrow} (crp2-west);
\draw [connection] (crp2-east) -- node {\midarrow} (crp3-west);
\draw [connection] (crp3-east) -- node {\midarrow} (crp4-west);
\draw [connection] (crp4-east) -- node {\midarrow} (cp-west);
\draw [connection] (cp-east) -- node {\midarrow} (ucp5r-west);
\draw [connection] (ucp5r-east) -- node {\midarrow} (ucp4r-west);
\draw [connection] (ucp4r-east) -- node {\midarrow} (ucp3r-west);
\draw [connection] (ucp3r-east) -- node {\midarrow} (ucp2r-west);
\draw [connection] (ucp2r-east) -- node {\midarrow} (ucp1r-west);
%\draw [connection] (ucp1r-east) -- node {\midarrow} (score-west);
\path (crp5-south-|crp5-east) -- (crp5-north-|crp5-east) coordinate[pos=1.25] (crp5-top) ;
\path (crp4-south-|crp4-east) -- (crp4-north-|crp4-east) coordinate[pos=1.15] (crp4-top) ;
\path (crp3-south-|crp3-east) -- (crp3-north-|crp3-east) coordinate[pos=1.15] (crp3-top) ;
\path (crp2-south-|crp2-east) -- (crp2-north-|crp2-east) coordinate[pos=1.15] (crp2-top) ;
\path (crp1-south-|crp1-east) -- (crp1-north-|crp1-east) coordinate[pos=1.15] (crp1-top) ;
\path (ucp5r-upsouth) -- (ucp5r-upnorth) coordinate[pos=1.25] (ucp5r-top) ;
\path (ucp4r-upsouth) -- (ucp4r-upnorth) coordinate[pos=1.15] (ucp4r-top) ;
\path (ucp3r-upsouth) -- (ucp3r-upnorth) coordinate[pos=1.15] (ucp3r-top) ;
\path (ucp2r-upsouth) -- (ucp2r-upnorth) coordinate[pos=1.15] (ucp2r-top) ;
\path (ucp1r-upsouth) -- (ucp1r-upnorth) coordinate[pos=1.15] (ucp1r-top) ;
\draw [copyconnection] (crp5-lastnorth-|crp5-east)
-- node {\copymidarrow}(crp5-top)
-- node {\copymidarrow}(ucp5r-top)
-- node {\copymidarrow} (ucp5r-upnorth);
\draw [copyconnection] (crp4-lastnorth-|crp4-east)
-- node {\copymidarrow}(crp4-top)
-- node {\copymidarrow}(ucp4r-top)
-- node {\copymidarrow} (ucp4r-upnorth);
\draw [copyconnection] (crp3-lastnorth-|crp3-east)
-- node {\copymidarrow}(crp3-top)
-- node {\copymidarrow}(ucp3r-top)
-- node {\copymidarrow} (ucp3r-upnorth);
\draw [copyconnection] (crp2-lastnorth-|crp2-east)
-- node {\copymidarrow}(crp2-top)
-- node {\copymidarrow}(ucp2r-top)
-- node {\copymidarrow} (ucp2r-upnorth);
\draw [copyconnection] (crp1-lastnorth-|crp1-east)
-- node {\copymidarrow}(crp1-top)
-- node {\copymidarrow}(ucp1r-top)
-- node {\copymidarrow} (ucp1r-upnorth);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}
\end{document}\grid
@@ -1,47 +0,0 @@
\documentclass[border=15pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import}
\subimport{../../layers/}{init}
\usetikzlibrary{positioning}
%\newcommand{\midarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw=\edgecolor] (-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]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Layer Blocks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1
\pic[shift={(0,0,0)}] at (0,0,0) {ConvReluPool={blockname=crp1,%
numFilters={{"64","64","32"}},height=40,width={2,2},depth=40,zlabel=I}};
% conv2_1,conv2_2,pool2
\pic[shift={(2.1,0,0)}] at (crp1-east) {ConvReluPool={blockname=crp2,%
numFilters={{"128","128"}},height=35,width={3,3},depth=35,zlabel=I/2}};
%% conv3_1,conv3_2,conv3_3,pool3
\pic[shift={(2,0,0)}] at (crp2-east) {ConvReluPool={blockname=crp3,%
numFilters={{"256","256","256"}},height=30,width={4,4,4},depth=30,zlabel=I/4}};
%% conv4_1,conv4_2,conv4_3,pool4
\pic[shift={(1.8,0,0)}] at (crp3-east) {ConvReluPool={blockname=crp4,%
numFilters={{"512","512","512"}},height=23,width={7,7,7},depth=23,zlabel=I/8}};
%% conv5_1,conv5_2,conv5_3,pool5
\pic[shift={(1.5,0,0)}] at (crp4-east) {ConvReluPool={blockname=crp5,%
numFilters={{"512","512","512"}},height=15,width={7,7,7},depth=15,zlabel=I/16}};
%% fc6, fc7
\pic[shift={(1.2,0,0)}] at (crp5-east) {ConvRelu={blockname=cp6_7,%
numFilters={{"4096","4096"}},height=10,width={10,10},depth=10,zlabel=I/32}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east) -- node {\midarrow} (crp2-west);
\draw [connection] (crp2-east) -- node {\midarrow} (crp3-west);
\draw [connection] (crp3-east) -- node {\midarrow} (crp4-west);
\draw [connection] (crp4-east) -- node {\midarrow} (crp5-west);
\draw [connection] (crp5-east) -- node {\midarrow} (cp6_7-west);
\draw [connection] (cp6_7-east) -- node {\midarrow} ++(1.5,0,0);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}
\end{document}\grid
Binary file not shown.
+102 -75
View File
@@ -1,106 +1,133 @@
\documentclass[border=15pt, multi, tikz]{standalone} \documentclass[border=15pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import} \usepackage{import}
\subimport{../../layers/}{init} \subimport{../../layers/}{init}
\usetikzlibrary{positioning} \usetikzlibrary{positioning}
\newcommand{\midarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw=\edgecolor] (-0.3,0) -- ++(0.3,0);} \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\DcnvColor{rgb:blue,5;green,2.5;white,5}
\def\SoftmaxColor{rgb:magenta,5;black,7}
\def\SumColor{rgb:blue,5;green,15}
\def\poolsep{1}
\begin{document} \begin{document}
\begin{tikzpicture} \begin{tikzpicture}
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7] \tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.6]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Layer Blocks %% Draw Layer Blocks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1 % conv1_1,conv1_2,%pool1
\pic[shift={(0,0,0)}] at (0,0,0) {ConvReluPool={blockname=crp1,% \pic[shift={(0,0,0)}] at (0,0,0) {RightBandedBox={name=cr1,%
numFilters={{"64","64","32"}},height=40,width={2,2},depth=40,zlabel=I}}; xlabel={{"64","64"}},zlabel=I,fill=\ConvColor,bandfill=\ConvReluColor,%
height=40,width={2,2},depth=40}};
\pic[shift={(\poolsep,0,0)}] at (cr1-east) {Box={name=p1,%
fill=\PoolColor,opacity=0.5,height=30,width=1,depth=30}};
% conv2_1,conv2_2,pool2 % conv2_1,conv2_2,pool2
\pic[shift={(2.1,0,0)}] at (crp1-east) {ConvReluPool={blockname=crp2,% \pic[shift={(1,0,0)}] at (p1-east) {RightBandedBox={name=cr2,%
numFilters={{"128","128"}},height=35,width={3,3},depth=35,zlabel=I/2}}; xlabel={{"64","64"}},zlabel=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
%% conv3_1,conv3_2,conv3_3,pool3 height=30,width={3,3},depth=30}};
\pic[shift={(2,0,0)}] at (crp2-east) {ConvReluPool={blockname=crp3,% \pic[shift={(\poolsep,0,0)}] at (cr2-east) {Box={name=p2,%
numFilters={{"256","256","256"}},height=30,width={4,4,4},depth=30,zlabel=I/4}}; fill=\PoolColor,opacity=0.5,height=23,width=1,depth=23}};
%% conv4_1,conv4_2,conv4_3,pool4 % conv3_1,conv3_2,pool3
\pic[shift={(1.8,0,0)}] at (crp3-east) {ConvReluPool={blockname=crp4,% \pic[shift={(1,0,0)}] at (p2-east) {RightBandedBox={name=cr3,%
numFilters={{"512","512","512"}},height=23,width={7,7,7},depth=23,zlabel=I/8}}; xlabel={{"256","256","256"}},zlabel=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
%% conv5_1,conv5_2,conv5_3,pool5 height=23,width={4,4,4},depth=23}};
\pic[shift={(1.5,0,0)}] at (crp4-east) {ConvRelu={blockname=crp5,% \pic[shift={(\poolsep,0,0)}] at (cr3-east) {Box={name=p3,%
numFilters={{"512","512","512"}},height=15,width={7,7,7},depth=15,zlabel=I/16}}; fill=\PoolColor,opacity=0.5,height=14,width=1,depth=14}};
%% score32 % conv4_1,conv4_2,conv4_3,pool4
\pic[shift={(1,0,0)}] at (crp5-east) {Conv={blockname=score32,% \pic[shift={(1,0,0)}] at (p3-east) {RightBandedBox={name=cr4,%
numFilters={{"21","4096"}},height=15,width=1,depth=15,zlabel=I/16}}; xlabel={{"512","512","512"}},zlabel=I/8,fill=\ConvColor,bandfill=\ConvReluColor,%
height=14,width={7,7,7},depth=14}};
\pic[shift={(\poolsep,0,0)}] at (cr4-east) {Box={name=p4,%
fill=\PoolColor,opacity=0.5,height=8,width=1,depth=8}};
% conv5_1,conv5_2,conv5_3,pool5
\pic[shift={(1,0,0)}] at (p4-east) {RightBandedBox={name=cr5,%
xlabel={{"512","512","512"}},fill=\ConvColor,bandfill=\ConvReluColor,%
height=8,width={7,7,7},depth=8}};
%% fc8 -> cr8 (score32)
\pic[shift={(0,0,0)}] at (cr5-east) {Box={name=score16,%
xlabel={{"K","dummy"}},fill=\ConvColor,%
height=8,width=2,depth=8,zlabel=I/16}};
%% Upsampling Deconv Layer %% Upsampling Deconv Layer
\pic[shift={(2,0,0)}] at (score32-east) {Deconv={blockname=up32,% %% Dcnv16
numFilters={{"1","4096"}},height=33,width=1,depth=33,zlabel=}}; \pic[shift={(2.5,0,0)}] at (score16-east) {Box={name=d16,%
xlabel={{"","dummy"}},fill=\DcnvColor,opacity=0.7,height=40,width=0.5,depth=40}};
%% Dcnv8
\pic[shift={(.25,0,0)}] at (d16-east) {Box={name=d8,%
xlabel={{"","dummy"}},fill=\DcnvColor,opacity=0.7,height=40,width=0.5,depth=40}};
%% Dcnv4
\pic[shift={(.25,0,0)}] at (d8-east) {Box={name=d4,%
xlabel={{"","dummy"}},fill=\DcnvColor,opacity=0.7,height=40,width=0.5,depth=40}};
%% Dcnv2
\pic[shift={(.25,0,0)}] at (d4-east) {Box={name=d2,%
xlabel={{"","dummy"}},fill=,opacity=0.01,height=40,width=0.5,depth=40}};
%% Dcnv envelope
\pic[shift={(-0.2,0,0)}] at (d16-west) {Box={name=env,caption=concatenation of deconvolved feature maps,%
xlabel={{"","dummy"}},fill=,opacity=0.2,height=42,width={8},depth=42}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\skipshift{6.5}
%%Joining with previous streams (fcn-16) %%Joining with previous streams (fcn-16)
%% score16 %% score16
\pic[shift={(0,0,10)}] at (crp5-anchor) {Conv={blockname=score16,% \pic[shift={(0,0,3+\skipshift)}] at (cr5-anchor) {Box={name=score8,%
numFilters={{"1","4096"}},height=20,width=1,depth=20,zlabel=I/8}}; xlabel={{"K","dummy"}},fill=\ConvColor,height=14,width=2,depth=14,zlabel=I/8}};
%% Upsampling Deconv Layer
\pic[shift={(0.5,0,0)}] at (up32-west) {Deconv={blockname=up16,%
numFilters={{"1","4096"}},height=33,width=1,depth=33,zlabel=}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Joining with previous streams (fcn-8) %%Joining with previous streams (fcn-8)
%% score8 %% score8
\pic[shift={(1,0,14)}] at (crp4-anchor) {Conv={blockname=score8,% \pic[shift={(0,0,8+\skipshift)}] at (cr4-east) {Box={name=score4,%
numFilters={{"1","4096"}},height=25,width=1,depth=25,zlabel=I/4}}; xlabel={{"K","dummy"}},fill=\ConvColor,height=23,width=2,depth=23,zlabel=I/4}};
%% Upsampling Deconv Layer
\pic[shift={(0.5,0,0)}] at (up16-west) {Deconv={blockname=up8,%
numFilters={{"1","4096"}},height=33,width=1,depth=33,zlabel=}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Joining with previous streams (fcn-4) %%Joining with previous streams (fcn-4)
%% score8 %% score4
\pic[shift={(0,0,18)}] at (crp3-east) {Conv={blockname=score4,% \pic[shift={(1,0,13+\skipshift)}] at (cr3-east) {Box={name=score2,%
numFilters={{"1","4096"}},height=30,width=1,depth=30,zlabel=I/2}}; xlabel={{"K","dummy"}},fill=\ConvColor,height=30,width=2,depth=30,zlabel=I/2}};
%% Upsampling Deconv Layer
\pic[shift={(0.5,0,0)}] at (up8-west) {Deconv={blockname=up4,%
numFilters={{"1","4096"}},height=33,width=1,depth=33,zlabel=}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Joining with previous streams (fcn-2) %%Joining with previous streams (fcn-2)
%% score8 %% score2
\pic[shift={(0,0,22)}] at (crp2-east) {Conv={blockname=score2,% \pic[shift={(0.3,0,22+\skipshift)}] at (p2-east) {Box={name=score,%
numFilters={{"1","4096"}},height=33,width=1,depth=33,zlabel=I}}; xlabel={{"K","dummy"}},fill=\ConvColor,height=40,width=2,depth=40,zlabel=I}};
%% Upsampling Deconv Layer
\pic[shift={(0.5,0,0)}] at (up4-west) {Deconv={blockname=up2,%
numFilters={{"1","4096"}},height=33,width=1,depth=33,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Final convolution % Final convolution
\pic[shift={(3,0,0)}] at (up2-east) {Conv={blockname=output,%
numFilters={{"1","4096"}},height=33,width=1,depth=33,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east) -- node {\midarrow} (crp2-west);
\draw [connection] (crp2-east) -- node {\midarrow} (crp3-west);
\draw [connection] (crp3-east) -- node {\midarrow} (crp4-west);
\draw [connection] (crp4-east) -- node {\midarrow} (crp5-west);
\draw [connection] (crp5-east) -- node {\midarrow} (score32-west);
\draw [connection] (score32-east) -- node {\midarrow} (up32-west);
\path (crp4-east) -- (crp5-west) coordinate[pos=0.4] (between4_5) ; \pic[shift={(3,0,0)}] at (d2-east) {Box={name=output,%
\draw [connection] (between4_5) -- node {\midarrow} ++(0,0,10) -- node {\midarrow} (score16-west); xlabel={{"K","dummy"}},fill=\ConvColor,height=40,width=2,depth=40,zlabel=I}};
\draw [connection] (score16-east) -- node{\midarrow}++(6,0,0)-- node{\midarrow}(up16-out); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Draw connections
\path (crp3-east) -- (crp4-west) coordinate[pos=0.4] (between3_4) ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (between3_4) -- node {\midarrow} ++(0,0,14) -- node {\midarrow} (score8-west); \draw [connection] (cr1-east) -- node {\midarrow} (p1-west);
\draw [connection] (score8-east) -- node{\midarrow}++(11.55,0,0)-- node{\midarrow}(up8-out); \draw [connection] (p1-east) -- node {\midarrow} (cr2-west);
\draw [connection] (cr2-east) -- node {\midarrow} (p2-west);
\path (crp2-east) -- (crp3-west) coordinate[pos=0.4] (between2_3) ; \draw [connection] (p2-east) -- node {\midarrow} (cr3-west);
\draw [connection] (between2_3) -- node {\midarrow} ++(0,0,18) -- node {\midarrow} (score4-west); \draw [connection] (cr3-east) -- node {\midarrow} (p3-west);
\draw [connection] (score4-east) -- node{\midarrow}++(17.3,0,0)-- node{\midarrow}(up4-out); \draw [connection] (p3-east) -- node {\midarrow} (cr4-west);
\draw [connection] (cr4-east) -- node {\midarrow} (p4-west);
\path (crp1-east) -- (crp2-west) coordinate[pos=0.4] (between1_2) ; \draw [connection] (p4-east) -- node {\midarrow} (cr5-west);
\draw [connection] (between1_2) -- node {\midarrow} ++(0,0,22) -- node {\midarrow} (score2-west); \draw [connection] (score16-east) -- node {\midarrow} (d16-west);
\draw [connection] (score2-east) -- node{\midarrow}++(22.7,0,0)-- node{\midarrow}(up2-out); %
\path (cr4-east) -- (p4-west) coordinate[pos=0.4] (after4) ;
\draw [connection] (up2-east) -- node {\midarrow} (output-west); \draw (d16-near)++(0,0,-1+\skipshift) coordinate (d16h);
\draw [connection] (after4) -- node {\midarrow} ++(0,0,3+\skipshift) -- node {\midarrow} (score8-west);
\draw [connection] (output-east) -- node {\midarrow} ++(,0,0); \draw [connection] (score8-east) -- node{\midarrow} (d16h) -- node{\midarrow}(d16-near);
%
\path (cr3-east) -- (p3-west) coordinate[pos=0.4] (after3) ;
\draw (d8-near)++(0,0,4+\skipshift) coordinate (d8h);
\draw [connection] (after3) -- node {\midarrow} ++(0,0,8+\skipshift) -- node {\midarrow} (score4-west);
\draw [connection] (score4-east) -- node{\midarrow} (d8h) -- node{\midarrow}(d8-near);
%
\path (cr2-east) -- (p2-west) coordinate[pos=0.4] (after2) ;
\draw (d4-near)++(0,0,9+\skipshift) coordinate (d4h);
\draw [connection] (after2) -- node {\midarrow} ++(0,0,13+\skipshift) -- node {\midarrow} (score2-west);
\draw [connection] (score2-east) -- node{\midarrow} (d4h) -- node{\midarrow}(d4-near);
%
\path (cr1-east) -- (p1-west) coordinate[pos=0.4] (after1) ;
\draw (d2-near)++(0,0,18+\skipshift) coordinate (d2h);
\draw [connection] (after1) -- node {\midarrow} ++(0,0,22+\skipshift) -- node {\midarrow} (score-west);
\draw [connection] (score-east) -- node{\midarrow} (d2h) -- node{\midarrow}(d2-near);
\draw [connection] (d2-east) -- node {\midarrow} (output-west);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture} \end{tikzpicture}
Binary file not shown.
-116
View File
@@ -1,116 +0,0 @@
\documentclass[border=15pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import}
\subimport{../../layers/}{init}
\usetikzlibrary{positioning}
\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]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Encoder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1
\pic[shift={(0,0,0)}] at (0,0,0) {ConvReluPool={blockname=crp1,%
numFilters={{"64","64","32"}},height=40,width={2,2},depth=40,zlabel=I}};
% conv2_1,conv2_2,pool2
\pic[shift={(1.6,0,0)}] at (crp1-east) {ConvReluPool={blockname=crp2,%
numFilters={{"128","128"}},height=35,width={2.5,2.5},depth=35,zlabel=I/2}};
%% conv3_1,conv3_2,conv3_3,pool3
\pic[shift={(1.2,0,0)}] at (crp2-east) {ConvReluPool={blockname=crp3,%
numFilters={{"256","256","256"}},height=30,width={3.3,3.3,3.3},depth=30,zlabel=I/4}};
%% conv4_1,conv4_2,conv4_3,pool4
\pic[shift={(1,0,0)}] at (crp3-east) {ConvReluPool={blockname=crp4,%
numFilters={{"512","512","512"}},height=23,width={4.5,4.5,4.5},depth=23,zlabel=I/8}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Bottleneck
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% conv5_1,conv5_2,conv5_3
\pic[shift={(1,0,0)}] at (crp4-east) {ConvRelu={blockname=cp5,%
numFilters={{"512","512","512"}},height=12,width={4.5,4.5,4.5},depth=12,zlabel=I/16}};
%% conv5_1r,conv5_2r,conv5_3r
\pic[shift={(2,0,0)}] at (cp5-east) {ConvRelu={blockname=cp5r,%
numFilters={{"512","512","512"}},height=12,width={4.5,4.5,4.5},depth=12,zlabel=I/16}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Dencoder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% up32
\pic[shift={(1.5,0,0)}] at (cp5r-east) {UpConvRelu={blockname=ucp4r,%
numFilters={{"512","512","512"}},height=23,width={4.5,4.5,4.5},depth=23,zlabel=}};
%% up16
\pic[shift={(2,0,0)}] at (ucp4r-east) {UpConvRelu={blockname=ucp3r,%
numFilters={{"256","256","256"}},height=30,width={3.3,3.3,3.3},depth=30,zlabel=}};
%% up8
\pic[shift={(2,0,0)}] at (ucp3r-east) {UpConvRelu={blockname=ucp2r,%
numFilters={{"128","128"}},height=35,width={2.5,2.5},depth=35,zlabel=}};
%% up4
\pic[shift={(2,0,0)}] at (ucp2r-east) {UpConvRelu={blockname=ucp1r,%
numFilters={{"64","64"}},height=40,width={2,2},depth=40,zlabel=}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Draw score producer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% score
%\pic[shift={(2,0,0)}] at (ucp1r-east) {Conv={blockname=score,%
% numFilters={{"21",""}},height=40,width={2},depth=40,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east) -- node {\midarrow} (crp2-west);
\draw [connection] (crp2-east) -- node {\midarrow} (crp3-west);
\draw [connection] (crp3-east) -- node {\midarrow} (crp4-west);
\draw [connection] (crp4-east) -- node {\midarrow} (cp5-west);
\draw [connection] (cp5-east) -- node {\midarrow} (cp5r-west);
\draw [connection] (cp5r-east) -- node {\midarrow} (ucp4r-west);
\draw [connection] (ucp4r-east) -- node {\midarrow} (ucp3r-west);
\draw [connection] (ucp3r-east) -- node {\midarrow} (ucp2r-west);
\draw [connection] (ucp2r-east) -- node {\midarrow} (ucp1r-west);
%\draw [connection] (ucp1r-east) -- node {\midarrow} (score-west);
\path (crp4-south-|crp4-east) -- (crp4-north-|crp4-east) coordinate[pos=1.15] (crp4-top) ;
\path (crp3-south-|crp3-east) -- (crp3-north-|crp3-east) coordinate[pos=1.15] (crp3-top) ;
\path (crp2-south-|crp2-east) -- (crp2-north-|crp2-east) coordinate[pos=1.15] (crp2-top) ;
\path (crp1-south-|crp1-east) -- (crp1-north-|crp1-east) coordinate[pos=1.15] (crp1-top) ;
\path (ucp4r-upsouth) -- (ucp4r-upnorth) coordinate[pos=1.15] (ucp4r-top) ;
\path (ucp3r-upsouth) -- (ucp3r-upnorth) coordinate[pos=1.15] (ucp3r-top) ;
\path (ucp2r-upsouth) -- (ucp2r-upnorth) coordinate[pos=1.15] (ucp2r-top) ;
\path (ucp1r-upsouth) -- (ucp1r-upnorth) coordinate[pos=1.15] (ucp1r-top) ;
\draw [copyconnection] (crp4-lastnorth-|crp4-east)
-- node {\copymidarrow}(crp4-top)
-- node {\copymidarrow}(ucp4r-top)
-- node {\copymidarrow} (ucp4r-upnorth);
\draw [copyconnection] (crp3-lastnorth-|crp3-east)
-- node {\copymidarrow}(crp3-top)
-- node {\copymidarrow}(ucp3r-top)
-- node {\copymidarrow} (ucp3r-upnorth);
\draw [copyconnection] (crp2-lastnorth-|crp2-east)
-- node {\copymidarrow}(crp2-top)
-- node {\copymidarrow}(ucp2r-top)
-- node {\copymidarrow} (ucp2r-upnorth);
\draw [copyconnection] (crp1-lastnorth-|crp1-east)
-- node {\copymidarrow}(crp1-top)
-- node {\copymidarrow}(ucp1r-top)
-- node {\copymidarrow} (ucp1r-upnorth);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}
\end{document}\grid
Binary file not shown.
+17 -19
View File
@@ -1,10 +1,8 @@
\documentclass[border=15pt, multi, tikz]{standalone} \documentclass[border=15pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import} \usepackage{import}
\subimport{../../layers/}{init} \subimport{../../layers/}{init}
\usetikzlibrary{positioning} \usetikzlibrary{positioning}
\newcommand{\midarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw=\edgecolor] (-0.3,0) -- ++(0.3,0);}
\newcommand{\up}{0.25} \newcommand{\up}{0.25}
\newcommand{\down}{0.25} \newcommand{\down}{0.25}
\newcommand{\arrowlength}{4} \newcommand{\arrowlength}{4}
@@ -12,35 +10,35 @@
\begin{document} \begin{document}
\begin{tikzpicture} \begin{tikzpicture}
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7] \tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Layer Blocks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1
\pic[shift={(0,0,0)},fill={rgb:blue,1.5;red,3.5;green,3.5;white,5}] at (0,0,0) {GenericSequentialLayer={blockname=crp1,%
numFilters={{" ",""}},height=20,width={7},depth=20, blocklabel=SoftmaxLoss: $E_\mathcal{S}$ ,ylabel= ,zlabel= }};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw connections %% Draw previous connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east)++(0,\up,0) -- node {\midarrow} ++(\arrowlength.0,0) \draw [connection] (-\arrowlength,\up,0)
node [anchor=south east,scale=2.1]{$E_\mathcal{S} [p;\theta]$};
\draw (crp1-west)++(0,\up,0) coordinate (crp1-west-up);
\draw [connection] (crp1-west-up)++(-\arrowlength,0,0)
node[anchor=south west,scale=2.1]{$p(x^{(t)})$} node[anchor=south west,scale=2.1]{$p(x^{(t)})$}
-- node {\midarrow} (crp1-west-up); -- node {\midarrow} (0,\up,0);
\draw [connection] (0,-\down,0) -- node {\midarrow} ++(-\arrowlength.0,0)
\draw [connection] (crp1-west)++(0,-\down,0) -- node {\midarrow} ++(-\arrowlength.0,0)
node[anchor=north west,inner sep = 10, xshift=-25,scale=2.3] node[anchor=north west,inner sep = 10, xshift=-25,scale=2.3]
{ {
$\frac{\partial L}{\partial E_\mathcal{S}}\frac{\partial E_\mathcal{S}}{\partial p}$ $\frac{\partial L}{\partial E_\mathcal{S}}\frac{\partial E_\mathcal{S}}{\partial p}$
}; };
\draw (crp1-east)++(0,-\down,0) coordinate (crp1-east-down); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east-down)++(\arrowlength,0,0) %% Draw Layer Blocks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pic[shift={(0,0,0)}] at (0,0,0) {Box={name=crp1,caption=SoftmaxLoss: $E_\mathcal{S}$ ,%
fill={rgb:blue,1.5;red,3.5;green,3.5;white,5},opacity=0.5,height=20,width=7,depth=20}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw next connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east)++(0,\up,0) -- node {\midarrow} ++(\arrowlength.0,0)
node [anchor=south east,scale=2.1]{$E_\mathcal{S} [p;\theta]$};
\draw [connection] (crp1-east)++(\arrowlength,-\down,0)
node[anchor=north east,inner sep = 10, xshift=25,scale=2.3] node[anchor=north east,inner sep = 10, xshift=25,scale=2.3]
{ {
$\frac{\partial L}{\partial E_\mathcal{S}} = \lambda_\mathcal{S}$ $\frac{\partial L}{\partial E_\mathcal{S}} = \lambda_\mathcal{S}$
} }
-- node {\midarrow} (crp1-east-down); -- node {\midarrow} ++(-\arrowlength,0,0);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Binary file not shown.
+164
View File
@@ -0,0 +1,164 @@
\documentclass[border=8pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import}
\subimport{../../layers/}{init}
\usetikzlibrary{positioning}
\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]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Encoder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2
\pic[shift={(0,0,0)}] at (0,0,0) {RightBandedBox={name=cr1,%
xlabel={{"64","64"}},zlabel=I,fill=\ConvColor,bandfill=\ConvReluColor,%
height=40,width={2,2},depth=40}};
%pool1
\pic[shift={(0,0,0)}] at (cr1-east) {Box={name=p1,%
fill=\PoolColor,opacity=0.5,height=32,width=1,depth=32}};
%%%%%%%%%%
% conv2_1,conv2_2
\pic[shift={(1,0,0)}] at (p1-east) {RightBandedBox={name=cr2,%
xlabel={{"128","128"}},zlabel=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
height=32,width={3.5,3.5},depth=32}};
%pool2
\pic[shift={(0,0,0)}] at (cr2-east) {Box={name=p2,%
fill=\PoolColor,opacity=0.5,height=25,width=1,depth=25}};
%%%%%%%%%%
% conv3_1,conv3_2
\pic[shift={(0.75,0,0)}] at (p2-east) {RightBandedBox={name=cr3,%
xlabel={{"256","256"}},zlabel=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
height=25,width={4.5,4.5},depth=25}};
%pool3
\pic[shift={(0,0,0)}] at (cr3-east) {Box={name=p3,%
fill=\PoolColor,opacity=0.5,height=16,width=1,depth=16}};
%%%%%%%%%%
% conv4_1,conv4_2,conv4_3
\pic[shift={(0.5,0,0)}] at (p3-east) {RightBandedBox={name=cr4,%
xlabel={{"512","512"}},zlabel=I/8,fill=\ConvColor,bandfill=\ConvReluColor,%
height=16,width={6,6},depth=16}};
%pool4
\pic[shift={(0,0,0)}] at (cr4-east) {Box={name=p4,%
fill=\PoolColor,opacity=0.5,height=8,width=1,depth=8}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Bottleneck
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% conv5_1,conv5_2,conv5_3
\pic[shift={(0.75,0,0)}] at (p4-east) {RightBandedBox={name=cr5,caption=Bottleneck Conv,%
xlabel={{"1024","1024"}},zlabel=I/16,fill=\ConvColor,bandfill=\ConvReluColor,%
height=8,width={8,8},depth=8}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Decoder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% unpool4,
\pic[shift={(1.2,0,0)}] at (cr5-east) {Box={name=up4,%
fill=\UnpoolColor,opacity=0.6,height=16,width=1,depth=16}};
\pic[shift={(0,0,0)}] at (up4-east) {RightBandedBox={name=ucr4,%
xlabel={{"512","dummy"}},fill=\ConvColor,bandfill=\ConvReluColor,%
height=16,width=6,depth=16}};
\pic[shift={(0,0,0)}] at (ucr4-east) {RightBandedBox={name=cat4,%
xlabel={{"512",""}},fill={rgb:white,1;black,3},bandfill={rgb:white,1;black,2},opacity=0.2,height=16,width=6,depth=16}};
\pic[shift={(0,0,0)}] at (cat4-east) {RightBandedBox={name=ucr4a,%
xlabel={{"512","512"}},zlabel=I/8,fill=\ConvColor,bandfill=\ConvReluColor,%
height=16,width={6,6},depth=16}};
%%%%%%%%%%
%% unpool3,
\pic[shift={(1.5,0,0)}] at (ucr4a-east) {Box={name=up3,%
fill=\UnpoolColor,opacity=0.6,height=25,width=1,depth=25}};
\pic[shift={(0,0,0)}] at (up3-east) {RightBandedBox={name=ucr3,%
xlabel={{"256","dummy"}},fill=\ConvColor,bandfill=\ConvReluColor,%
height=25,width=4.5,depth=25}};
\pic[shift={(0,0,0)}] at (ucr3-east) {RightBandedBox={name=cat3,%
xlabel={{"256",""}},fill={rgb:white,1;black,3},bandfill={rgb:white,1;black,2},opacity=0.2,height=25,width=4.5,depth=25}};
\pic[shift={(0,0,0)}] at (cat3-east) {RightBandedBox={name=ucr3a,%
xlabel={{"256","256"}},zlabel=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
height=25,width={4.5,4.5},depth=25}};
%%%%%%%%%%
%% unpool2,
\pic[shift={(1,0,0)}] at (ucr3a-east) {Box={name=up2,%
fill=\UnpoolColor,opacity=0.6,height=32,width=1,depth=32}};
\pic[shift={(0,0,0)}] at (up2-east) {RightBandedBox={name=ucr2,%
xlabel={{"128","dummy"}},fill=\ConvColor,bandfill=\ConvReluColor,%
height=32,width=3.5,depth=32}};
\pic[shift={(0,0,0)}] at (ucr2-east) {RightBandedBox={name=cat2,%
xlabel={{"128",""}},fill={rgb:white,1;black,3},bandfill={rgb:white,1;black,2},opacity=0.2,height=32,width=3.5,depth=32}};
\pic[shift={(0,0,0)}] at (cat2-east) {RightBandedBox={name=ucr2a,%
xlabel={{"128","128"}},zlabel=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
height=32,width={3.5,3.5},depth=32}};
%%%%%%%%%%
%% unpool1,
\pic[shift={(1.5,0,0)}] at (ucr2a-east) {Box={name=up1,%
fill=\UnpoolColor,opacity=0.6,height=40,width=1,depth=40}};
\pic[shift={(0,0,0)}] at (up1-east) {RightBandedBox={name=ucr1,%
xlabel={{"64","dummy"}},fill=\ConvColor,bandfill=\ConvReluColor,%
height=40,width=2.5,depth=40}};
\pic[shift={(0,0,0)}] at (ucr1-east) {RightBandedBox={name=cat1,%
xlabel={{"64",""}},fill={rgb:white,1;black,3},bandfill={rgb:white,1;black,2},opacity=0.2,height=40,width=2.5,depth=40}};
\pic[shift={(0,0,0)}] at (cat1-east) {RightBandedBox={name=ucr1a,%
xlabel={{"64","64"}},fill=\ConvColor,bandfill=\ConvReluColor,%
height=40,width={2.5,2.5},depth=40}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pic[shift={(0.75,0,0)}] at (ucr1a-east) {Box={name=out,caption=Softmax,%
zlabel=I,fill=\SoftmaxColor,height=40,width=1,depth=40}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (p1-east) -- node {\midarrow} (cr2-west);
\draw [connection] (p2-east) -- node {\midarrow} (cr3-west);
\draw [connection] (p3-east) -- node {\midarrow} (cr4-west);
\draw [connection] (p4-east) -- node {\midarrow} (cr5-west);
\draw [connection] (cr5-east) -- node {\midarrow} (up4-west);
\draw [connection] (ucr4a-east) -- node {\midarrow} (up3-west);
\draw [connection] (ucr3a-east) -- node {\midarrow} (up2-west);
\draw [connection] (ucr2a-east) -- node {\midarrow} (up1-west);
\draw [connection] (ucr1a-east) -- node {\midarrow} (out-west);
%\draw [connection] (out-east) -- node {\midarrow} ++(2,0,0);
\path (cr4-southeast) -- (cr4-northeast) coordinate[pos=1.25] (cr4-top) ;
\path (cr3-southeast) -- (cr3-northeast) coordinate[pos=1.25] (cr3-top) ;
\path (cr2-southeast) -- (cr2-northeast) coordinate[pos=1.25] (cr2-top) ;
\path (cr1-southeast) -- (cr1-northeast) coordinate[pos=1.25] (cr1-top) ;
\path (cat4-south) -- (cat4-north) coordinate[pos=1.25] (cat4-top) ;
\path (cat3-south) -- (cat3-north) coordinate[pos=1.25] (cat3-top) ;
\path (cat2-south) -- (cat2-north) coordinate[pos=1.25] (cat2-top) ;
\path (cat1-south) -- (cat1-north) coordinate[pos=1.25] (cat1-top) ;
%
\draw [copyconnection] (cr4-northeast)
-- node {\copymidarrow}(cr4-top)
-- node {\copymidarrow}(cat4-top)
-- node {\copymidarrow} (cat4-north);
%
\draw [copyconnection] (cr3-northeast)
-- node {\copymidarrow}(cr3-top)
-- node {\copymidarrow}(cat3-top)
-- node {\copymidarrow} (cat3-north);
%
\draw [copyconnection] (cr2-northeast)
-- node {\copymidarrow}(cr2-top)
-- node {\copymidarrow}(cat2-top)
-- node {\copymidarrow} (cat2-north);
%
\draw [copyconnection] (cr1-northeast)
-- node {\copymidarrow}(cr1-top)
-- node {\copymidarrow}(cat1-top)
-- node {\copymidarrow} (cat1-north);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}
\end{document}
Binary file not shown.
-138
View File
@@ -1,138 +0,0 @@
\documentclass[border=15pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import}
\subimport{../../layers/}{init}
\usetikzlibrary{positioning}
\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]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Encoder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1
\pic[shift={(0,0,0)}] at (0,0,0) {ConvReluPool={blockname=crp1,%
numFilters={{"64","64","32"}},height=40,width={2,2},depth=40,zlabel=I}};
% conv2_1,conv2_2,pool2
\pic[shift={(1.6,0,0)}] at (crp1-east) {ConvReluPool={blockname=crp2,%
numFilters={{"128","128"}},height=35,width={2.5,2.5},depth=35,zlabel=I/2}};
%% conv3_1,conv3_2,conv3_3,pool3
\pic[shift={(1.2,0,0)}] at (crp2-east) {ConvReluPool={blockname=crp3,%
numFilters={{"256","256"}},height=30,width={3.3,3.3},depth=30,zlabel=I/4}};
%% conv4_1,conv4_2,conv4_3,pool4
\pic[shift={(1,0,0)}] at (crp3-east) {ConvReluPool={blockname=crp4,%
numFilters={{"512","512"}},height=23,width={4.5,4.5},depth=23,zlabel=I/8}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Bottleneck
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% fc6,fc7
\pic[shift={(0.9,0,0)}] at (crp4-east) {ConvRelu={blockname=cp6_7,%
numFilters={{"1024","1024"}},height=10,width={9,9},depth=10,zlabel=I/16}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Dencoder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% up32
\pic[shift={(1.5,0,0)}] at (cp6_7-east) {UpConvRelu={blockname=up32,%
numFilters={{"512",""}},height=23,width={4.5},depth=23,zlabel=}};
%% Concat32
\pic[shift={(0,0,0)}] at (up32-east) {Gray={blockname=cat32,%
numFilters={{"512",""}},height=23,width={4.5},depth=23,zlabel=}};
%% Conv32
\pic[shift={(0.5,0,0)}] at (cat32-east) {ConvRelu={blockname=conv32,%
numFilters={{"512","512"}},height=23,width={4.5,4.5},depth=23,zlabel=I/8}};
%% up16
\pic[shift={(2,0,0)}] at (conv32-east) {UpConvRelu={blockname=up16,%
numFilters={{"256",""}},height=30,width={3.3},depth=30,zlabel=}};
%% Concat16
\pic[shift={(0,0,0)}] at (up16-east) {Gray={blockname=cat16,%
numFilters={{"256",""}},height=30,width={3.3},depth=30,zlabel=}};
%% Conv16
\pic[shift={(0.5,0,0)}] at (cat16-east) {ConvRelu={blockname=conv16,%
numFilters={{"256","256"}},height=30,width={3.3,3.3},depth=30,zlabel=I/4}};
%% up8
\pic[shift={(2,0,0)}] at (conv16-east) {UpConvRelu={blockname=up8,%
numFilters={{"128",""}},height=35,width={2.5},depth=35,zlabel=}};
%% Concat8
\pic[shift={(0,0,0)}] at (up8-east) {Gray={blockname=cat8,%
numFilters={{"128",""}},height=35,width={2.5},depth=35,zlabel=}};
%% Conv8
\pic[shift={(0.5,0,0)}] at (cat8-east) {ConvRelu={blockname=conv8,%
numFilters={{"128","128"}},height=35,width={2.5,2.5},depth=35,zlabel=I/2}};
%% up4
\pic[shift={(2,0,0)}] at (conv8-east) {UpConvRelu={blockname=up4,%
numFilters={{"64",""}},height=40,width={2},depth=40,zlabel=}};
%% Concat4
\pic[shift={(0,0,0)}] at (up4-east) {Gray={blockname=cat4,%
numFilters={{"64",""}},height=40,width={2},depth=40,zlabel=}};
%% Conv4
\pic[shift={(0.5,0,0)}] at (cat4-east) {ConvRelu={blockname=conv4,%
numFilters={{"64","64"}},height=40,width={2,2},depth=40,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Draw score producer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Conv4
\pic[shift={(2,0,0)}] at (conv4-east) {Conv={blockname=score,%
numFilters={{"21",""}},height=40,width={2},depth=40,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east) -- node {\midarrow} (crp2-west);
\draw [connection] (crp2-east) -- node {\midarrow} (crp3-west);
\draw [connection] (crp3-east) -- node {\midarrow} (crp4-west);
\draw [connection] (crp4-east) -- node {\midarrow} (cp6_7-west);
\draw [connection] (cp6_7-east) -- node {\midarrow} (up32-west);
\draw [connection] (cat32-east) -- node {\midarrow} (conv32-west);
\draw [connection] (conv32-east) -- node {\midarrow} (up16-west);
\draw [connection] (cat16-east) -- node {\midarrow} (conv16-west);
\draw [connection] (conv16-east) -- node {\midarrow} (up8-west);
\draw [connection] (cat8-east) -- node {\midarrow} (conv8-west);
\draw [connection] (conv8-east) -- node {\midarrow} (up4-west);
\draw [connection] (cat4-east) -- node {\midarrow} (conv4-west);
\draw [connection] (conv4-east) -- node {\midarrow} (score-west);
\path (crp4-lastsouth) -- (crp4-lastnorth) coordinate[pos=1.25] (crp4-top) ;
\path (crp3-lastsouth) -- (crp3-lastnorth) coordinate[pos=1.25] (crp3-top) ;
\path (crp2-lastsouth) -- (crp2-lastnorth) coordinate[pos=1.25] (crp2-top) ;
\path (crp1-lastsouth) -- (crp1-lastnorth) coordinate[pos=1.25] (crp1-top) ;
\path (cat32-south) -- (cat32-north) coordinate[pos=1.25] (cat32-top) ;
\path (cat16-south) -- (cat16-north) coordinate[pos=1.25] (cat16-top) ;
\path (cat8-south) -- (cat8-north) coordinate[pos=1.25] (cat8-top) ;
\path (cat4-south) -- (cat4-north) coordinate[pos=1.25] (cat4-top) ;
\draw [copyconnection] (crp4-lastnorth)
-- node {\copymidarrow}(crp4-top)
-- node {\copymidarrow}(cat32-top)
-- node {\copymidarrow} (cat32-north);
\draw [copyconnection] (crp3-lastnorth)
-- node {\copymidarrow}(crp3-top)
-- node {\copymidarrow}(cat16-top)
-- node {\copymidarrow} (cat16-north);
\draw [copyconnection] (crp2-lastnorth)
-- node {\copymidarrow}(crp2-top)
-- node {\copymidarrow}(cat8-top)
-- node {\copymidarrow} (cat8-north);
\draw [copyconnection] (crp1-lastnorth)
-- node {\copymidarrow}(crp1-top)
-- node {\copymidarrow}(cat4-top)
-- node {\copymidarrow} (cat4-north);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}
\end{document}\grid
Binary file not shown.
+151
View File
@@ -0,0 +1,151 @@
\documentclass[border=8pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import}
\subimport{../../layers/}{init}
\usetikzlibrary{positioning}
\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\ConcatColor{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]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Encoder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2
\pic[shift={(0,0,0)}] at (0,0,0) {RightBandedBox={name=cr1,%
xlabel={{"64","64"}},caption=I,fill=\ConvColor,bandfill=\ConvReluColor,%
height=40,width={2,2},depth=40}};
%pool1
\pic[shift={(1.2,-10,0)}] at (cr1-east) {Box={name=p1,%
fill=\PoolColor,opacity=0.6,height=32,width=1,depth=32}};
%%%%%%%%%%
% conv2_1,conv2_2
\pic[shift={(0,0,0)}] at (p1-east) {RightBandedBox={name=cr2,%
xlabel={{"128","128"}},caption=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
height=32,width={3.5,3.5},depth=32}};
%pool2
\pic[shift={(1.2,-8.5,0)}] at (cr2-east) {Box={name=p2,%
fill=\PoolColor,opacity=0.6,height=25,width=1,depth=25}};
%%%%%%%%%%
% conv3_1,conv3_2
\pic[shift={(0,0,0)}] at (p2-east) {RightBandedBox={name=cr3,%
xlabel={{"256","256"}},caption=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
height=25,width={4.5,4.5},depth=25}};
%pool3
\pic[shift={(1.2,-6.5,0)}] at (cr3-east) {Box={name=p3,%
fill=\PoolColor,opacity=0.6,height=16,width=1,depth=16}};
%%%%%%%%%%
% conv4_1,conv4_2,conv4_3
\pic[shift={(0,0,0)}] at (p3-east) {RightBandedBox={name=cr4,%
xlabel={{"512","512"}},caption=I/8,fill=\ConvColor,bandfill=\ConvReluColor,%
height=16,width={6,6},depth=16}};
%pool4
\pic[shift={(1.2,-3,0)}] at (cr4-east) {Box={name=p4,%
fill=\PoolColor,opacity=0.6,height=8,width=1,depth=8}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Bottleneck
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% conv5_1,conv5_2,conv5_3
\pic[shift={(0,0,0)}] at (p4-east) {RightBandedBox={name=cr5,caption=I/16,%
xlabel={{"1024","1024"}},fill=\ConvColor,bandfill=\ConvReluColor,%
height=8,width={8,8},depth=8}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Decoder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% unpool4,
\pic[shift={(0,0,0)}] at (cr5-east) {Box={name=up4,%
fill=\UnpoolColor,opacity=0.6,height=16,width=1,depth=16}};
\pic[shift={(0,0,0)}] at (up4-east) {RightBandedBox={name=ucr4,%
xlabel={{"512","dummy"}},caption=I/8,fill=\ConvColor,bandfill=\ConvReluColor,%
height=16,width=6,depth=16}};
\pic[shift={(0,3,0)}] at (ucr4-anchor) {Ball={name=cat4,fill=\ConcatColor,radius=2.5,logo=$||$}};
\pic[shift={(1.4,0,0)}] at (cat4-east) {RightBandedBox={name=ucr4a,%
xlabel={{"512","512"}},caption=I/8,fill=\ConvColor,bandfill=\ConvReluColor,%
height=16,width={6,6},depth=16}};
%%%%%%%%%%
%% unpool3,
\pic[shift={(0,0,0)}] at (ucr4a-east) {Box={name=up3,%
fill=\UnpoolColor,opacity=0.6,height=25,width=1,depth=25}};
\pic[shift={(0,0,0)}] at (up3-east) {RightBandedBox={name=ucr3,%
xlabel={{"256","dummy"}},caption=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
height=25,width=4.5,depth=25}};
\pic[shift={(0,6.5,0)}] at (ucr3-anchor) {Ball={name=cat3,fill=\ConcatColor,radius=2.5,logo=$||$}};
\pic[shift={(1.5,0,0)}] at (cat3-east) {RightBandedBox={name=ucr3a,%
xlabel={{"256","256"}},caption=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
height=25,width={4.5,4.5},depth=25}};
%%%%%%%%%%
%% unpool2,
\pic[shift={(0,0,0)}] at (ucr3a-east) {Box={name=up2,%
fill=\UnpoolColor,opacity=0.6,height=32,width=1,depth=32}};
\pic[shift={(0,0,0)}] at (up2-east) {RightBandedBox={name=ucr2,%
xlabel={{"128","dummy"}},caption=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
height=32,width=3.5,depth=32}};
\pic[shift={(0,8.5,0)}] at (ucr2-anchor) {Ball={name=cat2,fill=\ConcatColor,radius=2.5,logo=$||$}};
\pic[shift={(1.8,0,0)}] at (cat2-east) {RightBandedBox={name=ucr2a,%
xlabel={{"128","128"}},caption=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
height=32,width={3.5,3.5},depth=32}};
%%%%%%%%%%
%% unpool1,
\pic[shift={(0,0,0)}] at (ucr2a-east) {Box={name=up1,%
fill=\UnpoolColor,opacity=0.6,height=40,width=1,depth=40}};
\pic[shift={(0,0,0)}] at (up1-east) {RightBandedBox={name=ucr1,%
xlabel={{"64","dummy"}},caption=I,fill=\ConvColor,bandfill=\ConvReluColor,%
height=40,width=2.5,depth=40}};
\pic[shift={(0,10,0)}] at (ucr1-anchor) {Ball={name=cat1,fill=\ConcatColor,radius=2.5,logo=$||$}};
\pic[shift={(2,0,0)}] at (cat1-east) {RightBandedBox={name=ucr1a,%
xlabel={{"64","64"}},caption=I,fill=\ConvColor,bandfill=\ConvReluColor,%
height=40,width={2.5,2.5},depth=40}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pic[shift={(2,0,0)}] at (ucr1a-east) {Box={name=out,caption=Softmax,%
zlabel=I,fill=\SoftmaxColor,height=40,width=1,depth=40}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\path (cr1-east) -- (p1-west|-cr1-west) coordinate[pos=0.5] (crp1-mid) ;
\path (cr2-east) -- (p2-west|-cr2-west) coordinate[pos=0.5] (crp2-mid) ;
\path (cr3-east) -- (p3-west|-cr3-west) coordinate[pos=0.5] (crp3-mid) ;
\path (cr4-east) -- (p4-west|-cr4-west) coordinate[pos=0.5] (crp4-mid) ;
\draw[connection](cr1-east)--node{\midarrow}(crp1-mid)--node{\midarrow}(p1-west-|crp1-mid)--node{\midarrow}(p1-west);
\draw[connection](cr2-east)--node{\midarrow}(crp2-mid)--node{\midarrow}(p2-west-|crp2-mid)--node{\midarrow}(p2-west);
\draw[connection](cr3-east)--node{\midarrow}(crp3-mid)--node{\midarrow}(p3-west-|crp3-mid)--node{\midarrow}(p3-west);
\draw[connection](cr4-east)--node{\midarrow}(crp4-mid)--node{\midarrow}(p4-west-|crp4-mid)--node{\midarrow}(p4-west);
%\draw [connection] (cr5-east) -- node {\midarrow} (up4-west);
%\draw [connection] (ucr4a-east) -- node {\midarrow} (up3-west);
%\draw [connection] (ucr3a-east) -- node {\midarrow} (up2-west);
%\draw [connection] (ucr2a-east) -- node {\midarrow} (up1-west);
\draw [connection] (ucr1a-east) -- node {\midarrow} (out-west);
%\draw [connection] (out-east) -- node {\midarrow} ++(2,0,0);
\draw [copyconnection] (cr4-east) -- node {\copymidarrow} (cat4-west);
\draw [copyconnection] (cr3-east) -- node {\copymidarrow} (cat3-west);
\draw [copyconnection] (cr2-east) -- node {\copymidarrow} (cat2-west);
\draw [copyconnection] (cr1-east) -- node {\copymidarrow} (cat1-west);
\draw [copyconnection] (cat4-east) -- node {\copymidarrow} (ucr4a-west);
\draw [copyconnection] (cat3-east) -- node {\copymidarrow} (ucr3a-west);
\draw [copyconnection] (cat2-east) -- node {\copymidarrow} (ucr2a-west);
\draw [copyconnection] (cat1-east) -- node {\copymidarrow} (ucr1a-west);
\draw [copyconnection] (ucr4-north) -- node {\copymidarrow} (cat4-south);
\draw [copyconnection] (ucr3-north) -- node {\copymidarrow} (cat3-south);
\draw [copyconnection] (ucr2-north) -- node {\copymidarrow} (cat2-south);
\draw [copyconnection] (ucr1-north) -- node {\copymidarrow} (cat1-south);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}
\end{document}
Binary file not shown.
+89 -41
View File
@@ -4,54 +4,102 @@
\subimport{../../layers/}{init} \subimport{../../layers/}{init}
\usetikzlibrary{positioning} \usetikzlibrary{positioning}
\newcommand{\midarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw=\edgecolor] (-0.3,0) -- ++(0.3,0);} \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\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}
\begin{document} \begin{document}
\begin{tikzpicture} \begin{tikzpicture}
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7] \tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Layer Blocks %% Draw Layer Blocks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1 % conv1_1,conv1_2
\pic[shift={(0,0,0)}] at (0,0,0) {ConvReluPool={blockname=crp1,% \pic[shift={(0,0,0)}] at (0,0,0) {RightBandedBox={name=cr1,caption=conv1,%
numFilters={{"64","64","32"}},height=40,width={2,2},depth=40,ylabel=224,zlabel=224}}; xlabel={{"64","64"}},ylabel=224,zlabel=224,fill=\ConvColor,bandfill=\ConvReluColor,%
% conv2_1,conv2_2,pool2 height=40,width={2,2},depth=40}};
\pic[shift={(2.1,0,0)}] at (crp1-east) {ConvReluPool={blockname=crp2,% %pool1
numFilters={{"128","128"}},height=35,width={3,3},depth=35,ylabel=112,zlabel=112}}; \pic[shift={(0,0,0)}] at (cr1-east) {Box={name=p1,%
%% conv3_1,conv3_2,conv3_3,pool3 fill=\PoolColor,opacity=0.5,height=35,width=1,depth=35}};
\pic[shift={(2,0,0)}] at (crp2-east) {ConvReluPool={blockname=crp3,% %%%%%%%%%%
numFilters={{"256","256","256"}},height=30,width={4,4,4},depth=30,ylabel=56,zlabel=56}}; % conv2_1,conv2_2
%% conv4_1,conv4_2,conv4_3,pool4 \pic[shift={(2,0,0)}] at (p1-east) {RightBandedBox={name=cr2,caption=conv2,%
\pic[shift={(1.8,0,0)}] at (crp3-east) {ConvReluPool={blockname=crp4,% xlabel={{"128","128"}},zlabel=112,fill=\ConvColor,bandfill=\ConvReluColor,%
numFilters={{"512","512","512"}},height=23,width={7,7,7},depth=23,ylabel=28,zlabel=28}}; height=35,width={3,3},depth=35}};
%% conv5_1,conv5_2,conv5_3,pool5 %pool2
\pic[shift={(1.5,0,0)}] at (crp4-east) {ConvReluPool={blockname=crp5,% \pic[shift={(0,0,0)}] at (cr2-east) {Box={name=p2,%
numFilters={{"512","512","512"}},height=15,width={7,7,7},depth=15,ylabel=14,zlabel=14}}; fill=\PoolColor,opacity=0.5,height=30,width=1,depth=30}};
%% fc6, %%%%%%%%%%
\pic[shift={(1.2,0,0)}] at (crp5-east) {FullyConnectedRelu={blockname=fc6,% % conv3_1,conv3_2
numFilters={{"4096","dummy"}},height=10,width={10},depth=10,ylabel=7,zlabel=7}}; \pic[shift={(2,0,0)}] at (p2-east) {RightBandedBox={name=cr3,caption=conv3,%
%% fc7 xlabel={{"256","256","256"}},zlabel=56,fill=\ConvColor,bandfill=\ConvReluColor,%
\pic[shift={(1,0,0)}] at (fc6-east) {FullyConnectedRelu={blockname=fc7,% height=30,width={4,4,4},depth=30}};
numFilters={{"4096","dummy"}},height=3,width={10},depth=3,ylabel= ,zlabel=1 }}; %pool3
\pic[shift={(0,0,0)}] at (cr3-east) {Box={name=p3,%
fill=\PoolColor,opacity=0.5,height=23,width=1,depth=23}};
%%%%%%%%%%
% conv4_1,conv4_2,conv4_3
\pic[shift={(1.8,0,0)}] at (p3-east) {RightBandedBox={name=cr4,caption=conv4,%
xlabel={{"512","512","512"}},zlabel=28,fill=\ConvColor,bandfill=\ConvReluColor,%
height=23,width={7,7,7},depth=23}};
%pool4
\pic[shift={(0,0,0)}] at (cr4-east) {Box={name=p4,%
fill=\PoolColor,opacity=0.5,height=15,width=1,depth=15}};
%%%%%%%%%%
% conv5_1,conv5_2,conv5_3
\pic[shift={(1.5,0,0)}] at (p4-east) {RightBandedBox={name=cr5,caption=conv5,%
xlabel={{"512","512","512"}},zlabel=14,fill=\ConvColor,bandfill=\ConvReluColor,%
height=15,width={7,7,7},depth=15}};
%pool5
\pic[shift={(0,0,0)}] at (cr5-east) {Box={name=p5,%
fill=\PoolColor,opacity=0.5,height=10,width=1,depth=10}};
%%%%%%%%%%
% fc6
\pic[shift={(3,0,0)}] at (p5-east) {RightBandedBox={name=fc6,caption=fc6,%
xlabel={{"1",""}},zlabel=4096,fill=\FcColor,bandfill=\FcReluColor,%
height=3,width=3,depth=100}};
%%%%%%%%%%
% fc7
\pic[shift={(2,0,0)}] at (fc6-east) {RightBandedBox={name=fc7,caption=fc7,%
xlabel={{"1","dummy"}},zlabel=4096,fill=\FcColor,bandfill=\FcReluColor,%
height=3,width=3,depth=100}};
%%%%%%%%%%
% fc8
\pic[shift={(1.5,0,0)}] at (fc7-east) {RightBandedBox={name=fc8,caption=fc8+softmax,%
xlabel={{"1","dummy"}},fill=\FcColor,bandfill=\FcReluColor,%
height=3,width=3,depth=25}};
%% fc8 %%%%%%%%%%
\pic[shift={(1,0,0)}] at (fc7-east) {FullyConnected={blockname=fc8,% % softmax
numFilters={{"K","dummy"}},height=3,width=7,depth=3,ylabel=,zlabel=1}}; \pic[shift={(0,0,0)}] at (fc8-east) {Box={name=softmax,%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% xlabel={{"","dummy"}},zlabel=K,opacity=0.8,fill=\SoftmaxColor,%
%% Output height=3,width=1.5,depth=25}};
%% Softmax
%\pic[shift={(1,0,0)}] at (elt2-east) {Deconv={blockname=up8,%
% numFilters={{"21","4096"}},height=35,width=1,depth=35,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east) -- node {\midarrow} (crp2-west);
\draw [connection] (crp2-east) -- node {\midarrow} (crp3-west);
\draw [connection] (crp3-east) -- node {\midarrow} (crp4-west);
\draw [connection] (crp4-east) -- node {\midarrow} (crp5-west);
\draw [connection] (crp5-east) -- node {\midarrow} (fc6-west);
\draw [connection] (fc6-east) -- node {\midarrow} (fc7-west);
\draw [connection] (fc7-east) -- node {\midarrow} (fc8-west);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Arrow Connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (p1-east) -- node {\midarrow} (cr2-west);
\draw [connection] (p2-east) -- node {\midarrow} (cr3-west);
\draw [connection] (p3-east) -- node {\midarrow} (cr4-west);
\draw [connection] (p4-east) -- node {\midarrow} (cr5-west);
\draw [connection] (p5-east) -- node {\midarrow} (fc6-west);
\draw [connection] (fc6-east) -- node {\midarrow} (fc7-west);
\draw [connection] (fc7-east) -- node {\midarrow} (fc8-west);
\draw [connection] (softmax-east) -- node {\midarrow} ++(1.5,0,0);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Dotted Edges
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw[densely dashed]
(fc6-west)++(0, 1.5*.2, 1.5*.2) coordinate(a) -- (p5-nearnortheast)
(fc6-west)++(0,-1.5*.2, 1.5*.2) coordinate(b) -- (p5-nearsoutheast)
(fc6-west)++(0,-1.5*.2,-1.5*.2) coordinate(c) -- (p5-farsoutheast)
(fc6-west)++(0, 1.5*.2,-1.5*.2) coordinate(d) -- (p5-farnortheast)
(a)--(b)--(c)--(d)
;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture} \end{tikzpicture}
\end{document} \end{document}
Binary file not shown.
@@ -1,46 +0,0 @@
\documentclass[border=15pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import}
\subimport{../../layers/}{init}
\usetikzlibrary{positioning}
%\newcommand{\midarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw=\edgecolor] (-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]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Layer Blocks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1
\pic[shift={(0,0,0)}] at (0,0,0) {ConvReluPool={blockname=crp1,%
numFilters={{"64","64","32"}},height=40,width={2,2},depth=40,ylabel=224,zlabel=224}};
% conv2_1,conv2_2,pool2
\pic[shift={(2.1,0,0)}] at (crp1-east) {ConvReluPool={blockname=crp2,%
numFilters={{"128","128"}},height=35,width={3,3},depth=35,ylabel=112,zlabel=112}};
%% conv3_1,conv3_2,conv3_3,pool3
\pic[shift={(2,0,0)}] at (crp2-east) {ConvReluPool={blockname=crp3,%
numFilters={{"256","256","256"}},height=30,width={4,4,4},depth=30,ylabel=56,zlabel=56}};
%% conv4_1,conv4_2,conv4_3,pool4
\pic[shift={(1.8,0,0)}] at (crp3-east) {ConvReluPool={blockname=crp4,%
numFilters={{"512","512","512"}},height=23,width={7,7,7},depth=23,ylabel=28,zlabel=28}};
%% conv5_1,conv5_2,conv5_3,pool5
\pic[shift={(1.5,0,0)}] at (crp4-east) {ConvReluPool={blockname=crp5,%
numFilters={{"512","512","512"}},height=15,width={7,7,7},depth=15,ylabel=14,zlabel=14}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Output
%% Softmax
%\pic[shift={(1,0,0)}] at (elt2-east) {Deconv={blockname=up8,%
% numFilters={{"21","4096"}},height=35,width=1,depth=35,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east) -- node {\midarrow} (crp2-west);
\draw [connection] (crp2-east) -- node {\midarrow} (crp3-west);
\draw [connection] (crp3-east) -- node {\midarrow} (crp4-west);
\draw [connection] (crp4-east) -- node {\midarrow} (crp5-west);
\draw [connection] (crp5-east) -- node {\midarrow} ++(1.5,0,0);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}
\end{document}
Binary file not shown.
-140
View File
@@ -1,140 +0,0 @@
\documentclass[border=15pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import}
\subimport{../../layers/}{init}
\usetikzlibrary{positioning}
\tikzstyle{connection1}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,0;red,4;green,2;white,0},opacity=0.7]
\newcommand{\localmidarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw={rgb:blue,0;red,4;green,2;white,0}] (-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]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw ConvNet Layers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1
\pic[shift={(0,0,0)}] at (0,0,0) {ConvReluPool={blockname=crp1,%
numFilters={{"64","64","32"}},height=40,width={2,2},depth=40,zlabel=I}};
% conv2_1,conv2_2,pool2
\pic[shift={(2.1,0,0)}] at (crp1-east) {ConvReluPool={blockname=crp2,%
numFilters={{"128","128"}},height=35,width={3,3},depth=35,zlabel=I/2}};
%% conv3_1,conv3_2,conv3_3,pool3
\pic[shift={(2,0,0)}] at (crp2-east) {ConvReluPool={blockname=crp3,%
numFilters={{"256","256","256"}},height=30,width={4,4,4},depth=30,zlabel=I/4}};
%% conv4_1,conv4_2,conv4_3,pool4
\pic[shift={(1.5,0,0)}] at (crp3-east) {ConvReluPool={blockname=crp4,%
numFilters={{"512","512","512"}},height=23,width={7,7,7},depth=23,zlabel=I/8}};
%% conv5_1,conv5_2,conv5_3,pool5
\pic[shift={(1.5,0,0)}] at (crp4-east) {ConvReluPool={blockname=crp5,%
numFilters={{"512","512","512"}},height=15,width={7,7,7},depth=15,zlabel=I/16}};
%% fc6, fc7
\pic[shift={(1.2,0,0)}] at (crp5-east) {ConvRelu={blockname=cp6_7,%
numFilters={{"4096","4096"}},height=10,width={10,10},depth=10,zlabel=I/32}};
%% score32
\pic[shift={(1,0,0)}] at (cp6_7-east) {Conv={blockname=score32,%
numFilters={{"21","4096"}},height=10,width=1,depth=10,zlabel=I/32}};
%% Upsampling Deconv Layer
\pic[shift={(2,0,0)}] at (score32-east) {Deconv={blockname=up16,%
numFilters={{"21","4096"}},height=40,width=1,depth=40,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Edge Layers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% upsampling crp2 x2
\pic[shift={(-0.75,-8,0)}] at (crp2-anchor) {Deconv={blockname=crp2_upx2,%
numFilters={{"bilinear x2","4096"}},height=7.5,width=7.5,depth=7.5,zlabel=}};
%% upsampling crp3 x4
\pic[shift={(-0.75,-8,0)}] at (crp3-anchor) {Deconv={blockname=crp3_upx4,%
numFilters={{"bilinear x4","4096"}},height=7.5,width=7.5,depth=7.5,zlabel=}};
%% edge
\pic[shift={(7,-11,0)}] at (crp4-west) {Conv={blockname=edge,%
numFilters={{"1x1 conv","4096"}}, height=30,width=1,depth=30,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Domain Transform Module
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pic[shift={(5,0,0)},fill={rgb:blue,1;red,2;green,4;white,7}] at (up16-east) {DomainTransform={blockname=diff1,%
numFilters={{"21","4096"}},height=40,width=1,depth=40,zlabel=}};
\pic[shift={(2,0,0)},fill={rgb:blue,1;red,2;green,4;white,7}] at (diff1-east) {DomainTransform={blockname=diff2,%
numFilters={{"21","4096"}},height=40,width=1,depth=40,zlabel=}};
\pic[shift={(2,0,0)},fill={rgb:blue,1;red,2;green,4;white,7}] at (diff2-east) {DomainTransform={blockname=diff3,%
numFilters={{"21","4096"}},height=40,width=1,depth=40,zlabel=}};
\pic[shift={(2,0,0)},fill={rgb:blue,1;red,2;green,4;white,7}] at (diff3-east) {DomainTransform={blockname=diff4,%
numFilters={{"21","4096"}},height=40,width=1,depth=40,zlabel=}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Arrows on Domain Transform
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection1] (diff1-anchor)+(0,3,3) -- node{ } ++(0,3,-3);
\draw [connection1] (diff1-anchor)+(0,3,3)-- node{\localmidarrow} ++(0,3,2.9);
\draw [connection1] (diff1-anchor)+(0,3,-2.9) -- node{\localmidarrow} ++(0,3,-3);
\draw [connection1] (diff1-anchor)+(0,2,3) -- node{ } ++(0,2,-3);
\draw [connection1] (diff1-anchor)+(0,2,3)-- node{\localmidarrow} ++(0,2,2.9);
\draw [connection1] (diff1-anchor)+(0,2,-2.9) -- node{\localmidarrow} ++(0,2,-3);
%%%%%%%%%%%%%%%%%%
\draw [connection1] (diff2-anchor)+(0,-3,-3) -- node{ } ++(0,-3,3);
\draw [connection1] (diff2-anchor)+(0,-3,-3)-- node{\localmidarrow} ++(0,-3,-2.9);
\draw [connection1] (diff2-anchor)+(0,-3,2.9) -- node{\localmidarrow} ++(0,-3,3);
\draw [connection1] (diff2-anchor)+(0,-2,-3) -- node{ } ++(0,-2,3);
\draw [connection1] (diff2-anchor)+(0,-2,-3)-- node{\localmidarrow} ++(0,-2,-2.9);
\draw [connection1] (diff2-anchor)+(0,-2,2.9) -- node{\localmidarrow} ++(0,-2,3);
%%%%%%%%%%%%%%%%%%
\draw [connection1] (diff3-anchor)+(0,3,3) -- node{ } ++(0,-3,3);
\draw [connection1] (diff3-anchor)+(0,3,3)-- node{\localmidarrow} ++(0,2.9,3);
\draw [connection1] (diff3-anchor)+(0,-2.9,3) -- node{\localmidarrow} ++(0,-3,3);
\draw [connection1] (diff3-anchor)+(0,3,2) -- node{ } ++(0,-3,2);
\draw [connection1] (diff3-anchor)+(0,3,2)-- node{\localmidarrow} ++(0,2.9,2);
\draw [connection1] (diff3-anchor)+(0,-2.9,2) -- node{\localmidarrow} ++(0,-3,2);
%%%%%%%%%%%%%%%%%%
\draw [connection1] (diff4-anchor)+(0,-3,-3) -- node{ } ++(0,3,-3);
\draw [connection1] (diff4-anchor)+(0,-3,-3)-- node{\localmidarrow} ++(0,-2.9,-3);
\draw [connection1] (diff4-anchor)+(0,2.9,-3) -- node{\localmidarrow} ++(0,3,-3);
\draw [connection1] (diff4-anchor)+(0,-3,-2) -- node{ } ++(0,3,-2);
\draw [connection1] (diff4-anchor)+(0,-3,-2)-- node{\localmidarrow} ++(0,-2.9,-2);
\draw [connection1] (diff4-anchor)+(0,2.9,-2) -- node{\localmidarrow} ++(0,3,-2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ConvNet Connections\draw [connection] (crp1-east) -- node {\midarrow} (crp2-west);
\draw [connection] (crp2-east) -- node {\midarrow} (crp3-west);
\draw [connection] (crp3-east) -- node {\midarrow} (crp4-west);
\draw [connection] (crp4-east) -- node {\midarrow} (crp5-west);
\draw [connection] (crp5-east) -- node {\midarrow} (cp6_7-west);
\draw [connection] (cp6_7-east) -- node {\midarrow} (score32-west);
\draw [connection] (score32-east) -- node {\midarrow} (up16-west);
% Diffusion Block internal connections
\draw [connection] (up16-east) -- node {\midarrow} (diff1-west);
\draw [connection] (diff1-east) -- node {\midarrow} (diff2-west);
\draw [connection] (diff2-east) -- node {\midarrow} (diff3-west);
\draw [connection] (diff3-east) -- node {\midarrow} (diff4-west);
\draw [connection] (diff4-east) -- node {\midarrow} ++(2,0,0);
% EdgeNet Input Connections
\draw [connection](crp1-south)--node {\midarrow}(edge-west-|crp1-south)--node {\midarrow}(edge-west-|crp2-south);
\draw [connection](crp2-south)--node {\midarrow}(crp2_upx2-north);
\draw [connection](crp2_upx2-south)--node {\midarrow}(edge-west-|crp2-south)--node {\midarrow}(edge-west-|crp3-south);
\draw [connection](crp3-south)--node {\midarrow}(crp3_upx4-north);
\draw [connection](crp3_upx4-south)--node {\midarrow}(edge-west-|crp3-south)--node {\midarrow}(edge-west);
% EdgeNet Output Connections
\draw [connection](edge-east)
node[anchor=south west,inner sep = 10, yshift=-20, xshift=180,scale=2.3]{Edges}
--node {\midarrow}(diff4-south |-edge-east)--node {\midarrow}(diff4-south);
\draw [connection](diff3-south |-edge-east)--node {\midarrow}(diff3-south);
\draw [connection](diff2-south |-edge-east)--node {\midarrow}(diff2-south);
\draw [connection](diff1-south |-edge-east)--node {\midarrow}(diff1-south);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}
\end{document}
Binary file not shown.
+83 -36
View File
@@ -1,54 +1,101 @@
\documentclass[border=15pt, multi, tikz]{standalone} \documentclass[border=15pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import} \usepackage{import}
\subimport{../../layers/}{init} \subimport{../../layers/}{init}
\usetikzlibrary{positioning} \usetikzlibrary{positioning}
%\newcommand{\midarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw=\edgecolor] (-0.3,0) -- ++(0.3,0);} \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\DcnvColor{rgb:blue,5;green,2.5;white,5}
\def\SoftmaxColor{rgb:magenta,5;black,7}
\begin{document} \begin{document}
\begin{tikzpicture} \begin{tikzpicture}
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7] \tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Layer Blocks %% Draw Layer Blocks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1 % conv1_1,conv1_2
\pic[shift={(0,0,0)}] at (0,0,0) {ConvReluPool={blockname=crp1,% \pic[shift={(0,0,0)}] at (0,0,0) {RightBandedBox={name=cr1,caption=conv1,%
numFilters={{"64","64","32"}},height=40,width={2,2},depth=40,zlabel=I}}; xlabel={{"64","64"}},zlabel=I,fill=\ConvColor,bandfill=\ConvReluColor,%
% conv2_1,conv2_2,pool2 height=40,width={2,2},depth=40}};
\pic[shift={(2.1,0,0)}] at (crp1-east) {ConvReluPool={blockname=crp2,% %pool1
numFilters={{"128","128"}},height=35,width={3,3},depth=35,zlabel=I/2}}; \pic[shift={(0,0,0)}] at (cr1-east) {Box={name=p1,%
%% conv3_1,conv3_2,conv3_3,pool3 fill=\PoolColor,opacity=0.5,height=35,width=1,depth=35}};
\pic[shift={(2,0,0)}] at (crp2-east) {ConvReluPool={blockname=crp3,% %%%%%%%%%%
numFilters={{"256","256","256"}},height=30,width={4,4,4},depth=30,zlabel=I/4}}; % conv2_1,conv2_2
%% conv4_1,conv4_2,conv4_3,pool4 \pic[shift={(2,0,0)}] at (p1-east) {RightBandedBox={name=cr2,caption=conv2,%
\pic[shift={(1.8,0,0)}] at (crp3-east) {ConvReluPool={blockname=crp4,% xlabel={{"64","64"}},zlabel=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
numFilters={{"512","512","512"}},height=23,width={7,7,7},depth=23,zlabel=I/8}}; height=35,width={3,3},depth=35}};
%% conv5_1,conv5_2,conv5_3,pool5 %pool2
\pic[shift={(1.5,0,0)}] at (crp4-east) {ConvReluPool={blockname=crp5,% \pic[shift={(0,0,0)}] at (cr2-east) {Box={name=p2,%
numFilters={{"512","512","512"}},height=15,width={7,7,7},depth=15,zlabel=I/16}}; fill=\PoolColor,opacity=0.5,height=30,width=1,depth=30}};
%% fc6, fc7 %%%%%%%%%%
\pic[shift={(1.2,0,0)}] at (crp5-east) {ConvRelu={blockname=cp6_7,% % conv3_1,conv3_2
numFilters={{"4096","4096"}},height=10,width={10,10},depth=10,zlabel=I/32}}; \pic[shift={(2,0,0)}] at (p2-east) {RightBandedBox={name=cr3,caption=conv3,%
%% score32 xlabel={{"256","256","256"}},zlabel=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
\pic[shift={(1,0,0)}] at (cp6_7-east) {Conv={blockname=score32,% height=30,width={4,4,4},depth=30}};
numFilters={{"21",""}},height=10,width=2,depth=10,zlabel=I/32}}; %pool3
\pic[shift={(0,0,0)}] at (cr3-east) {Box={name=p3,%
fill=\PoolColor,opacity=0.5,height=23,width=1,depth=23}};
%%%%%%%%%%
% conv4_1,conv4_2,conv4_3
\pic[shift={(1.8,0,0)}] at (p3-east) {RightBandedBox={name=cr4,caption=conv4,%
xlabel={{"512","512","512"}},zlabel=I/8,fill=\ConvColor,bandfill=\ConvReluColor,%
height=23,width={7,7,7},depth=23}};
%pool4
\pic[shift={(0,0,0)}] at (cr4-east) {Box={name=p4,%
fill=\PoolColor,opacity=0.5,height=15,width=1,depth=15}};
%%%%%%%%%%
% conv5_1,conv5_2,conv5_3
\pic[shift={(1.5,0,0)}] at (p4-east) {RightBandedBox={name=cr5,caption=conv5,%
xlabel={{"512","512","512"}},zlabel=I/16,fill=\ConvColor,bandfill=\ConvReluColor,%
height=15,width={7,7,7},depth=15}};
%pool5
\pic[shift={(0,0,0)}] at (cr5-east) {Box={name=p5,%
fill=\PoolColor,opacity=0.5,height=10,width=1,depth=10}};
%%%%%%%%%%
%% fc6, fc7 -> cr6, cr7
\pic[shift={(1,0,0)}] at (p5-east) {RightBandedBox={name=cr6_7,caption=fc to conv,%
xlabel={{"4096","4096"}},fill=\ConvColor,bandfill=\ConvReluColor,%
height=10,width={10,10},depth=10}};
%%%%%%%%%%
%% fc8 -> cr8
%% Output \pic[shift={(1,0,0)}] at (cr6_7-east) {Box={name=c8,caption=fc8 to conv,%
%% Upsampling to original image size xlabel={{"K","dummy"}},fill=\ConvColor,%
\pic[shift={(2,0,0)}] at (score32-east) {Deconv={blockname=up8,% height=10,width=2,depth=10,zlabel=I/32}};
numFilters={{"21",""}},height=35,width=2,depth=35,zlabel=I}}; %%%%%%%%%%
%% Dcnv32
\pic[shift={(2.5,0,0)}] at (c8-east) {Box={name=d32,caption=Deconv,%
xlabel={{"K","dummy"}},fill=\DcnvColor,%
height=40,width=2,depth=40}};
%%%%%%%%%%
%% softmax
\pic[shift={(1,0,0)}] at (d32-east) {Box={name=softmax,caption=softmax,%
xlabel={{"K","dummy"}},fill=\SoftmaxColor,%
height=40,width=2,depth=40,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw connections %% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east) -- node {\midarrow} (crp2-west); \draw [connection] (p1-east) -- node {\midarrow} (cr2-west);
\draw [connection] (crp2-east) -- node {\midarrow} (crp3-west); \draw [connection] (p2-east) -- node {\midarrow} (cr3-west);
\draw [connection] (crp3-east) -- node {\midarrow} (crp4-west); \draw [connection] (p3-east) -- node {\midarrow} (cr4-west);
\draw [connection] (crp4-east) -- node {\midarrow} (crp5-west); \draw [connection] (p4-east) -- node {\midarrow} (cr5-west);
\draw [connection] (crp5-east) -- node {\midarrow} (cp6_7-west); \draw [connection] (p5-east) -- node {\midarrow} (cr6_7-west);
\draw [connection] (cp6_7-east) -- node {\midarrow} (score32-west); \draw [connection] (cr6_7-east) -- node {\midarrow} (c8-west);
\draw [connection] (score32-east) -- node {\midarrow} (up8-west); \draw [connection] (c8-east) -- node {\midarrow} (d32-west);
\draw [connection] (d32-east) -- node {\midarrow} (softmax-west);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Dotted Edges
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw[densely dashed]
(c8-nearnortheast) -- (d32-nearnorthwest)
(c8-nearsoutheast) -- (d32-nearsouthwest)
(c8-farsoutheast) -- (d32-farsouthwest)
(c8-farnortheast) -- (d32-farnorthwest)
;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture} \end{tikzpicture}
\end{document}\grid \end{document}\grid
Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.
+95 -55
View File
@@ -1,86 +1,126 @@
\documentclass[border=15pt, multi, tikz]{standalone} \documentclass[border=15pt, multi, tikz]{standalone}
%\usepackage{blocks}
\usepackage{import} \usepackage{import}
\subimport{../../layers/}{init} \subimport{../../layers/}{init}
\usetikzlibrary{positioning} \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\DcnvColor{rgb:blue,5;green,2.5;white,5}
\def\SoftmaxColor{rgb:magenta,5;black,7}
\def\SumColor{rgb:blue,5;green,15}
\newcommand{\midarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw=\edgecolor] (-0.3,0) -- ++(0.3,0);}
\begin{document} \begin{document}
\begin{tikzpicture} \begin{tikzpicture}
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7] \tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw Layer Blocks %% Draw Layer Blocks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conv1_1,conv1_2,pool1 \node[canvas is zy plane at x=0] (temp) at (-3,0,0) {\includegraphics[width=8cm,height=8cm]{cats.jpg}};
\pic[shift={(0,0,0)}] at (0,0,0) {ConvReluPool={blockname=crp1,% % conv1_1,conv1_2,%pool1
numFilters={{"64","64","32"}},height=40,width={2,2},depth=40,zlabel=I}}; \pic[shift={(0,0,0)}] at (0,0,0) {RightBandedBox={name=cr1,caption=conv1,%
xlabel={{"64","64"}},zlabel=I,fill=\ConvColor,bandfill=\ConvReluColor,%
height=40,width={2,2},depth=40}};
\pic[shift={(0,0,0)}] at (cr1-east) {Box={name=p1,%
fill=\PoolColor,opacity=0.5,height=35,width=1,depth=35}};
% conv2_1,conv2_2,pool2 % conv2_1,conv2_2,pool2
\pic[shift={(2.1,0,0)}] at (crp1-east) {ConvReluPool={blockname=crp2,% \pic[shift={(2,0,0)}] at (p1-east) {RightBandedBox={name=cr2,caption=conv2,%
numFilters={{"128","128"}},height=35,width={3,3},depth=35,zlabel=I/2}}; xlabel={{"64","64"}},zlabel=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
%% conv3_1,conv3_2,conv3_3,pool3 height=35,width={3,3},depth=35}};
\pic[shift={(2,0,0)}] at (crp2-east) {ConvReluPool={blockname=crp3,% \pic[shift={(0,0,0)}] at (cr2-east) {Box={name=p2,%
numFilters={{"256","256","256"}},height=30,width={4,4,4},depth=30,zlabel=I/4}}; fill=\PoolColor,opacity=0.5,height=30,width=1,depth=30}};
%% conv4_1,conv4_2,conv4_3,pool4 % conv3_1,conv3_2,pool3
\pic[shift={(1.8,0,0)}] at (crp3-east) {ConvReluPool={blockname=crp4,% \pic[shift={(2,0,0)}] at (p2-east) {RightBandedBox={name=cr3,caption=conv3,%
numFilters={{"512","512","512"}},height=23,width={7,7,7},depth=23,zlabel=I/8}}; xlabel={{"256","256","256"}},zlabel=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
%% conv5_1,conv5_2,conv5_3,pool5 height=30,width={4,4,4},depth=30}};
\pic[shift={(1.5,0,0)}] at (crp4-east) {ConvReluPool={blockname=crp5,% \pic[shift={(0,0,0)}] at (cr3-east) {Box={name=p3,%
numFilters={{"512","512","512"}},height=15,width={7,7,7},depth=15,zlabel=I/16}}; fill=\PoolColor,opacity=0.5,height=23,width=1,depth=23}};
%% fc6, fc7 % conv4_1,conv4_2,conv4_3,pool4
\pic[shift={(1.2,0,0)}] at (crp5-east) {ConvRelu={blockname=cp6_7,% \pic[shift={(1.8,0,0)}] at (p3-east) {RightBandedBox={name=cr4,caption=conv4,%
numFilters={{"4096","4096"}},height=10,width={10,10},depth=10,zlabel=I/32}}; xlabel={{"512","512","512"}},zlabel=I/8,fill=\ConvColor,bandfill=\ConvReluColor,%
%% score32 height=23,width={7,7,7},depth=23}};
\pic[shift={(1,0,0)}] at (cp6_7-east) {Conv={blockname=score32,% \pic[shift={(0,0,0)}] at (cr4-east) {Box={name=p4,%
numFilters={{"1","4096"}},height=10,width=1,depth=10,zlabel=I/32}}; fill=\PoolColor,opacity=0.5,height=15,width=1,depth=15}};
% conv5_1,conv5_2,conv5_3,pool5
\pic[shift={(1.5,0,0)}] at (p4-east) {RightBandedBox={name=cr5,caption=conv5,%
xlabel={{"512","512","512"}},zlabel=I/16,fill=\ConvColor,bandfill=\ConvReluColor,%
height=15,width={7,7,7},depth=15}};
\pic[shift={(0,0,0)}] at (cr5-east) {Box={name=p5,%
fill=\PoolColor,opacity=0.5,height=10,width=1,depth=10}};
%% fc6, fc7 -> cr6, cr7
\pic[shift={(1,0,0)}] at (p5-east) {RightBandedBox={name=cr6_7,caption=fc to conv,%
xlabel={{"4096","4096"}},fill=\ConvColor,bandfill=\ConvReluColor,%
height=10,width={10,10},depth=10}};
%% fc8 -> cr8 (score32)
\pic[shift={(1,0,0)}] at (cr6_7-east) {Box={name=score32,caption=fc8 to conv,%
xlabel={{"K","dummy"}},fill=\ConvColor,%
height=10,width=2,depth=10,zlabel=I/32}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Joining with previous streams (fcn-16) %%Joining with previous streams (fcn-16s)
%% Upsampling Deconv Layer %% Upsampling Deconv Layer
\pic[shift={(1,0,0)}] at (score32-east) {Deconv={blockname=up32,% %% Dcnv32
numFilters={{"1","4096"}},height=15,width=1,depth=15,zlabel=I/16}}; \pic[shift={(1.5,0,0)}] at (score32-east) {Box={name=d32,%
xlabel={{"K","dummy"}},fill=\DcnvColor,%
height=15,width=2,depth=15,zlabel=I/16}};
%% score16 %% score16
\pic[shift={(0,-4,0)}] at (up32-west) {Conv={blockname=score16,% \pic[shift={(0,-4,0)}] at (d32-west) {Box={name=score16,%
numFilters={{"1","4096"}},height=15,width=1,depth=15,zlabel=I/16}}; xlabel={{"K","dummy"}},fill=\ConvColor,%
height=15,width=2,depth=15,zlabel=I/16}};
%% Elementwise sum between score16 and up32 %% Elementwise sum between score16 and up32
\pic[shift={(1.5,0,0)}] at (up32-east) {Sum={blockname=elt1,% \pic[shift={(1.5,0,0)}] at (d32-east) {Ball={name=elt1,%
numFilters={{"1","4096"}},height=15,width=1,depth=15,zlabel=I/16}}; fill=\SumColor,opacity=0.6,%
radius=2.5,logo=$+$}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Joining with previous streams (fcn-8) %%Joining with previous streams (fcn-8s)
%% Upsampling Deconv Layer %% Upsampling Deconv Layer
\pic[shift={(1,0,0)}] at (elt1-east) {Deconv={blockname=up16,% %% Dcnv16
numFilters={{"1","4096"}},height=20,width=1,depth=20,zlabel=I/8}}; \pic[shift={(1.5,0,0)}] at (elt1-east) {Box={name=d16,%
xlabel={{"K","dummy"}},fill=\DcnvColor,%
height=23,width=2,depth=23,zlabel=I/8}};
%% score8 %% score8
\pic[shift={(0,-7,0)}] at (up16-west) {Conv={blockname=score8,% \pic[shift={(0,-6,0)}] at (d16-west) {Box={name=score8,%
numFilters={{"1","4096"}},height=20,width=1,depth=20,zlabel=I/8}}; xlabel={{"K","dummy"}},fill=\ConvColor,%
%% Elementwise sum between score8 and up16 height=23,width=2,depth=23,zlabel=I/8}};
\pic[shift={(1.5,0,0)}] at (up16-east) {Sum={blockname=elt2,% %% Elementwise sum between score16 and up32
numFilters={{"1","4096"}},height=20,width=1,depth=20,zlabel=I/8}}; \pic[shift={(1.5,0,0)}] at (d16-east) {Ball={name=elt2,%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% fill=\SumColor,opacity=0.6,%
%% Output radius=2.5,logo=$+$}};
%% Upsampling to original image size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pic[shift={(1,0,0)}] at (elt2-east) {Deconv={blockname=up8,% %%% Output
numFilters={{"1","4096"}},height=35,width=1,depth=35,zlabel=I}}; %%%%%%%%%%
%% Dcnv8
\pic[shift={(2.5,0,0)}] at (elt2-east) {Box={name=d8,%
xlabel={{"K","dummy"}},fill=\DcnvColor,%
height=40,width=2,depth=40}};
%%%%%%%%%%
%% softmax
\pic[shift={(1,0,0)}] at (d8-east) {Box={name=softmax,caption=softmax,%
xlabel={{"K","dummy"}},fill=\SoftmaxColor,%
height=40,width=2,depth=40,zlabel=I}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw connections %% Draw connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw [connection] (crp1-east) -- node {\midarrow} (crp2-west); \draw [connection] (p1-east) -- node {\midarrow} (cr2-west);
\draw [connection] (crp2-east) -- node {\midarrow} (crp3-west); \draw [connection] (p2-east) -- node {\midarrow} (cr3-west);
\draw [connection] (crp3-east) -- node {\midarrow} (crp4-west); \draw [connection] (p3-east) -- node {\midarrow} (cr4-west);
\draw [connection] (crp4-east) -- node {\midarrow} (crp5-west); \draw [connection] (p4-east) -- node {\midarrow} (cr5-west);
\draw [connection] (crp5-east) -- node {\midarrow} (cp6_7-west); \draw [connection] (p5-east) -- node {\midarrow} (cr6_7-west);
\draw [connection] (cp6_7-east) -- node {\midarrow} (score32-west); \draw [connection] (cr6_7-east) -- node {\midarrow} (score32-west);
\draw [connection] (score32-east) -- node {\midarrow} (up32-west); \draw [connection] (score32-east) -- node {\midarrow} (d32-west);
\path (crp4-east) -- (crp5-west) coordinate[pos=0.25] (between4_5) ; \path (p4-east) -- (cr5-west) coordinate[pos=0.25] (between4_5) ;
\draw [connection] (between4_5) -- node {\midarrow} (score16-west-|between4_5) -- node {\midarrow} (score16-west); \draw [connection] (between4_5) -- node {\midarrow} (score16-west-|between4_5) -- node {\midarrow} (score16-west);
\draw [connection] (up32-east) -- node {\midarrow} (elt1-west); \draw [connection] (d32-east) -- node {\midarrow} (elt1-west);
\draw [connection] (score16-east) -- node {\midarrow} (score16-east -| elt1-south) -- node {\midarrow} (elt1-south); \draw [connection] (score16-east) -- node {\midarrow} (score16-east -| elt1-south) -- node {\midarrow} (elt1-south);
\draw [connection] (elt1-east) -- node {\midarrow} (up16-west); \draw [connection] (elt1-east) -- node {\midarrow} (d16-west);
\path (crp3-east) -- (crp4-west) coordinate[pos=0.25] (between3_4) ; \path (p3-east) -- (cr4-west) coordinate[pos=0.25] (between3_4) ;
\draw [connection] (between3_4) -- node {\midarrow} (score8-west-|between3_4) -- node {\midarrow} (score8-west); \draw [connection] (between3_4) -- node {\midarrow} (score8-west-|between3_4) -- node {\midarrow} (score8-west);
\draw [connection] (up16-east) -- node {\midarrow} (elt2-west); \draw [connection] (d16-east) -- node {\midarrow} (elt2-west);
\draw [connection] (score8-east) -- node {\midarrow} (score8-east -| elt2-south)-- node {\midarrow} (elt2-south); \draw [connection] (score8-east) -- node {\midarrow} (score8-east -| elt2-south)-- node {\midarrow} (elt2-south);
\draw [connection] (elt2-east) -- node {\midarrow} (up8-west); \draw [connection] (elt2-east) -- node {\midarrow} (d8-west);
\draw [connection] (d8-east) -- node{\midarrow} (softmax-west);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture} \end{tikzpicture}
+40
View File
@@ -0,0 +1,40 @@
\ProvidesPackage{Ball}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw small Ball
%Elementwise or reduction operations can be drawn with this
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{Ball/.pic={\tikzset{/sphere/.cd,#1}
\pgfmathsetmacro{\r}{\radius*\scale}
\shade[ball color=\fill,opacity=\opacity] (0,0,0) circle (\r);
\draw (0,0,0) circle [radius=\r] node[scale=4*\r] {\logo};
\coordinate (\name-anchor) at ( 0 , 0 , 0) ;
\coordinate (\name-east) at ( \r, 0 , 0) ;
\coordinate (\name-west) at (-\r, 0 , 0) ;
\coordinate (\name-north) at ( 0 , \r , 0) ;
\coordinate (\name-south) at ( 0 , -\r, 0) ;
\path (\name-south) + (0,-20pt) coordinate (caption-node)
edge ["\textcolor{black}{\bf \caption}"'] (caption-node); %Ball caption
},
/sphere/.search also={/tikz},
/sphere/.cd,
radius/.store in=\radius,
scale/.store in=\scale,
caption/.store in=\caption,
name/.store in=\name,
fill/.store in=\fill,
logo/.store in=\logo,
opacity/.store in=\opacity,
logo=$\Sigma$,
fill=green,
opacity=0.10,
scale=0.2,
radius=0.5,
caption=,
name=,
}
+110
View File
@@ -0,0 +1,110 @@
\ProvidesPackage{Box}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This Block can draw simple block of boxes with custom colors.
% Can be used for conv, deconv etc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{Box/.pic={\tikzset{/boxblock/.cd,#1}
\tikzstyle{box}=[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=\opacity, pic actions,fill=\fill]
\pgfmathsetmacro{\y}{\cubey*\scale}
\pgfmathsetmacro{\z}{\cubez*\scale}
%Multiple concatenated boxes
\foreach[count=\i,%
evaluate=\i as \xlabel using {array({\boxlabels},\i-1)},%
evaluate=\unscaledx as \k using {\unscaledx*\scale+\prev}, remember=\k as \prev (initially 0)]
\unscaledx in \cubex
{
\pgfmathsetmacro{\x}{\unscaledx*\scale}
\coordinate (a) at (\k-\x , \y/2 , \z/2);
\coordinate (b) at (\k-\x ,-\y/2 , \z/2);
\coordinate (c) at (\k ,-\y/2 , \z/2);
\coordinate (d) at (\k , \y/2 , \z/2);
\coordinate (e) at (\k , \y/2 ,-\z/2);
\coordinate (f) at (\k ,-\y/2 ,-\z/2);
\coordinate (g) at (\k-\x ,-\y/2 ,-\z/2);
\coordinate (h) at (\k-\x , \y/2 ,-\z/2);
\draw [box]
(d) -- (a) -- (b) -- (c) -- cycle
(d) -- (a) -- (h) -- (e) -- cycle
%dotted edges
(f) edge (g)
(b) edge (g)
(h) edge (g)
;
\path (b) edge ["\xlabel"',midway] (c);
\xdef\LastEastx{\k} %\k persists as \LastEastx after loop
}%Loop ends
\draw [box] (d) -- (e) -- (f) -- (c) -- cycle; %East face of last box
\coordinate (a1) at (0 , \y/2 , \z/2);
\coordinate (b1) at (0 ,-\y/2 , \z/2);
\tikzstyle{depthlabel}=[pos=0,text width=14*\z,text centered,sloped]
\path (c) edge ["\small\zlabel"',depthlabel](f); %depth label
\path (b1) edge ["\ylabel",midway] (a1); %height label
\tikzstyle{captionlabel}=[text width=15*\LastEastx/\scale,text centered]
\path (\LastEastx/2,-\y/2,+\z/2) + (0,-25pt) coordinate (cap)
edge ["\textcolor{black}{ \bf \caption}"',captionlabel](cap) ; %Block caption/pic object label
%Define nodes to be used outside on the pic object
\coordinate (\name-west) at (0,0,0) ;
\coordinate (\name-east) at (\LastEastx, 0,0) ;
\coordinate (\name-north) at (\LastEastx/2,\y/2,0);
\coordinate (\name-south) at (\LastEastx/2,-\y/2,0);
\coordinate (\name-anchor) at (\LastEastx/2, 0,0) ;
\coordinate (\name-near) at (\LastEastx/2,0,\z/2);
\coordinate (\name-far) at (\LastEastx/2,0,-\z/2);
\coordinate (\name-nearwest) at (0,0,\z/2);
\coordinate (\name-neareast) at (\LastEastx,0,\z/2);
\coordinate (\name-farwest) at (0,0,-\z/2);
\coordinate (\name-fareast) at (\LastEastx,0,-\z/2);
\coordinate (\name-northeast) at (\name-north-|\name-east);
\coordinate (\name-northwest) at (\name-north-|\name-west);
\coordinate (\name-southeast) at (\name-south-|\name-east);
\coordinate (\name-southwest) at (\name-south-|\name-west);
\coordinate (\name-nearnortheast) at (\LastEastx, \y/2, \z/2);
\coordinate (\name-farnortheast) at (\LastEastx, \y/2,-\z/2);
\coordinate (\name-nearsoutheast) at (\LastEastx,-\y/2, \z/2);
\coordinate (\name-farsoutheast) at (\LastEastx,-\y/2,-\z/2);
\coordinate (\name-nearnorthwest) at (0, \y/2, \z/2);
\coordinate (\name-farnorthwest) at (0, \y/2,-\z/2);
\coordinate (\name-nearsouthwest) at (0,-\y/2, \z/2);
\coordinate (\name-farsouthwest) at (0,-\y/2,-\z/2);
},
/boxblock/.search also={/tikz},
/boxblock/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\scale,
xlabel/.store in=\boxlabels,
ylabel/.store in=\ylabel,
zlabel/.store in=\zlabel,
caption/.store in=\caption,
name/.store in=\name,
fill/.store in=\fill,
opacity/.store in=\opacity,
fill={rgb:red,5;green,5;blue,5;white,15},
opacity=0.4,
width=2,
height=13,
depth=15,
scale=.2,
xlabel={{"","","","","","","","","",""}},
ylabel=,
zlabel=,
caption=,
name=,
}
-55
View File
@@ -1,55 +0,0 @@
\ProvidesPackage{Conv}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw conv combination
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{Conv/.pic={\tikzset{/block/.cd,#1}
% conv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [conv] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw [conv]
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
-69
View File
@@ -1,69 +0,0 @@
\ProvidesPackage{ConvRelu}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw convRelu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{ConvRelu/.pic={\tikzset{/block/.cd,#1}
% conv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [relu]
(\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x/3,0,0) coordinate (a1) -- ++(0,-\cubescale*\cubey,0) coordinate (b1) -- ++(\cubescale*\x/3,0,0) coordinate (c) -- cycle
(d) -- (a1) -- ++(0,0,-\cubescale*\cubez) coordinate (h1) -- ++(+\cubescale*\x/3,0,0) coordinate (e) -- cycle;
\draw [conv]
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- (c) -- cycle
(d) -- (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw[relu,draw={rgb:black,1}]
(d)
-- (e)
-- ++(0,-\cubescale*\cubey,0) coordinate (f)
-- (c) -- cycle;
\draw [conv]
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
%(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
% Black Label name
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (d)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
%\draw (0.5*\SecondLastLayerOriginX*\cubescale , -\cubescale*\cubey/2 , -\cubescale*\cubez/2) coordinate (\cubeblockname-center);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=dsdasfkdas,
blockname=a,
}
-71
View File
@@ -1,71 +0,0 @@
\ProvidesPackage{ConvReluPool}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw convRelu+pooling combination
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{ConvReluPool/.pic={\tikzset{/block/.cd,#1}
% conv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [relu]
(\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x/3,0,0) coordinate (a1) -- ++(0,-\cubescale*\cubey,0) coordinate (b1) -- ++(\cubescale*\x/3,0,0) coordinate (c) -- cycle
(d) -- (a1) -- ++(0,0,-\cubescale*\cubez) coordinate (h1) -- ++(+\cubescale*\x/3,0,0) coordinate (e) -- cycle;
\draw [conv]
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- (c) -- cycle
(d) -- (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
% Pooling layer
\draw [pool]
(\SecondLastLayerOriginX*\cubescale +1*\cubescale,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-1*\cubescale,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(1*\cubescale,0,0) coordinate (c) -- cycle
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) edge (g) -- (c) -- cycle
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- (e) -- cycle;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
%(d) edge ["\bf\cubeblockname"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (e)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
%(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (d)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale + 1*\cubescale , 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
\path (\cubeblockname-east) -- ++(-2*\cubescale,\cubescale*\cubey/2,0) coordinate (\cubeblockname-lastnorth);
\path (\cubeblockname-east) -- ++(-2*\cubescale,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-lastsouth);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
-58
View File
@@ -1,58 +0,0 @@
\ProvidesPackage{Deconv}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw Deconvolution layer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{Deconv/.pic={\tikzset{/block/.cd,#1}
% deconv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [deconv] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw [deconv]
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
\path (\cubeblockname-anchor) -- ++(0,0,\cubescale*\cubez/2) coordinate (\cubeblockname-out);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
-64
View File
@@ -1,64 +0,0 @@
\ProvidesPackage{DomainTransform}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw generic sequential layer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{DomainTransform/.pic={\tikzset{/block/.cd,#1}
% conv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [layer] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw [layer]
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale + 2*\cubescale , 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
-55
View File
@@ -1,55 +0,0 @@
\ProvidesPackage{FullyConnected}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw conv combination
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{FullyConnected/.pic={\tikzset{/block/.cd,#1}
% conv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [fullyconn] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw [fullyconn]
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale + 2*\cubescale , 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
-61
View File
@@ -1,61 +0,0 @@
\ProvidesPackage{FullyConnectedRelu}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw fully connected
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{FullyConnectedRelu/.pic={\tikzset{/block/.cd,#1}
% conv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [fullyrelu]
(\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x/3,0,0) coordinate (a1) -- ++(0,-\cubescale*\cubey,0) coordinate (b1) -- ++(\cubescale*\x/3,0,0) coordinate (c) -- cycle
(d) -- (a1) -- ++(0,0,-\cubescale*\cubez) coordinate (h1) -- ++(+\cubescale*\x/3,0,0) coordinate (e) -- cycle;
\draw [fullyconn]
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- (c) -- cycle
(d) -- (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw [fullyconn]
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
%\draw (0.5*\SecondLastLayerOriginX*\cubescale , -\cubescale*\cubey/2 , -\cubescale*\cubez/2) coordinate (\cubeblockname-center);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
-55
View File
@@ -1,55 +0,0 @@
\ProvidesPackage{Conv}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw conv combination
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{Conv/.pic={\tikzset{/block/.cd,#1}
% conv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [conv] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw [conv]
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
-58
View File
@@ -1,58 +0,0 @@
\ProvidesPackage{GenericSequentialLayer}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw generic sequential layer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{GenericSequentialLayer/.pic={\tikzset{/block/.cd,#1}
% conv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [layer] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw [layer]
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale + 2*\cubescale , 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
-57
View File
@@ -1,57 +0,0 @@
\ProvidesPackage{Gray}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw Deconvolution layer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{Gray/.pic={\tikzset{/block/.cd,#1}
% gray layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [gray] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw [gray]
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
\path (\cubeblockname-anchor) -- ++(0,0,\cubescale*\cubez/2) coordinate (\cubeblockname-out);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
-42
View File
@@ -1,42 +0,0 @@
\ProvidesPackage{Multiply}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw Elementwise operations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{Multiply/.pic={\tikzset{/block/.cd,#1}
\draw (0,0,0) circle (\SphereRadius);
\draw (0,0,0) coordinate (\cubeblockname-anchor);
\draw (\SphereRadius,0,0) coordinate (\cubeblockname-east);
\draw (-\SphereRadius,0,0) coordinate (\cubeblockname-west);
\draw (0,\SphereRadius,0) coordinate (\cubeblockname-north);
\draw (0,-\SphereRadius,0) coordinate (\cubeblockname-south);
\draw[very thick] (-2*\SphereRadius/4,-2*\SphereRadius/4,0) -- (2*\SphereRadius/4,2*\SphereRadius/4,0);
\draw[very thick] (2*\SphereRadius/4,-2*\SphereRadius/4,0) -- (-2*\SphereRadius/4,2*\SphereRadius/4,0);
\shade[ball color=blue,opacity=0.30] (0,0,0) circle (\SphereRadius);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
radius/.store in=\SphereRadius,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
radius=0.5,
blocklabel=,
blockname=,
}
+130
View File
@@ -0,0 +1,130 @@
\ProvidesPackage{RightBandedBox}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This Block can draw simple block of boxes with custom colors.
% Can be used for conv, deconv etc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{RightBandedBox/.pic={\tikzset{/block/.cd,#1}
\tikzstyle{box}=[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=\opacity, pic actions,fill=\fill]
\tikzstyle{band}=[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=\bandopacity, pic actions,fill=\bandfill,draw=\bandfill]
\pgfmathsetmacro{\y}{\cubey*\scale}
\pgfmathsetmacro{\z}{\cubez*\scale}
%Multiple concatenated boxes
\foreach[count=\i,%
evaluate=\i as \xlabel using {array({\boxlabels},\i-1)},%
evaluate=\unscaledx as \k using {\unscaledx*\scale+\prev}, remember=\k as \prev (initially 0)]
\unscaledx in \cubex
{
\pgfmathsetmacro{\x}{\unscaledx*\scale}
\coordinate (a) at (\k-\x , \y/2 , \z/2);
\coordinate (art) at (\k-\x/3 , \y/2 , \z/2); %a_right_third
\coordinate (b) at (\k-\x ,-\y/2 , \z/2);
\coordinate (brt) at (\k-\x/3 ,-\y/2 , \z/2); %b_right_third
\coordinate (c) at (\k ,-\y/2 , \z/2);
\coordinate (d) at (\k , \y/2 , \z/2);
\coordinate (e) at (\k , \y/2 ,-\z/2);
\coordinate (f) at (\k ,-\y/2 ,-\z/2);
\coordinate (g) at (\k-\x ,-\y/2 ,-\z/2);
\coordinate (h) at (\k-\x , \y/2 ,-\z/2);
\coordinate (hrt) at (\k-\x/3 , \y/2 ,-\z/2); %h_right_third
%fill box color
\draw [box]
(d) -- (a) -- (b) -- (c) -- cycle
(d) -- (a) -- (h) -- (e) -- cycle;
%dotted edges
\draw [box]
(f) edge (g)
(b) edge (g)
(h) edge (g);
%fill band color
\draw [band]
(d) -- (art) -- (brt) -- (c) -- cycle
(d) -- (art) -- (hrt) -- (e) -- cycle;
%draw edges again which were covered by band
\draw [box,fill opacity=0]
(d) -- (a) -- (b) -- (c) -- cycle
(d) -- (a) -- (h) -- (e) -- cycle;
\path (b) edge ["\xlabel"',midway] (c);
\xdef\LastEastx{\k} %\k persists as \LastEastx after loop
}%Loop ends
\draw [box] (d) -- (e) -- (f) -- (c) -- cycle; %East face of last box
\draw [band] (d) -- (e) -- (f) -- (c) -- cycle; %East face of last box
\draw [pic actions] (d) -- (e) -- (f) -- (c) -- cycle; %East face edges of last box
\coordinate (a1) at (0 , \y/2 , \z/2);
\coordinate (b1) at (0 ,-\y/2 , \z/2);
\tikzstyle{depthlabel}=[pos=0,text width=14*\z,text centered,sloped]
\path (c) edge ["\small\zlabels"',depthlabel](f); %depth label
\path (b1) edge ["\ylabel",midway] (a1); %height label
\tikzstyle{captionlabel}=[text width=15*\LastEastx/\scale,text centered]
\path (\LastEastx/2,-\y/2,+\z/2) + (0,-25pt) coordinate (cap)
edge ["\textcolor{black}{ \bf \caption}"',captionlabel] (cap); %Block caption/pic object label
%Define nodes to be used outside on the pic object
\coordinate (\name-west) at (0,0,0) ;
\coordinate (\name-east) at (\LastEastx, 0,0) ;
\coordinate (\name-north) at (\LastEastx/2,\y/2,0);
\coordinate (\name-south) at (\LastEastx/2,-\y/2,0);
\coordinate (\name-anchor) at (\LastEastx/2, 0,0) ;
\coordinate (\name-near) at (\LastEastx/2,0,\z/2);
\coordinate (\name-far) at (\LastEastx/2,0,-\z/2);
\coordinate (\name-nearwest) at (0,0,\z/2);
\coordinate (\name-neareast) at (\LastEastx,0,\z/2);
\coordinate (\name-farwest) at (0,0,-\z/2);
\coordinate (\name-fareast) at (\LastEastx,0,-\z/2);
\coordinate (\name-northeast) at (\name-north-|\name-east);
\coordinate (\name-northwest) at (\name-north-|\name-west);
\coordinate (\name-southeast) at (\name-south-|\name-east);
\coordinate (\name-southwest) at (\name-south-|\name-west);
\coordinate (\name-nearnortheast) at (\LastEastx, \y/2, \z/2);
\coordinate (\name-farnortheast) at (\LastEastx, \y/2,-\z/2);
\coordinate (\name-nearsoutheast) at (\LastEastx,-\y/2, \z/2);
\coordinate (\name-farsoutheast) at (\LastEastx,-\y/2,-\z/2);
\coordinate (\name-nearnorthwest) at (0, \y/2, \z/2);
\coordinate (\name-farnorthwest) at (0, \y/2,-\z/2);
\coordinate (\name-nearsouthwest) at (0,-\y/2, \z/2);
\coordinate (\name-farsouthwest) at (0,-\y/2,-\z/2);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\scale,
xlabel/.store in=\boxlabels,
ylabel/.store in=\ylabel,
zlabel/.store in=\zlabels,
caption/.store in=\caption,
name/.store in=\name,
fill/.store in=\fill,
bandfill/.store in=\bandfill,
opacity/.store in=\opacity,
bandopacity/.store in=\bandopacity,
fill={rgb:red,5;green,5;blue,5;white,15},
bandfill={rgb:red,5;green,5;blue,5;white,5},
opacity=0.4,
bandopacity=0.6,
width=2,
height=13,
depth=15,
scale=.2,
xlabel={{"","","","","","","","","",""}},
ylabel=,
zlabel=,
caption=,
name=,
}
-42
View File
@@ -1,42 +0,0 @@
\ProvidesPackage{SigmaSum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw Reduction sum operations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{SigmaSum/.pic={\tikzset{/block/.cd,#1}
\draw (0,0,0) circle [radius=\SphereRadius] node[scale=4*\SphereRadius] {$\Sigma$};
\draw (0,0,0) coordinate (\cubeblockname-anchor);
\draw (\SphereRadius,0,0) coordinate (\cubeblockname-east);
\draw (-\SphereRadius,0,0) coordinate (\cubeblockname-west);
\draw (0,\SphereRadius,0) coordinate (\cubeblockname-north);
\draw (0,-\SphereRadius,0) coordinate (\cubeblockname-south);
%\draw[very thick] (-2*\SphereRadius/4,-2*\SphereRadius/4,0) -- (2*\SphereRadius/4,2*\SphereRadius/4,0);
%\draw [very thick] (c1-east)++(0,\up,0) node [anchor=south west, inner sep = 10, xshift=10,scale=1.2]{$p_{i,j}^{(k)} - p_{(i+\Delta i),(j+\Delta j)}^{(k)}$} -- node {\midarrow} (abs1-west-up);
\shade[ball color=green,opacity=0.30] (0,0,0) circle (\SphereRadius);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
radius/.store in=\SphereRadius,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
radius=0.5,
blocklabel=,
blockname=,
}
-42
View File
@@ -1,42 +0,0 @@
\ProvidesPackage{Sum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw Elementwise operations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{Sum/.pic={\tikzset{/block/.cd,#1}
\draw (0,0,0) circle (\SphereRadius);
\draw (0,0,0) coordinate (\cubeblockname-anchor);
\draw (\SphereRadius,0,0) coordinate (\cubeblockname-east);
\draw (-\SphereRadius,0,0) coordinate (\cubeblockname-west);
\draw (0,\SphereRadius,0) coordinate (\cubeblockname-north);
\draw (0,-\SphereRadius,0) coordinate (\cubeblockname-south);
\draw[very thick] (-2*\SphereRadius/4,0,0) -- (2*\SphereRadius/4,0,0);
\draw[very thick] (0,-2*\SphereRadius/4,0) -- (0,2*\SphereRadius/4,0);
\shade[ball color=blue,opacity=0.30] (0,0,0) circle (\SphereRadius);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
radius/.store in=\SphereRadius,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
radius=0.5,
blocklabel=,
blockname=,
}
-58
View File
@@ -1,58 +0,0 @@
\ProvidesPackage{Up}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw Deconvolution layer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{Up/.pic={\tikzset{/block/.cd,#1}
% deconv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [up] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw [up]
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
\path (\cubeblockname-anchor) -- ++(0,0,\cubescale*\cubez/2) coordinate (\cubeblockname-out);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
-126
View File
@@ -1,126 +0,0 @@
\ProvidesPackage{UpConvRelu}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This Block can draw Upsampling+convRelu combination
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{UpConvRelu/.pic={\tikzset{/block/.cd,#1}
% Upsampling layer
\draw [deconv,fill=\upcolor]
(0,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate (d)
-- ++(-1*\cubescale,0,0) coordinate (a)
-- ++(0,-\cubescale*\cubey,0) coordinate (b)
edge coordinate[pos=1] (g) ++(0,0,-\cubescale*\cubez)
-- ++(1*\cubescale,0,0) coordinate (c)
edge coordinate[pos=1] (f) ++(0,0,-\cubescale*\cubez)
-- cycle
(d)
-- ++(0,0,-\cubescale*\cubez) coordinate (e)
edge (f)
-- ++(-\cubescale*1,0,0) coordinate (h)
edge (g)
-- (a)
-- cycle
(g) edge (f)
;
\fill[deconv] (e)--(f)--(g)--(h)--cycle;
\fill[deconv] (c)--(f)--(g)--(b)--cycle;
\fill[deconv] (a)--(b)--(g)--(h)--cycle;
\path (d) -- ++(-1*\cubescale,0,-\cubescale*\cubez/2) coordinate (\cubeblockname-upnorth);
\path (c) -- ++(-1*\cubescale,0,-\cubescale*\cubez/2) coordinate (\cubeblockname-upsouth);
%% conv layers
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
{
\draw [relu,fill=\fillcolor,draw=\fillcolor]
(\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate (d)
-- ++(-\cubescale*\x/3,0,0) coordinate (a1)
-- ++(0,-\cubescale*\cubey,0) coordinate (b1)
-- ++(\cubescale*\x/3,0,0) coordinate (c) -- cycle
(d)
-- (a1)
-- ++(0,0,-\cubescale*\cubez) coordinate (h1)
-- ++(+\cubescale*\x/3,0,0) coordinate (e) -- cycle
;
\draw [conv,fill=\fillcolor]
(d)
-- ++(-\cubescale*\x,0,0) coordinate (a)
-- ++(0,-\cubescale*\cubey,0) coordinate (b)
edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez)
-- (c) -- cycle
(d)
-- (e)
edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0)
(f)
edge (g)
(d)
-- (a)
-- ++(0,0,-\cubescale*\cubez) coordinate (h)
edge (g)
-- (e) -- cycle;
% labelling each conv layer with number of filters in each layer
\path [every edge/.append style={pic actions}]
(b) edge ["\numfilters"',midway] (b -| c);
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
}
\draw[relu,fill=\fillcolor,draw={rgb:black,1}]
(d)
-- (e)
-- ++(0,-\cubescale*\cubey,0) coordinate (f)
-- (c) -- cycle;
% Labelling the block
\path [every edge/.append style={pic actions}]
% name or size of depth dimension
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
%(d) edge ["\bf\cubeblockname"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (e)
% name or size of height dimension
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
% Block name
%(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (d)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
\draw (0,0,0) coordinate (\cubeblockname-west);
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
},
/block/.search also={/tikz},
/block/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
scale/.store in=\cubescale,
numFilters/.store in=\cubexlabel,
ylabel/.store in=\cubeylabel,
zlabel/.store in=\cubezlabel,
blocklabel/.store in=\cubeblocklabel,
blockname/.store in=\cubeblockname,
fillcolor/.store in=\fillcolor,
upcolor/.store in=\upcolor,
fillcolor = {rgb:yellow,5;red,5;white,5},
upcolor = {rgb:blue,5;green,2.5;white,5},
width=2,
height=13,
depth=15,
scale=.2,
numFilters=,
ylabel=,
zlabel=,
blocklabel=,
blockname=,
}
+3 -27
View File
@@ -2,34 +2,10 @@
\usetikzlibrary{quotes,arrows.meta} \usetikzlibrary{quotes,arrows.meta}
\usetikzlibrary{positioning} \usetikzlibrary{positioning}
\newcommand*{\SecondLastLayerOriginX}{No value}
\def\edgecolor{rgb:blue,4;red,1;green,4;black,3} \def\edgecolor{rgb:blue,4;red,1;green,4;black,3}
\newcommand{\midarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw=\edgecolor] (-0.3,0) -- ++(0.3,0);} \newcommand{\midarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw=\edgecolor] (-0.3,0) -- ++(0.3,0);}
\tikzstyle{conv} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.4, pic actions, fill={rgb:yellow,5;red,2.5;white,5}] \usepackage{Ball}
\tikzstyle{relu} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.6, pic actions, fill={rgb:yellow,5;red,5;white,5},draw={rgb:yellow,5;red,5;white,5}] \usepackage{Box}
\tikzstyle{pool} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.6, pic actions, fill={rgb:red,1;black,0.3}]% colour coeff will be normalized to 1 \usepackage{RightBandedBox}
\tikzstyle{deconv}=[every edge/.append style={pic actions, densely dashed, opacity=.5},fill opacity=0.7, pic actions, fill={rgb:blue,5;green,2.5;white,5}]
\tikzstyle{gray}=[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.4, pic actions, fill={rgb:black,5;white,5}]
\tikzstyle{up}=[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.5, pic actions, fill={rgb:blue,5;green,2.5;white,1}]
\tikzstyle{layer} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.4, pic actions]
\tikzstyle{fullyconn} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.4, pic actions, fill={rgb:blue,5;red,2.5;white,5}]
\tikzstyle{fullyrelu} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.6, pic actions, fill={rgb:blue,5;red,5;white,4},draw={rgb:blue,5;red,5;white,4}]
\tikzstyle{DT} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.4, pic actions, fill={rgb:blue,1;red,2;green,4;white,7}]
\usepackage{ConvReluPool}
\usepackage{Gray}
\usepackage{ConvRelu}
\usepackage{Conv}
\usepackage{Deconv}
\usepackage{UpConvRelu}
\usepackage{Up}
%\usepackage{Eltwise}
\usepackage{Multiply}
\usepackage{Sum}
\usepackage{SigmaSum}
\usepackage{FullyConnected}
\usepackage{FullyConnectedRelu}
\usepackage{DomainTransform}
\usepackage{GenericSequentialLayer}
View File
Binary file not shown.
+75
View File
@@ -0,0 +1,75 @@
from .tikzeng import *
#define new block
def block_2ConvPool( name, botton, top, s_filer=256, n_filer=64, offset="(1,0,0)", size=(32,32,3.5), opacity=0.5 ):
return [
to_ConvConvRelu(
name="ccr_{}".format( name ),
s_filer=str(s_filer),
n_filer=(n_filer,n_filer),
offset=offset,
to="({}-east)".format( botton ),
width=(size[2],size[2]),
height=size[0],
depth=size[1],
),
to_Pool(
name="{}".format( top ),
offset="(0,0,0)",
to="(ccr_{}-east)".format( name ),
width=1,
height=size[0] - int(size[0]/4),
depth=size[1] - int(size[0]/4),
opacity=opacity, ),
to_connection(
"{}".format( botton ),
"ccr_{}".format( name )
)
]
def block_Unconv( name, botton, top, s_filer=256, n_filer=64, offset="(1,0,0)", size=(32,32,3.5), opacity=0.5 ):
return [
to_UnPool( name='unpool_{}'.format(name), offset=offset, to="({}-east)".format(botton), width=1, height=size[0], depth=size[1], opacity=opacity ),
to_ConvRes( name='ccr_res_{}'.format(name), offset="(0,0,0)", to="(unpool_{}-east)".format(name), s_filer=str(s_filer), n_filer=str(n_filer), width=size[2], height=size[0], depth=size[1], opacity=opacity ),
to_Conv( name='ccr_{}'.format(name), offset="(0,0,0)", to="(ccr_res_{}-east)".format(name), s_filer=str(s_filer), n_filer=str(n_filer), width=size[2], height=size[0], depth=size[1] ),
to_ConvRes( name='ccr_res_c_{}'.format(name), offset="(0,0,0)", to="(ccr_{}-east)".format(name), s_filer=str(s_filer), n_filer=str(n_filer), width=size[2], height=size[0], depth=size[1], opacity=opacity ),
to_Conv( name='{}'.format(top), offset="(0,0,0)", to="(ccr_res_c_{}-east)".format(name), s_filer=str(s_filer), n_filer=str(n_filer), width=size[2], height=size[0], depth=size[1] ),
to_connection(
"{}".format( botton ),
"unpool_{}".format( name )
)
]
def block_Res( num, name, botton, top, s_filer=256, n_filer=64, offset="(0,0,0)", size=(32,32,3.5), opacity=0.5 ):
lys = []
layers = [ *[ '{}_{}'.format(name,i) for i in range(num-1) ], top]
for name in layers:
ly = [ to_Conv(
name='{}'.format(name),
offset=offset,
to="({}-east)".format( botton ),
s_filer=str(s_filer),
n_filer=str(n_filer),
width=size[2],
height=size[0],
depth=size[1]
),
to_connection(
"{}".format( botton ),
"{}".format( name )
)
]
botton = name
lys+=ly
lys += [
to_skip( of=layers[1], to=layers[-2], pos=1.25),
]
return lys
+197
View File
@@ -0,0 +1,197 @@
import os
def to_head( projectpath ):
pathlayers = os.path.join( projectpath, 'layers/' ).replace('\\', '/')
return r"""
\documentclass[border=8pt, multi, tikz]{standalone}
\usepackage{import}
\subimport{"""+ pathlayers + r"""}{init}
\usetikzlibrary{positioning}
\usetikzlibrary{3d} %for including external image
"""
def to_cor():
return r"""
\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}
"""
def to_begin():
return r"""
\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]
"""
# layers definition
def to_input( pathfile, to='(-3,0,0)', width=8, height=8, name="temp" ):
return r"""
\node[canvas is zy plane at x=0] (""" + name + """) at """+ to +""" {\includegraphics[width="""+ str(width)+"cm"+""",height="""+ str(height)+"cm"+"""]{"""+ pathfile +"""}};
"""
# Conv
def to_Conv( name, s_filer=256, n_filer=64, offset="(0,0,0)", to="(0,0,0)", width=1, height=40, depth=40, caption=" " ):
return r"""
\pic[shift={"""+ offset +"""}] at """+ to +"""
{Box={
name=""" + name +""",
caption="""+ caption +r""",
xlabel={{"""+ str(n_filer) +""", }},
zlabel="""+ str(s_filer) +""",
fill=\ConvColor,
height="""+ str(height) +""",
width="""+ str(width) +""",
depth="""+ str(depth) +"""
}
};
"""
# Conv,Conv,relu
# Bottleneck
def to_ConvConvRelu( name, s_filer=256, n_filer=(64,64), offset="(0,0,0)", to="(0,0,0)", width=(2,2), height=40, depth=40, caption=" " ):
return r"""
\pic[shift={ """+ offset +""" }] at """+ to +"""
{RightBandedBox={
name="""+ name +""",
caption="""+ caption +""",
xlabel={{ """+ str(n_filer[0]) +""", """+ str(n_filer[1]) +""" }},
zlabel="""+ str(s_filer) +""",
fill=\ConvColor,
bandfill=\ConvReluColor,
height="""+ str(height) +""",
width={ """+ str(width[0]) +""" , """+ str(width[1]) +""" },
depth="""+ str(depth) +"""
}
};
"""
# Pool
def to_Pool(name, offset="(0,0,0)", to="(0,0,0)", width=1, height=32, depth=32, opacity=0.5, caption=" "):
return r"""
\pic[shift={ """+ offset +""" }] at """+ to +"""
{Box={
name="""+name+""",
caption="""+ caption +r""",
fill=\PoolColor,
opacity="""+ str(opacity) +""",
height="""+ str(height) +""",
width="""+ str(width) +""",
depth="""+ str(depth) +"""
}
};
"""
# unpool4,
def to_UnPool(name, offset="(0,0,0)", to="(0,0,0)", width=1, height=32, depth=32, opacity=0.5, caption=" "):
return r"""
\pic[shift={ """+ offset +""" }] at """+ to +"""
{Box={
name="""+ name +r""",
caption="""+ caption +r""",
fill=\UnpoolColor,
opacity="""+ str(opacity) +""",
height="""+ str(height) +""",
width="""+ str(width) +""",
depth="""+ str(depth) +"""
}
};
"""
def to_ConvRes( name, s_filer=256, n_filer=64, offset="(0,0,0)", to="(0,0,0)", width=6, height=40, depth=40, opacity=0.2, caption=" " ):
return r"""
\pic[shift={ """+ offset +""" }] at """+ to +"""
{RightBandedBox={
name="""+ name + """,
caption="""+ caption + """,
xlabel={{ """+ str(n_filer) + """, }},
zlabel="""+ str(s_filer) +r""",
fill={rgb:white,1;black,3},
bandfill={rgb:white,1;black,2},
opacity="""+ str(opacity) +""",
height="""+ str(height) +""",
width="""+ str(width) +""",
depth="""+ str(depth) +"""
}
};
"""
# ConvSoftMax
def to_ConvSoftMax( name, s_filer=40, offset="(0,0,0)", to="(0,0,0)", width=1, height=40, depth=40, caption=" " ):
return r"""
\pic[shift={"""+ offset +"""}] at """+ to +"""
{Box={
name=""" + name +""",
caption="""+ caption +""",
zlabel="""+ str(s_filer) +""",
fill=\SoftmaxColor,
height="""+ str(height) +""",
width="""+ str(width) +""",
depth="""+ str(depth) +"""
}
};
"""
# SoftMax
def to_SoftMax( name, s_filer=10, offset="(0,0,0)", to="(0,0,0)", width=1.5, height=3, depth=25, opacity=0.8, caption=" " ):
return r"""
\pic[shift={"""+ offset +"""}] at """+ to +"""
{Box={
name=""" + name +""",
caption="""+ caption +""",
xlabel={{" ","dummy"}},
zlabel="""+ str(s_filer) +""",
fill=\SoftmaxColor,
opacity="""+ str(opacity) +""",
height="""+ str(height) +""",
width="""+ str(width) +""",
depth="""+ str(depth) +"""
}
};
"""
def to_connection( of, to):
return r"""
\draw [connection] ("""+of+"""-east) -- node {\midarrow} ("""+to+"""-west);
"""
def to_skip( of, to, pos=1.25):
return r"""
\path ("""+ of +"""-southeast) -- ("""+ of +"""-northeast) coordinate[pos="""+ str(pos) +"""] ("""+ of +"""-top) ;
\path ("""+ to +"""-south) -- ("""+ to +"""-north) coordinate[pos="""+ str(pos) +"""] ("""+ to +"""-top) ;
\draw [copyconnection] ("""+of+"""-northeast)
-- node {\copymidarrow}("""+of+"""-top)
-- node {\copymidarrow}("""+to+"""-top)
-- node {\copymidarrow} ("""+to+"""-north);
"""
def to_end():
return r"""
\end{tikzpicture}
\end{document}
"""
def to_generate( arch, pathname="file.tex" ):
with open(pathname, "w") as f:
for c in arch:
print(c)
f.write( c )
Binary file not shown.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

+56
View File
@@ -0,0 +1,56 @@
import sys
sys.path.append('../')
from pycore.tikzeng import *
from pycore.blocks import *
arch = [
to_head('..'),
to_cor(),
to_begin(),
#input
to_input( '9.png', height=7, width=7 ),
to_Conv("INPUT", 32, 1, offset="(0,0,0)", to="(0,0,0)", height=32, depth=32, width=1, caption="INPUT" ),
to_Conv("C1", 28, 6, offset="(1,0,0)", to="(INPUT-east)", height=28, depth=28, width=6, caption="C1" ),
to_connection( "INPUT", "C1"),
to_Pool("S2", offset="(0,0,0)", to="(C1-east)", height=14, depth=14, width=6, caption="S2"),
to_Conv("C3", 10, 16, offset="(1,0,0)", to="(S2-east)", height=10, depth=10, width=16, caption="C3" ),
to_connection( "S2", "C3"),
to_Pool("S4", offset="(0,0,0)", to="(C3-east)", height=5, depth=5, width=16, caption="S4"),
to_Conv("C5", 120, 1, offset="(1,0,0)", to="(S4-east)", height=1, depth=120, width=1, caption="C5" ),
to_connection( "S4", "C5"),
to_Conv("F6", 84, 1, offset="(1,0,0)", to="(C5-east)", height=1, depth=84, width=1, caption="F6" ),
to_connection( "C5", "F6"),
to_SoftMax("OUTPUT", 10 ,"(3,0,0)", "(C5-east)", caption="OUTPUT" ),
to_connection( "F6", "OUTPUT"),
# 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)
# 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()
+26
View File
@@ -0,0 +1,26 @@
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()
+52
View File
@@ -0,0 +1,52 @@
import sys
sys.path.append('../')
from pycore.tikzeng import *
from pycore.blocks import *
arch = [
to_head('..'),
to_cor(),
to_begin(),
#input
to_input( '../examples/fcn8s/cats.jpg' ),
#block-001
to_ConvConvRelu( name='ccr_b1', s_filer=500, n_filer=(64,64), offset="(0,0,0)", to="(0,0,0)", width=(2,2), height=40, depth=40 ),
to_Pool(name="pool_b1", offset="(0,0,0)", to="(ccr_b1-east)", width=1, height=32, depth=32, opacity=0.5),
*block_2ConvPool( name='b2', botton='pool_b1', top='pool_b2', s_filer=256, n_filer=128, offset="(1,0,0)", size=(32,32,3.5), opacity=0.5 ),
*block_2ConvPool( name='b3', botton='pool_b2', top='pool_b3', s_filer=128, n_filer=256, offset="(1,0,0)", size=(25,25,4.5), opacity=0.5 ),
*block_2ConvPool( name='b4', botton='pool_b3', top='pool_b4', s_filer=64, n_filer=512, offset="(1,0,0)", size=(16,16,5.5), opacity=0.5 ),
#Bottleneck
#block-005
to_ConvConvRelu( name='ccr_b5', s_filer=32, n_filer=(1024,1024), offset="(2,0,0)", to="(pool_b4-east)", width=(8,8), height=8, depth=8, caption="Bottleneck" ),
to_connection( "pool_b4", "ccr_b5"),
#Decoder
*block_Unconv( name="b6", botton="ccr_b5", top='end_b6', s_filer=64, n_filer=512, offset="(2.1,0,0)", size=(16,16,5.0), opacity=0.5 ),
to_skip( of='ccr_b4', to='ccr_res_b6', pos=1.25),
*block_Unconv( name="b7", botton="end_b6", top='end_b7', s_filer=128, n_filer=256, offset="(2.1,0,0)", size=(25,25,4.5), opacity=0.5 ),
to_skip( of='ccr_b3', to='ccr_res_b7', pos=1.25),
*block_Unconv( name="b8", botton="end_b7", top='end_b8', s_filer=256, n_filer=128, offset="(2.1,0,0)", size=(32,32,3.5), opacity=0.5 ),
to_skip( of='ccr_b2', to='ccr_res_b8', pos=1.25),
*block_Unconv( name="b9", botton="end_b8", top='end_b9', s_filer=512, n_filer=64, offset="(2.1,0,0)", size=(40,40,2.5), opacity=0.5 ),
to_skip( of='ccr_b1', to='ccr_res_b9', pos=1.25),
to_ConvSoftMax( name="soft1", s_filer=512, offset="(0.75,0,0)", to="(end_b9-east)", width=1, height=40, depth=40, caption="SOFT" ),
to_connection( "end_b9", "soft1"),
to_end()
]
def main():
namefile = str(sys.argv[0]).split('.')[0]
to_generate(arch, namefile + '.tex' )
if __name__ == '__main__':
main()
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
python3 $1.py 2> $1.tex
/usr/local/texlive/2020/bin/x86_64-darwin/pdflatex $1.tex
# pdflatex $1.tex
# rm *.aux *.log *.vscodeLog
# rm *.tex
# if [[ "$OSTYPE" == "darwin"* ]]; then
# open $1.pdf
# else
# xdg-open $1.pdf
# fi