Convert submodule PlotNeuralNet into a regular folder
This commit is contained in:
0
.gitmodules
vendored
Normal file
0
.gitmodules
vendored
Normal file
85
thesis/third_party/PlotNeuralNet/.gitignore
vendored
Normal file
85
thesis/third_party/PlotNeuralNet/.gitignore
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
*.aux
|
||||
*.log
|
||||
*.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/
|
||||
4
thesis/third_party/PlotNeuralNet/.idea/misc.xml
generated
vendored
Normal file
4
thesis/third_party/PlotNeuralNet/.idea/misc.xml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.12 (/usr/bin/python2.7)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
thesis/third_party/PlotNeuralNet/.idea/modules.xml
generated
vendored
Normal file
8
thesis/third_party/PlotNeuralNet/.idea/modules.xml
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/plotneuralnet.iml" filepath="$PROJECT_DIR$/.idea/plotneuralnet.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
12
thesis/third_party/PlotNeuralNet/.idea/plotneuralnet.iml
generated
vendored
Normal file
12
thesis/third_party/PlotNeuralNet/.idea/plotneuralnet.iml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TestRunnerService">
|
||||
<option name="projectConfiguration" value="Nosetests" />
|
||||
<option name="PROJECT_TEST_RUNNER" value="Nosetests" />
|
||||
</component>
|
||||
</module>
|
||||
6
thesis/third_party/PlotNeuralNet/.idea/vcs.xml
generated
vendored
Normal file
6
thesis/third_party/PlotNeuralNet/.idea/vcs.xml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
110
thesis/third_party/PlotNeuralNet/.idea/workspace.xml
generated
vendored
Normal file
110
thesis/third_party/PlotNeuralNet/.idea/workspace.xml
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="776fe343-0ed9-4619-bd19-7a1b6f20e48a" name="Default" comment="" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="97" />
|
||||
<option name="y" value="24" />
|
||||
<option name="width" value="888" />
|
||||
<option name="height" value="1078" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
||||
<flattenPackages />
|
||||
<showMembers />
|
||||
<showModules />
|
||||
<showLibraryContents />
|
||||
<hideEmptyPackages />
|
||||
<abbreviatePackageNames />
|
||||
<autoscrollToSource />
|
||||
<autoscrollFromSource />
|
||||
<sortByType />
|
||||
<manualOrder />
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="plotneuralnet" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="plotneuralnet" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="Scratches" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ShelveChangesManager" show_recycled="false">
|
||||
<option name="remove_strategy" value="false" />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="776fe343-0ed9-4619-bd19-7a1b6f20e48a" name="Default" comment="" />
|
||||
<created>1536764917516</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1536764917516</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="97" y="24" width="1855" height="1085" extended-state="6" />
|
||||
<layout>
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24985963" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.33032694" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Data View" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager />
|
||||
<watches-manager />
|
||||
</component>
|
||||
</project>
|
||||
21
thesis/third_party/PlotNeuralNet/LICENSE
vendored
Normal file
21
thesis/third_party/PlotNeuralNet/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 HarisIqbal88
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
101
thesis/third_party/PlotNeuralNet/README.md
vendored
Normal file
101
thesis/third_party/PlotNeuralNet/README.md
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
# PlotNeuralNet
|
||||
[](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.
|
||||
|
||||
## Examples
|
||||
|
||||
Following are some network representations:
|
||||
|
||||
<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 (<a href="https://www.overleaf.com/read/kkqntfxnvbsk">view on Overleaf</a>)</h6>
|
||||
|
||||
|
||||
<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-32 (<a href="https://www.overleaf.com/read/wsxpmkqvjnbs">view on Overleaf</a>)</h6>
|
||||
|
||||
|
||||
<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 (<a href="https://www.overleaf.com/read/jxhnkcnwhfxp">view on Overleaf</a>)</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
|
||||
|
||||
|
||||
|
||||
46
thesis/third_party/PlotNeuralNet/deepsad/.nvim.lua
vendored
Normal file
46
thesis/third_party/PlotNeuralNet/deepsad/.nvim.lua
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
local ok, overseer = pcall(require, "overseer")
|
||||
if not ok then return end
|
||||
|
||||
-- Register a directory-local, Python-only build task
|
||||
overseer.register_template({
|
||||
name = "Project: Build",
|
||||
condition = {
|
||||
dir = vim.fn.getcwd(), -- limit to this folder (Overseer exrc recipe)
|
||||
filetype = {"python"} -- built-in filetype filter
|
||||
},
|
||||
builder = function()
|
||||
return {
|
||||
-- CHANGE ME: your build command (any tool is fine)
|
||||
-- e.g. { "uv", "run", "ruff", "check" } or { "make" } or { "pytest", "-q" }
|
||||
cmd = {"make"},
|
||||
cwd = vim.fn.getcwd(),
|
||||
-- Headless/silent (no terminal window)
|
||||
strategy = {"jobstart", use_terminal = false},
|
||||
components = {
|
||||
-- Ensure a single instance; replace if one exists
|
||||
{"unique", replace = true}, -- prevents duplicates
|
||||
-- Kill old run and restart on every save
|
||||
{"restart_on_save", delay = 150}, -- “newest save wins”
|
||||
-- Send matches to quickfix; only open on real failures
|
||||
{
|
||||
"on_output_quickfix",
|
||||
open_on_exit = "failure",
|
||||
items_only = true
|
||||
},
|
||||
-- Set SUCCESS/FAILURE based on exit code & standard niceties
|
||||
"on_exit_set_status", "default"
|
||||
}
|
||||
}
|
||||
end
|
||||
})
|
||||
|
||||
-- Start once on first save; restart_on_save handles subsequent saves
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
group = vim.api.nvim_create_augroup("ProjectOverseerAutostart",
|
||||
{clear = true}),
|
||||
callback = function()
|
||||
if #overseer.list_tasks({name = "Project: Build"}) == 0 then
|
||||
overseer.run_template({name = "Project: Build"})
|
||||
end
|
||||
end
|
||||
})
|
||||
57
thesis/third_party/PlotNeuralNet/deepsad/Makefile
vendored
Normal file
57
thesis/third_party/PlotNeuralNet/deepsad/Makefile
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# ====== CONFIG ======
|
||||
# Add names (without extension). Example: NAMES = report thesis notes
|
||||
NAMES = subter_lenet_arch subter_ef_arch
|
||||
|
||||
TEX = $(NAMES:%=%.tex)
|
||||
PDF = $(NAMES:%=%.pdf)
|
||||
|
||||
.PHONY: all clean clean-aux clobber
|
||||
# Keep generated .tex even if a rule aborts
|
||||
.PRECIOUS: %.tex
|
||||
|
||||
# Default: build all PDFs
|
||||
all: $(PDF)
|
||||
|
||||
# ====== Rules ======
|
||||
# Generate {name}.tex from {name}.py
|
||||
# Pre-clean: remove aux + old .tex only if {name}.py is newer (or .tex missing)
|
||||
%.tex: %.py
|
||||
@if [ ! -e "$@" ] || [ "$<" -nt "$@" ]; then \
|
||||
echo "[preclean] $*: removing aux + old .tex"; \
|
||||
rm -f "$*.aux" "$*.log" "$*.fdb_latexmk" "$*.fls" "$*.tex"; \
|
||||
fi
|
||||
@echo "python $< > $@"
|
||||
@python "$<" > "$@"
|
||||
|
||||
# Generate {name}.pdf from {name}.tex
|
||||
# Pre-clean: remove aux (keep .tex) only if PDF is out-of-date
|
||||
# Post-clean: remove aux (keep .tex) after successful pdflatex
|
||||
%.pdf: %.tex
|
||||
@if [ ! -e "$@" ] || [ "$<" -nt "$@" ]; then \
|
||||
echo "[preclean] $*: removing aux (keeping .tex)"; \
|
||||
rm -f "$*.aux" "$*.log" "$*.fdb_latexmk" "$*.fls"; \
|
||||
fi
|
||||
@echo "pdflatex $<"
|
||||
@pdflatex --interaction=nonstopmode "$<" || { echo "pdflatex failed; keeping logs for debugging."; exit 1; }
|
||||
@rm -f "$*.aux" "$*.log" "$*.fdb_latexmk" "$*.fls"
|
||||
|
||||
# ====== Convenience targets ======
|
||||
# Clean everything for listed names (including .tex)
|
||||
clean:
|
||||
@echo "[clean] removing aux + .tex for: $(NAMES)"
|
||||
@for n in $(NAMES); do \
|
||||
rm -f "$$n.aux" "$$n.log" "$$n.fdb_latexmk" "$$n.fls" "$$n.tex"; \
|
||||
done
|
||||
|
||||
# Remove only aux/log-type files (keep .tex)
|
||||
clean-aux:
|
||||
@echo "[clean-aux] removing aux (keeping .tex) for: $(NAMES)"
|
||||
@for n in $(NAMES); do \
|
||||
rm -f "$$n.aux" "$$n.log" "$$n.fdb_latexmk" "$$n.fls"; \
|
||||
done
|
||||
|
||||
# Nuke everything, including PDFs
|
||||
clobber: clean
|
||||
@echo "[clobber] removing PDFs for: $(NAMES)"
|
||||
@for n in $(NAMES); do rm -f "$$n.pdf"; done
|
||||
|
||||
303
thesis/third_party/PlotNeuralNet/deepsad/subter_ef_arch.py
vendored
Normal file
303
thesis/third_party/PlotNeuralNet/deepsad/subter_ef_arch.py
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
# subter_lenet_arch.py
|
||||
# Requires running from inside the PlotNeuralNet repo, like: python3 ../subter_lenet_arch.py
|
||||
import sys, argparse
|
||||
|
||||
sys.path.append("../") # import pycore from repo root
|
||||
|
||||
from pycore.tikzeng import *
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--rep_dim", type=int, default=1024, help="latent size for FC")
|
||||
args = parser.parse_args()
|
||||
REP = int(args.rep_dim)
|
||||
|
||||
# Visual scales so the huge width doesn't dominate the figure
|
||||
H32, H16, H8, H1 = 26, 18, 12, 1
|
||||
D2048, D1024, D512, D256, D128, D1 = 52, 36, 24, 12, 6, 1
|
||||
W1, W4, W8, W16, W32 = 1, 2, 2, 4, 8
|
||||
|
||||
|
||||
arch = [
|
||||
to_head(".."),
|
||||
to_cor(),
|
||||
to_begin(),
|
||||
# --------------------------- ENCODER ---------------------------
|
||||
# Input 1×32×2048 (caption carries H×W; s_filer is numeric)
|
||||
to_Conv(
|
||||
"input",
|
||||
s_filer="{{2048×32}}",
|
||||
n_filer=1,
|
||||
offset="(0,0,0)",
|
||||
to="(0,0,0)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W1,
|
||||
caption="input",
|
||||
),
|
||||
# Conv1 (5x5, same): 1->8, 32×2048
|
||||
to_Conv(
|
||||
"dwconv1",
|
||||
s_filer="",
|
||||
n_filer=1,
|
||||
offset="(2,0,0)",
|
||||
to="(input-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W1,
|
||||
caption="",
|
||||
),
|
||||
to_Conv(
|
||||
"dwconv2",
|
||||
s_filer="",
|
||||
n_filer=16,
|
||||
offset="(0,0,0)",
|
||||
to="(dwconv1-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W16,
|
||||
caption="conv1",
|
||||
),
|
||||
# Pool1 2×2: 32×2048 -> 16×1024
|
||||
# to_connection("input", "conv1"),
|
||||
to_Pool(
|
||||
"pool1",
|
||||
offset="(0,0,0)",
|
||||
to="(dwconv2-east)",
|
||||
height=H32,
|
||||
depth=D512,
|
||||
width=W16,
|
||||
caption="",
|
||||
),
|
||||
# Conv2 (5x5, same): 8->4, stays 16×1024
|
||||
to_Conv(
|
||||
"dwconv3",
|
||||
s_filer="",
|
||||
n_filer=1,
|
||||
offset="(2,0,0)",
|
||||
to="(pool1-east)",
|
||||
height=H32,
|
||||
depth=D512,
|
||||
width=W1,
|
||||
caption="",
|
||||
),
|
||||
to_Conv(
|
||||
"dwconv4",
|
||||
s_filer="",
|
||||
n_filer=32,
|
||||
offset="(0,0,0)",
|
||||
to="(dwconv3-east)",
|
||||
height=H32,
|
||||
depth=D512,
|
||||
width=W32,
|
||||
caption="conv2",
|
||||
),
|
||||
# Pool2 2×2: 16×1024 -> 8×512
|
||||
# to_connection("pool1", "conv2"),
|
||||
to_Pool(
|
||||
"pool2",
|
||||
offset="(0,0,0)",
|
||||
to="(dwconv4-east)",
|
||||
height=H16,
|
||||
depth=D256,
|
||||
width=W32,
|
||||
caption="",
|
||||
),
|
||||
to_Pool(
|
||||
"pool3",
|
||||
offset="(0,0,0)",
|
||||
to="(pool2-east)",
|
||||
height=H8,
|
||||
depth=D128,
|
||||
width=W32,
|
||||
caption="",
|
||||
),
|
||||
to_Conv(
|
||||
"squeeze",
|
||||
s_filer="",
|
||||
n_filer=8,
|
||||
offset="(2,0,0)",
|
||||
to="(pool3-east)",
|
||||
height=H8,
|
||||
depth=D128,
|
||||
width=W8,
|
||||
caption="squeeze",
|
||||
),
|
||||
# FC -> rep_dim (use numeric n_filer)
|
||||
to_fc(
|
||||
"fc1",
|
||||
n_filer="{{8×128×8}}",
|
||||
offset="(2,0,0)",
|
||||
to="(squeeze-east)",
|
||||
height=H1,
|
||||
depth=D512,
|
||||
width=W1,
|
||||
caption=f"FC",
|
||||
),
|
||||
# to_connection("pool2", "fc1"),
|
||||
# --------------------------- LATENT ---------------------------
|
||||
to_Conv(
|
||||
"latent",
|
||||
n_filer="",
|
||||
s_filer="latent dim",
|
||||
offset="(2,0,0)",
|
||||
to="(fc1-east)",
|
||||
height=H8 * 1.6,
|
||||
depth=D1,
|
||||
width=W1,
|
||||
caption=f"Latent Space",
|
||||
),
|
||||
# to_connection("fc1", "latent"),
|
||||
# --------------------------- DECODER ---------------------------
|
||||
# FC back to 16384
|
||||
to_fc(
|
||||
"fc3",
|
||||
n_filer="{{8×128×8}}",
|
||||
offset="(2,0,0)",
|
||||
to="(latent-east)",
|
||||
height=H1,
|
||||
depth=D512,
|
||||
width=W1,
|
||||
caption=f"FC",
|
||||
),
|
||||
to_Conv(
|
||||
"unsqueeze",
|
||||
s_filer="",
|
||||
n_filer=32,
|
||||
offset="(2,0,0)",
|
||||
to="(fc3-east)",
|
||||
height=H8,
|
||||
depth=D128,
|
||||
width=W32,
|
||||
caption="unsqueeze",
|
||||
),
|
||||
# to_connection("latent", "fc3"),
|
||||
# Reshape to 4×8×512
|
||||
to_UnPool(
|
||||
"up1",
|
||||
offset="(2,0,0)",
|
||||
to="(unsqueeze-east)",
|
||||
height=H16,
|
||||
depth=D256,
|
||||
width=W32,
|
||||
caption="",
|
||||
),
|
||||
to_Conv(
|
||||
"dwdeconv1",
|
||||
s_filer="",
|
||||
n_filer=1,
|
||||
offset="(0,0,0)",
|
||||
to="(up1-east)",
|
||||
height=H16,
|
||||
depth=D256,
|
||||
width=W1,
|
||||
caption="deconv1",
|
||||
),
|
||||
to_Conv(
|
||||
"dwdeconv2",
|
||||
s_filer="{{256×16}}",
|
||||
n_filer=32,
|
||||
offset="(0,0,0)",
|
||||
to="(dwdeconv1-east)",
|
||||
height=H16,
|
||||
depth=D256,
|
||||
width=W32,
|
||||
caption="",
|
||||
),
|
||||
to_UnPool(
|
||||
"up2",
|
||||
offset="(2,0,0)",
|
||||
to="(dwdeconv2-east)",
|
||||
height=H16,
|
||||
depth=D1024,
|
||||
width=W32,
|
||||
caption="",
|
||||
),
|
||||
to_Conv(
|
||||
"dwdeconv3",
|
||||
s_filer="",
|
||||
n_filer=1,
|
||||
offset="(0,0,0)",
|
||||
to="(up2-east)",
|
||||
height=H16,
|
||||
depth=D1024,
|
||||
width=W1,
|
||||
caption="deconv2",
|
||||
),
|
||||
to_Conv(
|
||||
"dwdeconv4",
|
||||
s_filer="{{1024×16}}",
|
||||
n_filer=16,
|
||||
offset="(0,0,0)",
|
||||
to="(dwdeconv3-east)",
|
||||
height=H16,
|
||||
depth=D1024,
|
||||
width=W16,
|
||||
caption="",
|
||||
),
|
||||
to_UnPool(
|
||||
"up3",
|
||||
offset="(2,0,0)",
|
||||
to="(dwdeconv4-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W16,
|
||||
caption="",
|
||||
),
|
||||
to_Conv(
|
||||
"dwdeconv5",
|
||||
s_filer="",
|
||||
n_filer=1,
|
||||
offset="(0,0,0)",
|
||||
to="(up3-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W1,
|
||||
caption="deconv3",
|
||||
),
|
||||
to_Conv(
|
||||
"dwdeconv6",
|
||||
s_filer="{{2048×32}}",
|
||||
n_filer=8,
|
||||
offset="(0,0,0)",
|
||||
to="(dwdeconv5-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W8,
|
||||
caption="",
|
||||
),
|
||||
to_Conv(
|
||||
"outconv",
|
||||
s_filer="{{2048×32}}",
|
||||
n_filer=1,
|
||||
offset="(2,0,0)",
|
||||
to="(dwdeconv6-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W1,
|
||||
caption="deconv4",
|
||||
),
|
||||
# to_connection("up2", "deconv2"),
|
||||
# Output
|
||||
to_Conv(
|
||||
"out",
|
||||
s_filer="{{2048×32}}",
|
||||
n_filer=1,
|
||||
offset="(2,0,0)",
|
||||
to="(outconv-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W1,
|
||||
caption="output",
|
||||
),
|
||||
# to_connection("deconv2", "out"),
|
||||
to_end(),
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
name = "subter_lenet_arch"
|
||||
to_generate(arch, name + ".tex")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
361
thesis/third_party/PlotNeuralNet/deepsad/subter_ef_arch.tex
vendored
Normal file
361
thesis/third_party/PlotNeuralNet/deepsad/subter_ef_arch.tex
vendored
Normal file
@@ -0,0 +1,361 @@
|
||||
|
||||
\documentclass[border=8pt, multi, tikz]{standalone}
|
||||
\usepackage{import}
|
||||
\subimport{../layers/}{init}
|
||||
\usetikzlibrary{positioning}
|
||||
\usetikzlibrary{3d} %for including external image
|
||||
|
||||
|
||||
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
|
||||
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
|
||||
\def\PoolColor{rgb:red,1;black,0.3}
|
||||
\def\UnpoolColor{rgb:blue,2;green,1;black,0.3}
|
||||
\def\FcColor{rgb:blue,5;red,2.5;white,5}
|
||||
\def\FcReluColor{rgb:blue,5;red,5;white,4}
|
||||
\def\SoftmaxColor{rgb:magenta,5;black,7}
|
||||
\def\SumColor{rgb:blue,5;green,15}
|
||||
|
||||
|
||||
\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
|
||||
\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7]
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (0,0,0)
|
||||
{Box={
|
||||
name=input,
|
||||
caption=input,
|
||||
xlabel={{1, }},
|
||||
zlabel={{2048×32}},
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=1,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (input-east)
|
||||
{Box={
|
||||
name=dwconv1,
|
||||
caption=,
|
||||
xlabel={{1, }},
|
||||
zlabel=,
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=1,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (dwconv1-east)
|
||||
{Box={
|
||||
name=dwconv2,
|
||||
caption=conv1,
|
||||
xlabel={{16, }},
|
||||
zlabel=,
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=4,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (dwconv2-east)
|
||||
{Box={
|
||||
name=pool1,
|
||||
caption=,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=26,
|
||||
width=4,
|
||||
depth=24
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (pool1-east)
|
||||
{Box={
|
||||
name=dwconv3,
|
||||
caption=,
|
||||
xlabel={{1, }},
|
||||
zlabel=,
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=1,
|
||||
depth=24
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (dwconv3-east)
|
||||
{Box={
|
||||
name=dwconv4,
|
||||
caption=conv2,
|
||||
xlabel={{32, }},
|
||||
zlabel=,
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=8,
|
||||
depth=24
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (dwconv4-east)
|
||||
{Box={
|
||||
name=pool2,
|
||||
caption=,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=18,
|
||||
width=8,
|
||||
depth=12
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (pool2-east)
|
||||
{Box={
|
||||
name=pool3,
|
||||
caption=,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=12,
|
||||
width=8,
|
||||
depth=6
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (pool3-east)
|
||||
{Box={
|
||||
name=squeeze,
|
||||
caption=squeeze,
|
||||
xlabel={{8, }},
|
||||
zlabel=,
|
||||
fill=\ConvColor,
|
||||
height=12,
|
||||
width=2,
|
||||
depth=6
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (squeeze-east)
|
||||
{Box={
|
||||
name=fc1,
|
||||
caption=FC,
|
||||
xlabel={{" ","dummy"}},
|
||||
zlabel={{8×128×8}},
|
||||
fill=\FcColor,
|
||||
opacity=0.8,
|
||||
height=1,
|
||||
width=1,
|
||||
depth=24
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (fc1-east)
|
||||
{Box={
|
||||
name=latent,
|
||||
caption=Latent Space,
|
||||
xlabel={{, }},
|
||||
zlabel=latent dim,
|
||||
fill=\ConvColor,
|
||||
height=19.200000000000003,
|
||||
width=1,
|
||||
depth=1
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (latent-east)
|
||||
{Box={
|
||||
name=fc3,
|
||||
caption=FC,
|
||||
xlabel={{" ","dummy"}},
|
||||
zlabel={{8×128×8}},
|
||||
fill=\FcColor,
|
||||
opacity=0.8,
|
||||
height=1,
|
||||
width=1,
|
||||
depth=24
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (fc3-east)
|
||||
{Box={
|
||||
name=unsqueeze,
|
||||
caption=unsqueeze,
|
||||
xlabel={{32, }},
|
||||
zlabel=,
|
||||
fill=\ConvColor,
|
||||
height=12,
|
||||
width=8,
|
||||
depth=6
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (2,0,0) }] at (unsqueeze-east)
|
||||
{Box={
|
||||
name=up1,
|
||||
caption=,
|
||||
fill=\UnpoolColor,
|
||||
opacity=0.5,
|
||||
height=18,
|
||||
width=8,
|
||||
depth=12
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (up1-east)
|
||||
{Box={
|
||||
name=dwdeconv1,
|
||||
caption=deconv1,
|
||||
xlabel={{1, }},
|
||||
zlabel=,
|
||||
fill=\ConvColor,
|
||||
height=18,
|
||||
width=1,
|
||||
depth=12
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (dwdeconv1-east)
|
||||
{Box={
|
||||
name=dwdeconv2,
|
||||
caption=,
|
||||
xlabel={{32, }},
|
||||
zlabel={{256×16}},
|
||||
fill=\ConvColor,
|
||||
height=18,
|
||||
width=8,
|
||||
depth=12
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (2,0,0) }] at (dwdeconv2-east)
|
||||
{Box={
|
||||
name=up2,
|
||||
caption=,
|
||||
fill=\UnpoolColor,
|
||||
opacity=0.5,
|
||||
height=18,
|
||||
width=8,
|
||||
depth=36
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (up2-east)
|
||||
{Box={
|
||||
name=dwdeconv3,
|
||||
caption=deconv2,
|
||||
xlabel={{1, }},
|
||||
zlabel=,
|
||||
fill=\ConvColor,
|
||||
height=18,
|
||||
width=1,
|
||||
depth=36
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (dwdeconv3-east)
|
||||
{Box={
|
||||
name=dwdeconv4,
|
||||
caption=,
|
||||
xlabel={{16, }},
|
||||
zlabel={{1024×16}},
|
||||
fill=\ConvColor,
|
||||
height=18,
|
||||
width=4,
|
||||
depth=36
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (2,0,0) }] at (dwdeconv4-east)
|
||||
{Box={
|
||||
name=up3,
|
||||
caption=,
|
||||
fill=\UnpoolColor,
|
||||
opacity=0.5,
|
||||
height=26,
|
||||
width=4,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (up3-east)
|
||||
{Box={
|
||||
name=dwdeconv5,
|
||||
caption=deconv3,
|
||||
xlabel={{1, }},
|
||||
zlabel=,
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=1,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (dwdeconv5-east)
|
||||
{Box={
|
||||
name=dwdeconv6,
|
||||
caption=,
|
||||
xlabel={{8, }},
|
||||
zlabel={{2048×32}},
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=2,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (dwdeconv6-east)
|
||||
{Box={
|
||||
name=outconv,
|
||||
caption=deconv4,
|
||||
xlabel={{1, }},
|
||||
zlabel={{2048×32}},
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=1,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (outconv-east)
|
||||
{Box={
|
||||
name=out,
|
||||
caption=output,
|
||||
xlabel={{1, }},
|
||||
zlabel={{2048×32}},
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=1,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
||||
|
||||
192
thesis/third_party/PlotNeuralNet/deepsad/subter_lenet_arch.py
vendored
Normal file
192
thesis/third_party/PlotNeuralNet/deepsad/subter_lenet_arch.py
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
# subter_lenet_arch.py
|
||||
# Requires running from inside the PlotNeuralNet repo, like: python3 ../subter_lenet_arch.py
|
||||
import sys, argparse
|
||||
|
||||
sys.path.append("../") # import pycore from repo root
|
||||
|
||||
from pycore.tikzeng import *
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--rep_dim", type=int, default=1024, help="latent size for FC")
|
||||
args = parser.parse_args()
|
||||
REP = int(args.rep_dim)
|
||||
|
||||
# Visual scales so the huge width doesn't dominate the figure
|
||||
H32, H16, H8 = 26, 18, 12
|
||||
D2048, D1024, D512 = 52, 36, 24
|
||||
W1, W4, W8 = 1, 2, 4
|
||||
|
||||
|
||||
arch = [
|
||||
to_head(".."),
|
||||
to_cor(),
|
||||
to_begin(),
|
||||
# --------------------------- ENCODER ---------------------------
|
||||
# Input 1×32×2048 (caption carries H×W; s_filer is numeric)
|
||||
to_Conv(
|
||||
"input",
|
||||
s_filer="{{2048×32}}",
|
||||
n_filer=1,
|
||||
offset="(0,0,0)",
|
||||
to="(0,0,0)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W1,
|
||||
caption="input",
|
||||
),
|
||||
# Conv1 (5x5, same): 1->8, 32×2048
|
||||
to_Conv(
|
||||
"conv1",
|
||||
s_filer="{{1024×16}}",
|
||||
n_filer=8,
|
||||
offset="(2,0,0)",
|
||||
to="(input-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W8,
|
||||
caption="conv1",
|
||||
),
|
||||
# Pool1 2×2: 32×2048 -> 16×1024
|
||||
# to_connection("input", "conv1"),
|
||||
to_Pool(
|
||||
"pool1",
|
||||
offset="(0,0,0)",
|
||||
to="(conv1-east)",
|
||||
height=H16,
|
||||
depth=D1024,
|
||||
width=W8,
|
||||
caption="",
|
||||
),
|
||||
# Conv2 (5x5, same): 8->4, stays 16×1024
|
||||
to_Conv(
|
||||
"conv2",
|
||||
s_filer="{{512×8}}",
|
||||
n_filer=4,
|
||||
offset="(2,0,0)",
|
||||
to="(pool1-east)",
|
||||
height=H16,
|
||||
depth=D1024,
|
||||
width=W4,
|
||||
caption="conv2",
|
||||
),
|
||||
# Pool2 2×2: 16×1024 -> 8×512
|
||||
# to_connection("pool1", "conv2"),
|
||||
to_Pool(
|
||||
"pool2",
|
||||
offset="(0,0,0)",
|
||||
to="(conv2-east)",
|
||||
height=H8,
|
||||
depth=D512,
|
||||
width=W4,
|
||||
caption="",
|
||||
),
|
||||
# FC -> rep_dim (use numeric n_filer)
|
||||
to_fc(
|
||||
"fc1",
|
||||
n_filer="{{4×512×8}}",
|
||||
offset="(2,0,0)",
|
||||
to="(pool2-east)",
|
||||
height=1.3,
|
||||
depth=D512,
|
||||
width=W1,
|
||||
caption=f"FC",
|
||||
),
|
||||
# to_connection("pool2", "fc1"),
|
||||
# --------------------------- LATENT ---------------------------
|
||||
to_Conv(
|
||||
"latent",
|
||||
n_filer="",
|
||||
s_filer="latent dim",
|
||||
offset="(2,0,0)",
|
||||
to="(fc1-east)",
|
||||
height=H8 * 1.6,
|
||||
depth=1.3,
|
||||
width=W1,
|
||||
caption=f"Latent Space",
|
||||
),
|
||||
# to_connection("fc1", "latent"),
|
||||
# --------------------------- DECODER ---------------------------
|
||||
# FC back to 16384
|
||||
to_fc(
|
||||
"fc3",
|
||||
n_filer="{{4×512×8}}",
|
||||
offset="(2,0,0)",
|
||||
to="(latent-east)",
|
||||
height=1.3,
|
||||
depth=D512,
|
||||
width=W1,
|
||||
caption=f"FC",
|
||||
),
|
||||
# to_connection("latent", "fc3"),
|
||||
# Reshape to 4×8×512
|
||||
to_UnPool(
|
||||
"up1",
|
||||
offset="(2,0,0)",
|
||||
to="(fc3-east)",
|
||||
height=H16,
|
||||
depth=D1024,
|
||||
width=W4,
|
||||
caption="",
|
||||
),
|
||||
# Up ×2: 8×512 -> 16×1024 (we just draw a labeled box)
|
||||
# DeConv1 (5×5, same): 4->8, 16×1024
|
||||
to_Conv(
|
||||
"deconv1",
|
||||
s_filer="{{1024×16}}",
|
||||
n_filer=8,
|
||||
offset="(0,0,0)",
|
||||
to="(up1-east)",
|
||||
height=H16,
|
||||
depth=D1024,
|
||||
width=W8,
|
||||
caption="deconv1",
|
||||
),
|
||||
# to_connection("fc3", "up1"),
|
||||
# Up ×2: 16×1024 -> 32×2048
|
||||
to_UnPool(
|
||||
"up2",
|
||||
offset="(2,0,0)",
|
||||
to="(deconv1-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W8,
|
||||
caption="",
|
||||
),
|
||||
# to_connection("deconv1", "up2"),
|
||||
# DeConv2 (5×5, same): 8->1, 32×2048
|
||||
to_Conv(
|
||||
"deconv2",
|
||||
s_filer="{{2048×32}}",
|
||||
n_filer=1,
|
||||
offset="(0,0,0)",
|
||||
to="(up2-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=W1,
|
||||
caption="deconv2",
|
||||
),
|
||||
# to_connection("up2", "deconv2"),
|
||||
# Output
|
||||
to_Conv(
|
||||
"out",
|
||||
s_filer="{{2048×32}}",
|
||||
n_filer=1,
|
||||
offset="(2,0,0)",
|
||||
to="(deconv2-east)",
|
||||
height=H32,
|
||||
depth=D2048,
|
||||
width=1.0,
|
||||
caption="output",
|
||||
),
|
||||
# to_connection("deconv2", "out"),
|
||||
to_end(),
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
name = "subter_lenet_arch"
|
||||
to_generate(arch, name + ".tex")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
209
thesis/third_party/PlotNeuralNet/deepsad/subter_lenet_arch.tex
vendored
Normal file
209
thesis/third_party/PlotNeuralNet/deepsad/subter_lenet_arch.tex
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
|
||||
\documentclass[border=8pt, multi, tikz]{standalone}
|
||||
\usepackage{import}
|
||||
\subimport{../layers/}{init}
|
||||
\usetikzlibrary{positioning}
|
||||
\usetikzlibrary{3d} %for including external image
|
||||
|
||||
|
||||
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
|
||||
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
|
||||
\def\PoolColor{rgb:red,1;black,0.3}
|
||||
\def\UnpoolColor{rgb:blue,2;green,1;black,0.3}
|
||||
\def\FcColor{rgb:blue,5;red,2.5;white,5}
|
||||
\def\FcReluColor{rgb:blue,5;red,5;white,4}
|
||||
\def\SoftmaxColor{rgb:magenta,5;black,7}
|
||||
\def\SumColor{rgb:blue,5;green,15}
|
||||
|
||||
|
||||
\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
|
||||
\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7]
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (0,0,0)
|
||||
{Box={
|
||||
name=input,
|
||||
caption=input,
|
||||
xlabel={{1, }},
|
||||
zlabel={{2048×32}},
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=1,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (input-east)
|
||||
{Box={
|
||||
name=conv1,
|
||||
caption=conv1,
|
||||
xlabel={{8, }},
|
||||
zlabel={{1024×16}},
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=4,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (conv1-east)
|
||||
{Box={
|
||||
name=pool1,
|
||||
caption=,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=18,
|
||||
width=4,
|
||||
depth=36
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (pool1-east)
|
||||
{Box={
|
||||
name=conv2,
|
||||
caption=conv2,
|
||||
xlabel={{4, }},
|
||||
zlabel={{512×8}},
|
||||
fill=\ConvColor,
|
||||
height=18,
|
||||
width=2,
|
||||
depth=36
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (conv2-east)
|
||||
{Box={
|
||||
name=pool2,
|
||||
caption=,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=12,
|
||||
width=2,
|
||||
depth=24
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (pool2-east)
|
||||
{Box={
|
||||
name=fc1,
|
||||
caption=FC,
|
||||
xlabel={{" ","dummy"}},
|
||||
zlabel={{4×512×8}},
|
||||
fill=\FcColor,
|
||||
opacity=0.8,
|
||||
height=1.3,
|
||||
width=1,
|
||||
depth=24
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (fc1-east)
|
||||
{Box={
|
||||
name=latent,
|
||||
caption=Latent Space,
|
||||
xlabel={{, }},
|
||||
zlabel=latent dim,
|
||||
fill=\ConvColor,
|
||||
height=19.200000000000003,
|
||||
width=1,
|
||||
depth=1.3
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (latent-east)
|
||||
{Box={
|
||||
name=fc3,
|
||||
caption=FC,
|
||||
xlabel={{" ","dummy"}},
|
||||
zlabel={{4×512×8}},
|
||||
fill=\FcColor,
|
||||
opacity=0.8,
|
||||
height=1.3,
|
||||
width=1,
|
||||
depth=24
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (2,0,0) }] at (fc3-east)
|
||||
{Box={
|
||||
name=up1,
|
||||
caption=,
|
||||
fill=\UnpoolColor,
|
||||
opacity=0.5,
|
||||
height=18,
|
||||
width=2,
|
||||
depth=36
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (up1-east)
|
||||
{Box={
|
||||
name=deconv1,
|
||||
caption=deconv1,
|
||||
xlabel={{8, }},
|
||||
zlabel={{1024×16}},
|
||||
fill=\ConvColor,
|
||||
height=18,
|
||||
width=4,
|
||||
depth=36
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (2,0,0) }] at (deconv1-east)
|
||||
{Box={
|
||||
name=up2,
|
||||
caption=,
|
||||
fill=\UnpoolColor,
|
||||
opacity=0.5,
|
||||
height=26,
|
||||
width=4,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (up2-east)
|
||||
{Box={
|
||||
name=deconv2,
|
||||
caption=deconv2,
|
||||
xlabel={{1, }},
|
||||
zlabel={{2048×32}},
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=1,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (deconv2-east)
|
||||
{Box={
|
||||
name=out,
|
||||
caption=output,
|
||||
xlabel={{1, }},
|
||||
zlabel={{2048×32}},
|
||||
fill=\ConvColor,
|
||||
height=26,
|
||||
width=1.0,
|
||||
depth=52
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
||||
|
||||
216
thesis/third_party/PlotNeuralNet/examples/AlexNet/alexnet.tex
vendored
Normal file
216
thesis/third_party/PlotNeuralNet/examples/AlexNet/alexnet.tex
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
\documentclass[border=8pt, multi, tikz]{standalone}
|
||||
\usepackage{import}
|
||||
\subimport{../layers/}{init}
|
||||
\usetikzlibrary{positioning}
|
||||
\usetikzlibrary{3d} %for including external image
|
||||
|
||||
|
||||
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
|
||||
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
|
||||
\def\PoolColor{rgb:red,1;black,0.3}
|
||||
\def\UnpoolColor{rgb:blue,2;green,1;black,0.3}
|
||||
\def\FcColor{rgb:blue,2;green,5;white,5}
|
||||
\def\FcReluColor{blue,2;green,5;;white,4}
|
||||
\def\SoftmaxColor{rgb:magenta,5;black,7}
|
||||
|
||||
|
||||
\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
|
||||
\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7]
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (0,0,0)
|
||||
{Box={
|
||||
name=conv0,
|
||||
caption= ,
|
||||
xlabel={{3, }},
|
||||
zlabel=224,
|
||||
fill=\ConvColor,
|
||||
height=44.8,
|
||||
width=3,
|
||||
depth=44.8
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(1,0,0)}] at (conv0-east)
|
||||
{Box={
|
||||
name=conv1,
|
||||
caption= ,
|
||||
xlabel={{96, }},
|
||||
zlabel=55,
|
||||
fill=\ConvColor,
|
||||
height=11.0,
|
||||
width=4.8,
|
||||
depth=11.0
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (conv0-east) -- node {\midarrow} (conv1-west);
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (conv1-east)
|
||||
{Box={
|
||||
name=pool1,
|
||||
caption= ,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=5.4,
|
||||
width=1,
|
||||
depth=5.4
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(1,0,0)}] at (pool1-east)
|
||||
{Box={
|
||||
name=conv2,
|
||||
caption= ,
|
||||
xlabel={{256, }},
|
||||
zlabel=27,
|
||||
fill=\ConvColor,
|
||||
height=5.4,
|
||||
width=12.8,
|
||||
depth=5.4
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (pool1-east) -- node {\midarrow} (conv2-west);
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (conv2-east)
|
||||
{Box={
|
||||
name=pool2,
|
||||
caption= ,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=2.6,
|
||||
width=1,
|
||||
depth=2.6
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(1,0,0)}] at (pool2-east)
|
||||
{Box={
|
||||
name=conv3,
|
||||
caption= ,
|
||||
xlabel={{384, }},
|
||||
zlabel=13,
|
||||
fill=\ConvColor,
|
||||
height=2.6,
|
||||
width=19.2,
|
||||
depth=2.6
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (pool2-east) -- node {\midarrow} (conv3-west);
|
||||
|
||||
|
||||
\pic[shift={(1,0,0)}] at (conv3-east)
|
||||
{Box={
|
||||
name=conv4,
|
||||
caption= ,
|
||||
xlabel={{384, }},
|
||||
zlabel=13,
|
||||
fill=\ConvColor,
|
||||
height=2.6,
|
||||
width=19.2,
|
||||
depth=2.6
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (conv3-east) -- node {\midarrow} (conv4-west);
|
||||
|
||||
|
||||
\pic[shift={(1,0,0)}] at (conv4-east)
|
||||
{Box={
|
||||
name=conv5,
|
||||
caption= ,
|
||||
xlabel={{256, }},
|
||||
zlabel=13,
|
||||
fill=\ConvColor,
|
||||
height=2.6,
|
||||
width=12.8,
|
||||
depth=2.6
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (conv4-east) -- node {\midarrow} (conv5-west);
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (conv5-east)
|
||||
{Box={
|
||||
name=pool3,
|
||||
caption= ,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=1.2,
|
||||
width=1,
|
||||
depth=1.2
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(1,0,0)}] at (pool3-east)
|
||||
{Box={
|
||||
name=Fc1,
|
||||
caption= ,
|
||||
xlabel={{1, }},
|
||||
zlabel=4096,
|
||||
fill=\FcColor,
|
||||
height=1,
|
||||
width=1,
|
||||
depth=40.96
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (pool3-east) -- node {\midarrow} (Fc1-west);
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (Fc1-east)
|
||||
{Box={
|
||||
name=Fc2,
|
||||
caption= ,
|
||||
xlabel={{1, }},
|
||||
zlabel=4096,
|
||||
fill=\FcColor,
|
||||
height=1,
|
||||
width=1,
|
||||
depth=40.96
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (Fc1-east) -- node {\midarrow} (Fc2-west);
|
||||
|
||||
|
||||
\pic[shift={(3,0,0)}] at (Fc2-east)
|
||||
{Box={
|
||||
name=soft1,
|
||||
caption=SOFT,
|
||||
xlabel={{" ","dummy"}},
|
||||
zlabel=1000,
|
||||
fill=\SoftmaxColor,
|
||||
opacity=0.8,
|
||||
height=3,
|
||||
width=1.5,
|
||||
depth=25
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (Fc2-east) -- node {\midarrow} (soft1-west);
|
||||
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
||||
BIN
thesis/third_party/PlotNeuralNet/examples/AlexNet/alexnet_data.png
vendored
Normal file
BIN
thesis/third_party/PlotNeuralNet/examples/AlexNet/alexnet_data.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
134
thesis/third_party/PlotNeuralNet/examples/HED/HED.tex
vendored
Normal file
134
thesis/third_party/PlotNeuralNet/examples/HED/HED.tex
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
\documentclass[border=15pt, multi, tikz]{standalone}
|
||||
\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\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{tikzpicture}
|
||||
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.6]
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% Draw Layer Blocks
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% conv1_1,conv1_2,%pool1
|
||||
\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}};
|
||||
\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
|
||||
\pic[shift={(1,0,0)}] at (p1-east) {RightBandedBox={name=cr2,%
|
||||
xlabel={{"64","64"}},zlabel=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
|
||||
height=30,width={3,3},depth=30}};
|
||||
\pic[shift={(\poolsep,0,0)}] at (cr2-east) {Box={name=p2,%
|
||||
fill=\PoolColor,opacity=0.5,height=23,width=1,depth=23}};
|
||||
% conv3_1,conv3_2,pool3
|
||||
\pic[shift={(1,0,0)}] at (p2-east) {RightBandedBox={name=cr3,%
|
||||
xlabel={{"256","256","256"}},zlabel=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
|
||||
height=23,width={4,4,4},depth=23}};
|
||||
\pic[shift={(\poolsep,0,0)}] at (cr3-east) {Box={name=p3,%
|
||||
fill=\PoolColor,opacity=0.5,height=14,width=1,depth=14}};
|
||||
% conv4_1,conv4_2,conv4_3,pool4
|
||||
\pic[shift={(1,0,0)}] at (p3-east) {RightBandedBox={name=cr4,%
|
||||
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
|
||||
%% Dcnv16
|
||||
\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)
|
||||
%% score16
|
||||
\pic[shift={(0,0,3+\skipshift)}] at (cr5-anchor) {Box={name=score8,%
|
||||
xlabel={{"K","dummy"}},fill=\ConvColor,height=14,width=2,depth=14,zlabel=I/8}};
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%Joining with previous streams (fcn-8)
|
||||
%% score8
|
||||
\pic[shift={(0,0,8+\skipshift)}] at (cr4-east) {Box={name=score4,%
|
||||
xlabel={{"K","dummy"}},fill=\ConvColor,height=23,width=2,depth=23,zlabel=I/4}};
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%Joining with previous streams (fcn-4)
|
||||
%% score4
|
||||
\pic[shift={(1,0,13+\skipshift)}] at (cr3-east) {Box={name=score2,%
|
||||
xlabel={{"K","dummy"}},fill=\ConvColor,height=30,width=2,depth=30,zlabel=I/2}};
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%Joining with previous streams (fcn-2)
|
||||
%% score2
|
||||
\pic[shift={(0.3,0,22+\skipshift)}] at (p2-east) {Box={name=score,%
|
||||
xlabel={{"K","dummy"}},fill=\ConvColor,height=40,width=2,depth=40,zlabel=I}};
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Final convolution
|
||||
|
||||
\pic[shift={(3,0,0)}] at (d2-east) {Box={name=output,%
|
||||
xlabel={{"K","dummy"}},fill=\ConvColor,height=40,width=2,depth=40,zlabel=I}};
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Draw connections
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\draw [connection] (cr1-east) -- node {\midarrow} (p1-west);
|
||||
\draw [connection] (p1-east) -- node {\midarrow} (cr2-west);
|
||||
\draw [connection] (cr2-east) -- node {\midarrow} (p2-west);
|
||||
\draw [connection] (p2-east) -- node {\midarrow} (cr3-west);
|
||||
\draw [connection] (cr3-east) -- node {\midarrow} (p3-west);
|
||||
\draw [connection] (p3-east) -- node {\midarrow} (cr4-west);
|
||||
\draw [connection] (cr4-east) -- node {\midarrow} (p4-west);
|
||||
\draw [connection] (p4-east) -- node {\midarrow} (cr5-west);
|
||||
\draw [connection] (score16-east) -- node {\midarrow} (d16-west);
|
||||
%
|
||||
\path (cr4-east) -- (p4-west) coordinate[pos=0.4] (after4) ;
|
||||
\draw (d16-near)++(0,0,-1+\skipshift) coordinate (d16h);
|
||||
\draw [connection] (after4) -- node {\midarrow} ++(0,0,3+\skipshift) -- node {\midarrow} (score8-west);
|
||||
\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{document}\grid
|
||||
152
thesis/third_party/PlotNeuralNet/examples/LeNet/lenet.tex
vendored
Normal file
152
thesis/third_party/PlotNeuralNet/examples/LeNet/lenet.tex
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
\documentclass[border=8pt, multi, tikz]{standalone}
|
||||
\usepackage{import}
|
||||
\subimport{../layers/}{init}
|
||||
\usetikzlibrary{positioning}
|
||||
\usetikzlibrary{3d} %for including external image
|
||||
|
||||
|
||||
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
|
||||
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
|
||||
\def\PoolColor{rgb:red,1;black,0.3}
|
||||
\def\UnpoolColor{rgb:blue,2;green,1;black,0.3}
|
||||
\def\FcColor{rgb:blue,5;red,2.5;white,5}
|
||||
\def\FcReluColor{rgb:blue,5;red,5;white,4}
|
||||
\def\SoftmaxColor{rgb:magenta,5;black,7}
|
||||
|
||||
|
||||
\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
|
||||
\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7]
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (0,0,0)
|
||||
{Box={
|
||||
name=conv0,
|
||||
caption= ,
|
||||
xlabel={{1, }},
|
||||
zlabel=32,
|
||||
fill=\ConvColor,
|
||||
height=32,
|
||||
width=1,
|
||||
depth=32
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(1,0,0)}] at (conv0-east)
|
||||
{Box={
|
||||
name=conv1,
|
||||
caption= ,
|
||||
xlabel={{6, }},
|
||||
zlabel=28,
|
||||
fill=\ConvColor,
|
||||
height=28,
|
||||
width=6,
|
||||
depth=28
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (conv0-east) -- node {\midarrow} (conv1-west);
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (conv1-east)
|
||||
{Box={
|
||||
name=pool1,
|
||||
caption= ,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=14,
|
||||
width=6,
|
||||
depth=14
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(1,0,0)}] at (pool1-east)
|
||||
{Box={
|
||||
name=conv2,
|
||||
caption= ,
|
||||
xlabel={{16, }},
|
||||
zlabel=10,
|
||||
fill=\ConvColor,
|
||||
height=10,
|
||||
width=16,
|
||||
depth=10
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (pool1-east) -- node {\midarrow} (conv2-west);
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (conv2-east)
|
||||
{Box={
|
||||
name=pool2,
|
||||
caption= ,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=5,
|
||||
width=16,
|
||||
depth=5
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(1,0,0)}] at (pool2-east)
|
||||
{Box={
|
||||
name=conv3,
|
||||
caption= ,
|
||||
xlabel={{1, }},
|
||||
zlabel=120,
|
||||
fill=\ConvColor,
|
||||
height=1,
|
||||
width=1,
|
||||
depth=120
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (pool2-east) -- node {\midarrow} (conv3-west);
|
||||
|
||||
|
||||
\pic[shift={(2,0,0)}] at (conv3-east)
|
||||
{Box={
|
||||
name=conv4,
|
||||
caption= ,
|
||||
xlabel={{1, }},
|
||||
zlabel=84,
|
||||
fill=\ConvColor,
|
||||
height=1,
|
||||
width=1,
|
||||
depth=84
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (conv3-east) -- node {\midarrow} (conv4-west);
|
||||
|
||||
|
||||
\pic[shift={(3,0,0)}] at (conv4-east)
|
||||
{Box={
|
||||
name=soft1,
|
||||
caption=SOFT,
|
||||
xlabel={{" ","dummy"}},
|
||||
zlabel=10,
|
||||
fill=\SoftmaxColor,
|
||||
opacity=0.8,
|
||||
height=3,
|
||||
width=1.5,
|
||||
depth=25
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (conv4-east) -- node {\midarrow} (soft1-west);
|
||||
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
||||
8
thesis/third_party/PlotNeuralNet/examples/LeNet/lenet.txt
vendored
Normal file
8
thesis/third_party/PlotNeuralNet/examples/LeNet/lenet.txt
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
input(32, 32, 1)
|
||||
conv(28, 28, 6)
|
||||
pool(14, 14, 6)
|
||||
conv(10, 10, 16)
|
||||
pool(5, 5, 16)
|
||||
conv(1,1,120)
|
||||
fullyconn(1,1,84)
|
||||
softmax(1,1,10)
|
||||
BIN
thesis/third_party/PlotNeuralNet/examples/LeNet/lenet_data2.png
vendored
Normal file
BIN
thesis/third_party/PlotNeuralNet/examples/LeNet/lenet_data2.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
47
thesis/third_party/PlotNeuralNet/examples/SoftmaxLoss/SoftmaxLoss.tex
vendored
Normal file
47
thesis/third_party/PlotNeuralNet/examples/SoftmaxLoss/SoftmaxLoss.tex
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
\documentclass[border=15pt, multi, tikz]{standalone}
|
||||
\usepackage{import}
|
||||
\subimport{../../layers/}{init}
|
||||
\usetikzlibrary{positioning}
|
||||
|
||||
\newcommand{\up}{0.25}
|
||||
\newcommand{\down}{0.25}
|
||||
\newcommand{\arrowlength}{4}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% Draw previous connections
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\draw [connection] (-\arrowlength,\up,0)
|
||||
node[anchor=south west,scale=2.1]{$p(x^{(t)})$}
|
||||
-- node {\midarrow} (0,\up,0);
|
||||
\draw [connection] (0,-\down,0) -- node {\midarrow} ++(-\arrowlength.0,0)
|
||||
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}$
|
||||
};
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% 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]
|
||||
{
|
||||
$\frac{\partial L}{\partial E_\mathcal{S}} = \lambda_\mathcal{S}$
|
||||
}
|
||||
-- node {\midarrow} ++(-\arrowlength,0,0);
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
||||
164
thesis/third_party/PlotNeuralNet/examples/Unet/Unet.tex
vendored
Normal file
164
thesis/third_party/PlotNeuralNet/examples/Unet/Unet.tex
vendored
Normal 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}
|
||||
151
thesis/third_party/PlotNeuralNet/examples/Unet_Ushape/Unet_ushape.tex
vendored
Normal file
151
thesis/third_party/PlotNeuralNet/examples/Unet_Ushape/Unet_ushape.tex
vendored
Normal 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}
|
||||
105
thesis/third_party/PlotNeuralNet/examples/VGG16/vgg16.tex
vendored
Normal file
105
thesis/third_party/PlotNeuralNet/examples/VGG16/vgg16.tex
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
\documentclass[border=15pt, 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\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{tikzpicture}
|
||||
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% Draw Layer Blocks
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% conv1_1,conv1_2
|
||||
\pic[shift={(0,0,0)}] at (0,0,0) {RightBandedBox={name=cr1,caption=conv1,%
|
||||
xlabel={{"64","64"}},ylabel=224,zlabel=224,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=35,width=1,depth=35}};
|
||||
%%%%%%%%%%
|
||||
% conv2_1,conv2_2
|
||||
\pic[shift={(2,0,0)}] at (p1-east) {RightBandedBox={name=cr2,caption=conv2,%
|
||||
xlabel={{"128","128"}},zlabel=112,fill=\ConvColor,bandfill=\ConvReluColor,%
|
||||
height=35,width={3,3},depth=35}};
|
||||
%pool2
|
||||
\pic[shift={(0,0,0)}] at (cr2-east) {Box={name=p2,%
|
||||
fill=\PoolColor,opacity=0.5,height=30,width=1,depth=30}};
|
||||
%%%%%%%%%%
|
||||
% conv3_1,conv3_2
|
||||
\pic[shift={(2,0,0)}] at (p2-east) {RightBandedBox={name=cr3,caption=conv3,%
|
||||
xlabel={{"256","256","256"}},zlabel=56,fill=\ConvColor,bandfill=\ConvReluColor,%
|
||||
height=30,width={4,4,4},depth=30}};
|
||||
%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}};
|
||||
|
||||
%%%%%%%%%%
|
||||
% softmax
|
||||
\pic[shift={(0,0,0)}] at (fc8-east) {Box={name=softmax,%
|
||||
xlabel={{"","dummy"}},zlabel=K,opacity=0.8,fill=\SoftmaxColor,%
|
||||
height=3,width=1.5,depth=25}};
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% 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{document}
|
||||
101
thesis/third_party/PlotNeuralNet/examples/fcn32s/fcn32.tex
vendored
Normal file
101
thesis/third_party/PlotNeuralNet/examples/fcn32s/fcn32.tex
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
\documentclass[border=15pt, multi, tikz]{standalone}
|
||||
\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\DcnvColor{rgb:blue,5;green,2.5;white,5}
|
||||
\def\SoftmaxColor{rgb:magenta,5;black,7}
|
||||
|
||||
\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
|
||||
\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}};
|
||||
%pool1
|
||||
\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
|
||||
\pic[shift={(2,0,0)}] at (p1-east) {RightBandedBox={name=cr2,caption=conv2,%
|
||||
xlabel={{"64","64"}},zlabel=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
|
||||
height=35,width={3,3},depth=35}};
|
||||
%pool2
|
||||
\pic[shift={(0,0,0)}] at (cr2-east) {Box={name=p2,%
|
||||
fill=\PoolColor,opacity=0.5,height=30,width=1,depth=30}};
|
||||
%%%%%%%%%%
|
||||
% conv3_1,conv3_2
|
||||
\pic[shift={(2,0,0)}] at (p2-east) {RightBandedBox={name=cr3,caption=conv3,%
|
||||
xlabel={{"256","256","256"}},zlabel=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
|
||||
height=30,width={4,4,4},depth=30}};
|
||||
%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
|
||||
|
||||
\pic[shift={(1,0,0)}] at (cr6_7-east) {Box={name=c8,caption=fc8 to conv,%
|
||||
xlabel={{"K","dummy"}},fill=\ConvColor,%
|
||||
height=10,width=2,depth=10,zlabel=I/32}};
|
||||
%%%%%%%%%%
|
||||
%% 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 [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} (cr6_7-west);
|
||||
\draw [connection] (cr6_7-east) -- node {\midarrow} (c8-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{document}\grid
|
||||
BIN
thesis/third_party/PlotNeuralNet/examples/fcn8s/cats.jpg
vendored
Normal file
BIN
thesis/third_party/PlotNeuralNet/examples/fcn8s/cats.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
127
thesis/third_party/PlotNeuralNet/examples/fcn8s/fcn8.tex
vendored
Normal file
127
thesis/third_party/PlotNeuralNet/examples/fcn8s/fcn8.tex
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
\documentclass[border=15pt, multi, tikz]{standalone}
|
||||
\usepackage{import}
|
||||
\subimport{../../layers/}{init}
|
||||
\usetikzlibrary{positioning}
|
||||
\usetikzlibrary{3d} %for including external image
|
||||
|
||||
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
|
||||
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
|
||||
\def\PoolColor{rgb:red,1;black,0.3}
|
||||
\def\DcnvColor{rgb:blue,5;green,2.5;white,5}
|
||||
\def\SoftmaxColor{rgb:magenta,5;black,7}
|
||||
\def\SumColor{rgb:blue,5;green,15}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% Draw Layer Blocks
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\node[canvas is zy plane at x=0] (temp) at (-3,0,0) {\includegraphics[width=8cm,height=8cm]{cats.jpg}};
|
||||
% conv1_1,conv1_2,%pool1
|
||||
\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
|
||||
\pic[shift={(2,0,0)}] at (p1-east) {RightBandedBox={name=cr2,caption=conv2,%
|
||||
xlabel={{"64","64"}},zlabel=I/2,fill=\ConvColor,bandfill=\ConvReluColor,%
|
||||
height=35,width={3,3},depth=35}};
|
||||
\pic[shift={(0,0,0)}] at (cr2-east) {Box={name=p2,%
|
||||
fill=\PoolColor,opacity=0.5,height=30,width=1,depth=30}};
|
||||
% conv3_1,conv3_2,pool3
|
||||
\pic[shift={(2,0,0)}] at (p2-east) {RightBandedBox={name=cr3,caption=conv3,%
|
||||
xlabel={{"256","256","256"}},zlabel=I/4,fill=\ConvColor,bandfill=\ConvReluColor,%
|
||||
height=30,width={4,4,4},depth=30}};
|
||||
\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,pool4
|
||||
\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}};
|
||||
\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,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-16s)
|
||||
%% Upsampling Deconv Layer
|
||||
%% Dcnv32
|
||||
\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
|
||||
\pic[shift={(0,-4,0)}] at (d32-west) {Box={name=score16,%
|
||||
xlabel={{"K","dummy"}},fill=\ConvColor,%
|
||||
height=15,width=2,depth=15,zlabel=I/16}};
|
||||
%% Elementwise sum between score16 and up32
|
||||
\pic[shift={(1.5,0,0)}] at (d32-east) {Ball={name=elt1,%
|
||||
fill=\SumColor,opacity=0.6,%
|
||||
radius=2.5,logo=$+$}};
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%Joining with previous streams (fcn-8s)
|
||||
%% Upsampling Deconv Layer
|
||||
%% Dcnv16
|
||||
\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
|
||||
\pic[shift={(0,-6,0)}] at (d16-west) {Box={name=score8,%
|
||||
xlabel={{"K","dummy"}},fill=\ConvColor,%
|
||||
height=23,width=2,depth=23,zlabel=I/8}};
|
||||
%% Elementwise sum between score16 and up32
|
||||
\pic[shift={(1.5,0,0)}] at (d16-east) {Ball={name=elt2,%
|
||||
fill=\SumColor,opacity=0.6,%
|
||||
radius=2.5,logo=$+$}};
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Output
|
||||
%%%%%%%%%%
|
||||
%% 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 [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} (cr6_7-west);
|
||||
\draw [connection] (cr6_7-east) -- node {\midarrow} (score32-west);
|
||||
\draw [connection] (score32-east) -- node {\midarrow} (d32-west);
|
||||
|
||||
\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] (d32-east) -- node {\midarrow} (elt1-west);
|
||||
\draw [connection] (score16-east) -- node {\midarrow} (score16-east -| elt1-south) -- node {\midarrow} (elt1-south);
|
||||
\draw [connection] (elt1-east) -- node {\midarrow} (d16-west);
|
||||
|
||||
\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] (d16-east) -- node {\midarrow} (elt2-west);
|
||||
\draw [connection] (score8-east) -- node {\midarrow} (score8-east -| elt2-south)-- node {\midarrow} (elt2-south);
|
||||
\draw [connection] (elt2-east) -- node {\midarrow} (d8-west);
|
||||
\draw [connection] (d8-east) -- node{\midarrow} (softmax-west);
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{document}\grid
|
||||
40
thesis/third_party/PlotNeuralNet/layers/Ball.sty
vendored
Normal file
40
thesis/third_party/PlotNeuralNet/layers/Ball.sty
vendored
Normal 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
thesis/third_party/PlotNeuralNet/layers/Box.sty
vendored
Normal file
110
thesis/third_party/PlotNeuralNet/layers/Box.sty
vendored
Normal 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.2,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=,
|
||||
}
|
||||
130
thesis/third_party/PlotNeuralNet/layers/RightBandedBox.sty
vendored
Normal file
130
thesis/third_party/PlotNeuralNet/layers/RightBandedBox.sty
vendored
Normal 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=,
|
||||
}
|
||||
11
thesis/third_party/PlotNeuralNet/layers/init.tex
vendored
Normal file
11
thesis/third_party/PlotNeuralNet/layers/init.tex
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
%\ProvidesPackage{init}
|
||||
\usetikzlibrary{quotes,arrows.meta}
|
||||
\usetikzlibrary{positioning}
|
||||
|
||||
\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);}
|
||||
|
||||
\usepackage{Ball}
|
||||
\usepackage{Box}
|
||||
\usepackage{RightBandedBox}
|
||||
|
||||
39
thesis/third_party/PlotNeuralNet/my_project/my_arch.py
vendored
Normal file
39
thesis/third_party/PlotNeuralNet/my_project/my_arch.py
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
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()
|
||||
104
thesis/third_party/PlotNeuralNet/my_project/my_arch.tex
vendored
Normal file
104
thesis/third_party/PlotNeuralNet/my_project/my_arch.tex
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
|
||||
\documentclass[border=8pt, multi, tikz]{standalone}
|
||||
\usepackage{import}
|
||||
\subimport{../layers/}{init}
|
||||
\usetikzlibrary{positioning}
|
||||
\usetikzlibrary{3d} %for including external image
|
||||
|
||||
|
||||
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
|
||||
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
|
||||
\def\PoolColor{rgb:red,1;black,0.3}
|
||||
\def\UnpoolColor{rgb:blue,2;green,1;black,0.3}
|
||||
\def\FcColor{rgb:blue,5;red,2.5;white,5}
|
||||
\def\FcReluColor{rgb:blue,5;red,5;white,4}
|
||||
\def\SoftmaxColor{rgb:magenta,5;black,7}
|
||||
\def\SumColor{rgb:blue,5;green,15}
|
||||
|
||||
|
||||
\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
|
||||
\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7]
|
||||
|
||||
|
||||
\pic[shift={(0,0,0)}] at (0,0,0)
|
||||
{Box={
|
||||
name=conv1,
|
||||
caption= ,
|
||||
xlabel={{64, }},
|
||||
zlabel=512,
|
||||
fill=\ConvColor,
|
||||
height=64,
|
||||
width=2,
|
||||
depth=64
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (conv1-east)
|
||||
{Box={
|
||||
name=pool1,
|
||||
caption= ,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=32,
|
||||
width=1,
|
||||
depth=32
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(1,0,0)}] at (pool1-east)
|
||||
{Box={
|
||||
name=conv2,
|
||||
caption= ,
|
||||
xlabel={{64, }},
|
||||
zlabel=128,
|
||||
fill=\ConvColor,
|
||||
height=32,
|
||||
width=2,
|
||||
depth=32
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (pool1-east) -- node {\midarrow} (conv2-west);
|
||||
|
||||
|
||||
\pic[shift={ (0,0,0) }] at (conv2-east)
|
||||
{Box={
|
||||
name=pool2,
|
||||
caption= ,
|
||||
fill=\PoolColor,
|
||||
opacity=0.5,
|
||||
height=28,
|
||||
width=1,
|
||||
depth=28
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\pic[shift={(3,0,0)}] at (pool1-east)
|
||||
{Box={
|
||||
name=soft1,
|
||||
caption=SOFT,
|
||||
xlabel={{" ","dummy"}},
|
||||
zlabel=10,
|
||||
fill=\SoftmaxColor,
|
||||
opacity=0.8,
|
||||
height=3,
|
||||
width=1.5,
|
||||
depth=25
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
\draw [connection] (pool2-east) -- node {\midarrow} (soft1-west);
|
||||
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
||||
|
||||
0
thesis/third_party/PlotNeuralNet/pycore/__init__.py
vendored
Normal file
0
thesis/third_party/PlotNeuralNet/pycore/__init__.py
vendored
Normal file
BIN
thesis/third_party/PlotNeuralNet/pycore/__init__.pyc
vendored
Normal file
BIN
thesis/third_party/PlotNeuralNet/pycore/__init__.pyc
vendored
Normal file
Binary file not shown.
75
thesis/third_party/PlotNeuralNet/pycore/blocks.py
vendored
Normal file
75
thesis/third_party/PlotNeuralNet/pycore/blocks.py
vendored
Normal 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
|
||||
|
||||
|
||||
533
thesis/third_party/PlotNeuralNet/pycore/tikzeng.py
vendored
Normal file
533
thesis/third_party/PlotNeuralNet/pycore/tikzeng.py
vendored
Normal file
@@ -0,0 +1,533 @@
|
||||
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\SumColor{rgb:blue,5;green,15}
|
||||
"""
|
||||
|
||||
|
||||
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_Sum(name, offset="(0,0,0)", to="(0,0,0)", radius=2.5, opacity=0.6):
|
||||
return (
|
||||
r"""
|
||||
\pic[shift={"""
|
||||
+ offset
|
||||
+ """}] at """
|
||||
+ to
|
||||
+ """
|
||||
{Ball={
|
||||
name="""
|
||||
+ name
|
||||
+ """,
|
||||
fill=\SumColor,
|
||||
opacity="""
|
||||
+ str(opacity)
|
||||
+ """,
|
||||
radius="""
|
||||
+ str(radius)
|
||||
+ """,
|
||||
logo=$+$
|
||||
}
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def to_fc(
|
||||
name,
|
||||
n_filer=120,
|
||||
offset="(0,0,0)",
|
||||
to="(0,0,0)",
|
||||
width=2,
|
||||
height=2,
|
||||
depth=10,
|
||||
caption=" ",
|
||||
# titlepos=0,
|
||||
):
|
||||
return (
|
||||
r"""
|
||||
\pic[shift={"""
|
||||
+ offset
|
||||
+ """}] at """
|
||||
+ to
|
||||
+ """
|
||||
{Box={
|
||||
name="""
|
||||
+ name
|
||||
+ """,
|
||||
caption="""
|
||||
+ caption
|
||||
+ """,
|
||||
xlabel={{" ","dummy"}},
|
||||
zlabel="""
|
||||
+ str(n_filer)
|
||||
+ """,
|
||||
fill=\FcColor,
|
||||
opacity=0.8,
|
||||
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)
|
||||
BIN
thesis/third_party/PlotNeuralNet/pycore/tikzeng.pyc
vendored
Normal file
BIN
thesis/third_party/PlotNeuralNet/pycore/tikzeng.pyc
vendored
Normal file
Binary file not shown.
28
thesis/third_party/PlotNeuralNet/pyexamples/test_simple.py
vendored
Normal file
28
thesis/third_party/PlotNeuralNet/pyexamples/test_simple.py
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
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_Sum("sum1", offset="(1.5,0,0)", to="(soft1-east)", radius=2.5, opacity=0.6),
|
||||
to_connection("soft1", "sum1"),
|
||||
to_end()
|
||||
]
|
||||
|
||||
def main():
|
||||
namefile = str(sys.argv[0]).split('.')[0]
|
||||
to_generate(arch, namefile + '.tex' )
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
52
thesis/third_party/PlotNeuralNet/pyexamples/unet.py
vendored
Normal file
52
thesis/third_party/PlotNeuralNet/pyexamples/unet.py
vendored
Normal 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()
|
||||
|
||||
14
thesis/third_party/PlotNeuralNet/tikzmake.sh
vendored
Normal file
14
thesis/third_party/PlotNeuralNet/tikzmake.sh
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
python $1.py
|
||||
pdflatex $1.tex
|
||||
|
||||
rm *.aux *.log *.vscodeLog
|
||||
rm *.tex
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
open $1.pdf
|
||||
else
|
||||
xdg-open $1.pdf
|
||||
fi
|
||||
Reference in New Issue
Block a user