diff --git a/.gitea/workflows/xelatex.yaml b/.gitea/workflows/xelatex.yaml new file mode 100644 index 0000000..f4f06d2 --- /dev/null +++ b/.gitea/workflows/xelatex.yaml @@ -0,0 +1,44 @@ +name: Compile PDF +run-name: ${{ gitea.actor }} is compiling a PDF 🚀 +on: [push] + +jobs: + Compile-PDF: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" + - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ gitea.workspace }} + - name: Compile LaTeX document + uses: xu-cheng/latex-action@v2 + with: + root_file: cv.tex + latexmk_use_xelatex: true + - name: List files in the repository + run: | + ls ${{ gitea.workspace }} + - name: Archive artifacs + uses: christopherhx/gitea-upload-artifact@v4 + with: + name: thesis + path: thesis.pdf + - name: Upload to S3 + uses: bxb100/action-upload@main + with: + provider: s3 + provider_options: | + root=/ + region=${{ secrets.S3REGION }} + bucket=${{ secrets.S3BUCKET }} + endpoint=${{ secrets.S3ENDPOINT }} + access_key_id=${{ secrets.S3ACCESSKEY }} + secret_access_key=${{ secrets.S3ACCESSSECRET }} + include: '*.pdf' + - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/.gitignore b/.gitignore index d3b433e..5dbf556 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,308 @@ +## Core latex/pdflatex auxiliary files: +*.pdf *.aux -*.fdb_latexmk -*.fls +*.lof *.log -*.synctex.gz +*.lot +*.fls +*.out +*.toc +*.fmt +*.fot +*.cb +*.cb2 +.*.lb + +## Intermediate documents: +*.dvi +*.xdv +*-converted-to.* +# these rules might exclude image files for figures etc. +# *.ps +# *.eps +# *.pdf + +## Generated if empty string is given at "Please type another file name for output:" +.pdf + +## Bibliography auxiliary files (bibtex/biblatex/biber): *.bbl +*.bbl-SAVE-ERROR *.bcf *.blg -*.thm +*-blx.aux +*-blx.bib *.run.xml -*.toc -*.xdv -thesis.pdf + +## Build tool auxiliary files: +*.fdb_latexmk +*.synctex +*.synctex(busy) +*.synctex.gz +*.synctex.gz(busy) +*.pdfsync +*.rubbercache +rubber.cache + +## Build tool directories for auxiliary files +# latexrun +latex.out/ + +## Auxiliary and intermediate files from other packages: +# algorithms +*.alg +*.loa + +# achemso +acs-*.bib + +# amsthm +*.thm + +# beamer +*.nav +*.pre +*.snm +*.vrb + +# changes +*.soc + +# comment +*.cut + +# cprotect +*.cpt + +# elsarticle (documentclass of Elsevier journals) +*.spl + +# endnotes +*.ent + +# fixme +*.lox + +# feynmf/feynmp +*.mf +*.mp +*.t[1-9] +*.t[1-9][0-9] +*.tfm + +#(r)(e)ledmac/(r)(e)ledpar +*.end +*.?end +*.[1-9] +*.[1-9][0-9] +*.[1-9][0-9][0-9] +*.[1-9]R +*.[1-9][0-9]R +*.[1-9][0-9][0-9]R +*.eledsec[1-9] +*.eledsec[1-9]R +*.eledsec[1-9][0-9] +*.eledsec[1-9][0-9]R +*.eledsec[1-9][0-9][0-9] +*.eledsec[1-9][0-9][0-9]R + +# glossaries +*.acn +*.acr +*.glg +*.glo +*.gls +*.glsdefs +*.lzo +*.lzs +*.slg +*.slo +*.sls + +# uncomment this for glossaries-extra (will ignore makeindex's style files!) +# *.ist + +# gnuplot +*.gnuplot +*.table + +# gnuplottex +*-gnuplottex-* + +# gregoriotex +*.gaux +*.glog +*.gtex + +# htlatex +*.4ct +*.4tc +*.idv +*.lg +*.trc +*.xref + +# hypdoc +*.hd + +# hyperref +*.brf + +# knitr +*-concordance.tex +# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files +# *.tikz +*-tikzDictionary + +# listings +*.lol + +# luatexja-ruby +*.ltjruby + +# makeidx +*.idx +*.ilg +*.ind + +# minitoc +*.maf +*.mlf +*.mlt +*.mtc[0-9]* +*.slf[0-9]* +*.slt[0-9]* +*.stc[0-9]* + +# minted +_minted* +*.pyg + +# morewrites +*.mw + +# newpax +*.newpax + +# nomencl +*.nlg +*.nlo +*.nls + +# pax +*.pax + +# pdfpcnotes +*.pdfpc + +# sagetex +*.sagetex.sage +*.sagetex.py +*.sagetex.scmd + +# scrwfile +*.wrt + +# svg +svg-inkscape/ + +# sympy +*.sout +*.sympy +sympy-plots-for-*.tex/ + +# pdfcomment +*.upa +*.upb + +# pythontex +*.pytxcode +pythontex-files-*/ + +# tcolorbox +*.listing + +# thmtools +*.loe + +# TikZ & PGF +*.dpth +*.md5 +*.auxlock + +# titletoc +*.ptc + +# todonotes +*.tdo + +# vhistory +*.hst +*.ver + +# easy-todo +*.lod + +# xcolor +*.xcp + +# xmpincl +*.xmpi + +# xindy +*.xdy + +# xypic precompiled matrices and outlines +*.xyc +*.xyd + +# endfloat +*.ttt +*.fff + +# Latexian +TSWLatexianTemp* + +## Editors: +# WinEdt +*.bak +*.sav + +# Texpad +.texpadtmp + +# LyX +*.lyx~ + +# Kile +*.backup + +# gummi +.*.swp + +# KBibTeX +*~[0-9]* + +# TeXnicCenter +*.tps + +# auto folder when using emacs and auctex +./auto/* +*.el + +# expex forward references with \gathertags +*-tags.tex + +# standalone packages +*.sta + +# Makeindex log files +*.lpz + +# xwatermark package +*.xwm + +# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib +# option is specified. Footnotes are the stored in a file with suffix Notes.bib. +# Uncomment the next line to have this generated file ignored. +#*Notes.bib diff --git a/thesis.tex b/thesis.tex index ba206dc..6af6f73 100644 --- a/thesis.tex +++ b/thesis.tex @@ -1,3 +1,5 @@ +% !TeX root = thesis.tex +% !TeX program = xelatex \documentclass[a4paper,11pt,twoside]{thesis} \usepackage[british]{babel} @@ -110,13 +112,13 @@ %---- ABSTRACT \begin{abstractpage} -\input{sec/abstract.tex} + \input{sec/abstract.tex} \end{abstractpage} \cleardoubleplainpage{} %---- ACKNOWLEDGENTS \begin{acknowledgmentspage} -\input{sec/acknowledgments.tex} + \input{sec/acknowledgments.tex} \end{acknowledgmentspage} \cleardoubleplainpage{} diff --git a/tikz/ccnn.pgf b/tikz/ccnn.pgf index fe6ab5d..df35322 100644 --- a/tikz/ccnn.pgf +++ b/tikz/ccnn.pgf @@ -2,13 +2,13 @@ \newlength{\layerheight} \newlength{\perspective} \newlength{\filters} -%\newlength{\unit} +%\newlength{\myunit} \setlength{\layer}{3cm} \setlength{\layerheight}{3cm} \setlength{\perspective}{1cm} \setlength{\filters}{0.01cm} -\setlength{\unit}{0.225cm} +\setlength{\myunit}{0.225cm} \begin{tikzpicture} @@ -50,13 +50,13 @@ % flatten layer \foreach \x in {2,...,7} { - \filldraw[fill=cyan!10, draw=black] (4 * \layer + 3cm, 0.5cm * \x) circle (\unit); - \draw (4 * \layer + 3cm + \unit, 0.5cm * \x) -- (5 * \layer + 2cm - \unit, 2.5cm); + \filldraw[fill=cyan!10, draw=black] (4 * \layer + 3cm, 0.5cm * \x) circle (\myunit); + \draw (4 * \layer + 3cm + \myunit, 0.5cm * \x) -- (5 * \layer + 2cm - \myunit, 2.5cm); }; \node[anchor=north, scale=0.5, below=15pt, align=center] at (4 * \layer + 3cm, 1cm) {flatten}; % output layer -\filldraw[fill=cyan!10, draw=black] (5 * \layer + 2cm, 2.5cm - \unit) -- (5 * \layer + 2cm, 2.5cm) circle (\unit) -- (5 * \layer + 2cm, 2.5cm + \unit); +\filldraw[fill=cyan!10, draw=black] (5 * \layer + 2cm, 2.5cm - \myunit) -- (5 * \layer + 2cm, 2.5cm) circle (\myunit) -- (5 * \layer + 2cm, 2.5cm + \myunit); \draw (5 * \layer + 2cm + 0.05cm, 2.5cm) node[anchor=north, below=10pt, text width=2cm, scale=0.35, align=center] {output layer [1 unit]} -- (5 * \layer + 2cm + 0.10cm, 2.5cm) -- (5 * \layer + 2cm + 0.15cm, 2.5cm + 0.05cm); % draw first convolution @@ -81,16 +81,16 @@ \filldraw[fill=red!50, draw=black, fill opacity=0.5] (3 * \layer + 40 * \filters + 0.4 * \perspective, 0.6 * \layerheight + 0.4 * \perspective) -- (4 * \layer, 0.3 * \layerheight) -- (3 * \layer + 40 * \filters, 0.6 * \layerheight) -- cycle; % draw the "flatenisation" -\draw[dashed] (4 * \layer + 20 * \filters, \layerheight) -- (4 * \layer + 3 cm, 3.5cm + \unit) -- (4 * \layer + 20 * \filters + \perspective, \layerheight + \perspective) -- cycle; -\draw[dashed] (4 * \layer + 20 * \filters, 0cm) -- (4 * \layer + 3 cm, 1cm - \unit) -- (4 * \layer + 20 * \filters + \perspective, \perspective) -- cycle; +\draw[dashed] (4 * \layer + 20 * \filters, \layerheight) -- (4 * \layer + 3 cm, 3.5cm + \myunit) -- (4 * \layer + 20 * \filters + \perspective, \layerheight + \perspective) -- cycle; +\draw[dashed] (4 * \layer + 20 * \filters, 0cm) -- (4 * \layer + 3 cm, 1cm - \myunit) -- (4 * \layer + 20 * \filters + \perspective, \perspective) -- cycle; % hidden layer labels \node[anchor=base, align=center, text width=3.9cm, scale=0.75] (c) at (11cm, 5.5cm) {convolutional layers ($5 \times 5$ kernel, ReLU activation)}; -\draw[->] (c) -- (\layer + 180 * \filters + \perspective, \layerheight + \perspective + \unit); -\draw[->] (c) -- (2 * \layer + 100 * \filters + \perspective, \layerheight + \perspective + \unit); -\draw[->] (c) -- (3 * \layer + 40 * \filters + \perspective, \layerheight + \perspective + \unit); -\draw[->] (c) -- (4 * \layer + 0.5 * \perspective, \layerheight + \perspective + \unit); +\draw[->] (c) -- (\layer + 180 * \filters + \perspective, \layerheight + \perspective + \myunit); +\draw[->] (c) -- (2 * \layer + 100 * \filters + \perspective, \layerheight + \perspective + \myunit); +\draw[->] (c) -- (3 * \layer + 40 * \filters + \perspective, \layerheight + \perspective + \myunit); +\draw[->] (c) -- (4 * \layer + 0.5 * \perspective, \layerheight + \perspective + \myunit); \end{tikzpicture} -% vim: ft=texft=texft=texft=texft=texx \ No newline at end of file +% vim: ft=texft=texft=texft=texft=texx diff --git a/tikz/fc.pgf b/tikz/fc.pgf index e728d86..9fcbe95 100644 --- a/tikz/fc.pgf +++ b/tikz/fc.pgf @@ -1,160 +1,160 @@ -\newlength{\unit} +\newlength{\myunit} \newlength{\layer} -\setlength{\unit}{0.225cm} +\setlength{\myunit}{0.225cm} \setlength{\layer}{1cm} \begin{tikzpicture} % draw the first layer -\filldraw[fill=cyan!10, draw=black] (\layer, -0.75cm - \unit) -- (\layer, -0.75cm) circle (\unit) -- (\layer, -0.75cm + \unit); +\filldraw[fill=cyan!10, draw=black] (\layer, -0.75cm - \myunit) -- (\layer, -0.75cm) circle (\myunit) -- (\layer, -0.75cm + \myunit); \draw (\layer + 0.05cm, -0.75cm) node[anchor=north, below=10pt, text width=2cm, scale=0.35, align=center] {FC layer [876 units]} -- (\layer + 0.10cm, -0.75cm) -- (\layer + 0.15cm, -0.75cm + 0.05cm); -\node[anchor=base, scale=0.35] at (\layer, -0.75cm + 1.25 * \unit) {$\vdots$}; +\node[anchor=base, scale=0.35] at (\layer, -0.75cm + 1.25 * \myunit) {$\vdots$}; \foreach \x in {0,...,5} { - \filldraw[fill=cyan!10, draw=black] (\layer, 0.5cm * \x - \unit) -- (\layer, 0.5cm * \x) circle (\unit) -- (\layer, 0.5cm * \x + \unit); + \filldraw[fill=cyan!10, draw=black] (\layer, 0.5cm * \x - \myunit) -- (\layer, 0.5cm * \x) circle (\myunit) -- (\layer, 0.5cm * \x + \myunit); \draw (\layer + 0.05cm, 0.5cm * \x) -- (\layer + 0.10cm, 0.5cm * \x) -- (\layer + 0.15cm, 0.5cm * \x + 0.05cm); }; -\filldraw[fill=cyan!10, draw=black] (\layer, 3.25cm - \unit) -- (\layer, 3.25cm) circle (\unit) -- (\layer, 3.25cm + \unit); +\filldraw[fill=cyan!10, draw=black] (\layer, 3.25cm - \myunit) -- (\layer, 3.25cm) circle (\myunit) -- (\layer, 3.25cm + \myunit); \draw (\layer + 0.05cm, 3.25cm) -- (\layer + 0.10cm, 3.25cm) -- (\layer + 0.15cm, 3.25cm + 0.05cm); -\node[anchor=base, scale=0.35] at (\layer, 3.25cm - 2\unit) {$\vdots$}; +\node[anchor=base, scale=0.35] at (\layer, 3.25cm - 2\myunit) {$\vdots$}; % draw the second layer -\filldraw[fill=cyan!10, draw=black] (2 * \layer, -\unit) -- (2 * \layer, 0cm) circle (\unit) -- (2 * \layer, \unit); +\filldraw[fill=cyan!10, draw=black] (2 * \layer, -\myunit) -- (2 * \layer, 0cm) circle (\myunit) -- (2 * \layer, \myunit); \draw (2 * \layer + 0.05cm, 0cm) node[anchor=north, below=10pt, text width=2cm, scale=0.35, align=center] {FC layer [461 units]} -- (2 * \layer + 0.10cm, 0cm) -- (2 * \layer + 0.15cm, 0.05cm); -\node[anchor=base, scale=0.35] at (2 * \layer, 1.25 * \unit) {$\vdots$}; +\node[anchor=base, scale=0.35] at (2 * \layer, 1.25 * \myunit) {$\vdots$}; \foreach \x in {1.5,...,3.5} { - \filldraw[fill=cyan!10, draw=black] (2 * \layer, 0.5cm * \x - \unit) -- (2 * \layer, 0.5cm * \x) circle (\unit) -- (2 * \layer, 0.5cm * \x + \unit); + \filldraw[fill=cyan!10, draw=black] (2 * \layer, 0.5cm * \x - \myunit) -- (2 * \layer, 0.5cm * \x) circle (\myunit) -- (2 * \layer, 0.5cm * \x + \myunit); \draw (2 * \layer + 0.05cm, 0.5cm * \x) -- (2 * \layer + 0.10cm, 0.5cm * \x) -- (2 * \layer + 0.15cm, 0.5cm * \x + 0.05cm); }; -\filldraw[fill=cyan!10, draw=black] (2 * \layer, 2.5cm - \unit) -- (2 * \layer, 2.5cm) circle (\unit) -- (2 * \layer, 2.5cm + \unit); +\filldraw[fill=cyan!10, draw=black] (2 * \layer, 2.5cm - \myunit) -- (2 * \layer, 2.5cm) circle (\myunit) -- (2 * \layer, 2.5cm + \myunit); \draw (2 * \layer + 0.05cm, 2.5cm) -- (2 * \layer + 0.10cm, 2.5cm) -- (2 * \layer + 0.15cm, 2.5cm + 0.05cm); -\node[anchor=base, scale=0.35] at (2 * \layer, 2.5cm - 2\unit) {$\vdots$}; +\node[anchor=base, scale=0.35] at (2 * \layer, 2.5cm - 2\myunit) {$\vdots$}; % draw the third layer -\filldraw[fill=cyan!10, draw=black] (3 * \layer, -\unit) -- (3 * \layer, 0cm) circle (\unit) -- (3 * \layer, \unit); +\filldraw[fill=cyan!10, draw=black] (3 * \layer, -\myunit) -- (3 * \layer, 0cm) circle (\myunit) -- (3 * \layer, \myunit); \draw (3 * \layer + 0.05cm, 0cm) node[anchor=north, below=10pt, text width=2cm, scale=0.35, align=center] {FC layer [437 units]} -- (3 * \layer + 0.10cm, 0cm) -- (3 * \layer + 0.15cm, 0.05cm); -\node[anchor=base, scale=0.35] at (3 * \layer, 1.25 * \unit) {$\vdots$}; +\node[anchor=base, scale=0.35] at (3 * \layer, 1.25 * \myunit) {$\vdots$}; \foreach \x in {1.5,...,3.5} { - \filldraw[fill=cyan!10, draw=black] (3 * \layer, 0.5cm * \x - \unit) -- (3 * \layer, 0.5cm * \x) circle (\unit) -- (3 * \layer, 0.5cm * \x + \unit); + \filldraw[fill=cyan!10, draw=black] (3 * \layer, 0.5cm * \x - \myunit) -- (3 * \layer, 0.5cm * \x) circle (\myunit) -- (3 * \layer, 0.5cm * \x + \myunit); \draw (3 * \layer + 0.05cm, 0.5cm * \x) -- (3 * \layer + 0.10cm, 0.5cm * \x) -- (3 * \layer + 0.15cm, 0.5cm * \x + 0.05cm); }; -\filldraw[fill=cyan!10, draw=black] (3 * \layer, 2.5cm - \unit) -- (3 * \layer, 2.5cm) circle (\unit) -- (3 * \layer, 2.5cm + \unit); +\filldraw[fill=cyan!10, draw=black] (3 * \layer, 2.5cm - \myunit) -- (3 * \layer, 2.5cm) circle (\myunit) -- (3 * \layer, 2.5cm + \myunit); \draw (3 * \layer + 0.05cm, 2.5cm) -- (3 * \layer + 0.10cm, 2.5cm) -- (3 * \layer + 0.15cm, 2.5cm + 0.05cm); -\node[anchor=base, scale=0.35] at (3 * \layer, 2.5cm - 2\unit) {$\vdots$}; +\node[anchor=base, scale=0.35] at (3 * \layer, 2.5cm - 2\myunit) {$\vdots$}; % draw the fourth layer -\filldraw[fill=cyan!10, draw=black] (4 * \layer, -0.75cm - \unit) -- (4 * \layer, -0.75cm) circle (\unit) -- (4 * \layer, -0.75cm + \unit); +\filldraw[fill=cyan!10, draw=black] (4 * \layer, -0.75cm - \myunit) -- (4 * \layer, -0.75cm) circle (\myunit) -- (4 * \layer, -0.75cm + \myunit); \draw (4 * \layer + 0.05cm, -0.75cm) node[anchor=north, below=10pt, text width=2cm, scale=0.35, align=center] {FC layer [929 units]} -- (4 * \layer + 0.10cm, -0.75cm) -- (4 * \layer + 0.15cm, -0.75cm + 0.05cm); -\node[anchor=base, scale=0.35] at (4 * \layer, -0.75cm + 1.25 * \unit) {$\vdots$}; +\node[anchor=base, scale=0.35] at (4 * \layer, -0.75cm + 1.25 * \myunit) {$\vdots$}; \foreach \x in {0,...,5} { - \filldraw[fill=cyan!10, draw=black] (4 * \layer, 0.5cm * \x - \unit) -- (4 * \layer, 0.5cm * \x) circle (\unit) -- (4 * \layer, 0.5cm * \x + \unit); + \filldraw[fill=cyan!10, draw=black] (4 * \layer, 0.5cm * \x - \myunit) -- (4 * \layer, 0.5cm * \x) circle (\myunit) -- (4 * \layer, 0.5cm * \x + \myunit); \draw (4 * \layer + 0.05cm, 0.5cm * \x) -- (4 * \layer + 0.10cm, 0.5cm * \x) -- (4 * \layer + 0.15cm, 0.5cm * \x + 0.05cm); }; -\filldraw[fill=cyan!10, draw=black] (4 * \layer, 3.25cm - \unit) -- (4 * \layer, 3.25cm) circle (\unit) -- (4 * \layer, 3.25cm + \unit); +\filldraw[fill=cyan!10, draw=black] (4 * \layer, 3.25cm - \myunit) -- (4 * \layer, 3.25cm) circle (\myunit) -- (4 * \layer, 3.25cm + \myunit); \draw (4 * \layer + 0.05cm, 3.25cm) -- (4 * \layer + 0.10cm, 3.25cm) -- (4 * \layer + 0.15cm, 3.25cm + 0.05cm); -\node[anchor=base, scale=0.35] at (4 * \layer, 3.25cm - 2\unit) {$\vdots$}; +\node[anchor=base, scale=0.35] at (4 * \layer, 3.25cm - 2\myunit) {$\vdots$}; % draw the fifth layer -\filldraw[fill=cyan!10, draw=black] (5 * \layer, -\unit) -- (5 * \layer, 0cm) circle (\unit) -- (5 * \layer, \unit); +\filldraw[fill=cyan!10, draw=black] (5 * \layer, -\myunit) -- (5 * \layer, 0cm) circle (\myunit) -- (5 * \layer, \myunit); \draw (5 * \layer + 0.05cm, 0cm) node[anchor=north, below=10pt, text width=2cm, scale=0.35, align=center] {FC layer [404 units]} -- (5 * \layer + 0.10cm, 0cm) -- (5 * \layer + 0.15cm, 0.05cm); -\node[anchor=base, scale=0.35] at (5 * \layer, 1.25 * \unit) {$\vdots$}; +\node[anchor=base, scale=0.35] at (5 * \layer, 1.25 * \myunit) {$\vdots$}; \foreach \x in {1.5,...,3.5} { - \filldraw[fill=cyan!10, draw=black] (5 * \layer, 0.5cm * \x - \unit) -- (5 * \layer, 0.5cm * \x) circle (\unit) -- (5 * \layer, 0.5cm * \x + \unit); + \filldraw[fill=cyan!10, draw=black] (5 * \layer, 0.5cm * \x - \myunit) -- (5 * \layer, 0.5cm * \x) circle (\myunit) -- (5 * \layer, 0.5cm * \x + \myunit); \draw (5 * \layer + 0.05cm, 0.5cm * \x) -- (5 * \layer + 0.10cm, 0.5cm * \x) -- (5 * \layer + 0.15cm, 0.5cm * \x + 0.05cm); }; -\filldraw[fill=cyan!10, draw=black] (5 * \layer, 2.5cm - \unit) -- (5 * \layer, 2.5cm) circle (\unit) -- (5 * \layer, 2.5cm + \unit); +\filldraw[fill=cyan!10, draw=black] (5 * \layer, 2.5cm - \myunit) -- (5 * \layer, 2.5cm) circle (\myunit) -- (5 * \layer, 2.5cm + \myunit); \draw (5 * \layer + 0.05cm, 2.5cm) -- (5 * \layer + 0.10cm, 2.5cm) -- (5 * \layer + 0.15cm, 2.5cm + 0.05cm); -\node[anchor=base, scale=0.35] at (5 * \layer, 2.5cm - 2\unit) {$\vdots$}; +\node[anchor=base, scale=0.35] at (5 * \layer, 2.5cm - 2\myunit) {$\vdots$}; % draw the output layer -\filldraw[fill=cyan!10, draw=black] (6 * \layer, 1.25cm - \unit) -- (6 * \layer, 1.25cm) circle (\unit) -- (6 * \layer, 1.25cm + \unit); +\filldraw[fill=cyan!10, draw=black] (6 * \layer, 1.25cm - \myunit) -- (6 * \layer, 1.25cm) circle (\myunit) -- (6 * \layer, 1.25cm + \myunit); \draw (6 * \layer + 0.05cm, 1.25cm) node[anchor=north, below=10pt, text width=2cm, scale=0.35, align=center] {output layer [1 unit]} -- (6 * \layer + 0.10cm, 1.25cm) -- (6 * \layer + 0.15cm, 1.25cm + 0.05cm); % draw weights 1 --> 2 and 4 --> 5 \foreach \x in {\layer, 4 * \layer} { \foreach \y in {-0.75cm, 3.25cm} { \foreach \z in {0cm, 2.5cm} { - \draw (\x + \unit, \y) -- (\x + \layer - \unit, \z); + \draw (\x + \myunit, \y) -- (\x + \layer - \myunit, \z); }; }; \foreach \y in {0,...,5} { \foreach \z in {1.5,...,3.5} { - \draw (\x + \unit, 0.5cm * \y) -- (\x + \layer - \unit, 0.5cm * \z); + \draw (\x + \myunit, 0.5cm * \y) -- (\x + \layer - \myunit, 0.5cm * \z); }; \foreach \z in {0cm, 2.5cm} { - \draw (\x + \unit, 0.5 * \y) -- (\x + \layer - \unit, \z); + \draw (\x + \myunit, 0.5 * \y) -- (\x + \layer - \myunit, \z); }; }; \foreach \y in {1.5,...,3.5} { - \draw (\x + \unit, 3.25cm) -- (\x + \layer - \unit, 0.5cm * \y); - \draw (\x + \unit, -0.75cm) -- (\x + \layer - \unit, 0.5cm * \y); + \draw (\x + \myunit, 3.25cm) -- (\x + \layer - \myunit, 0.5cm * \y); + \draw (\x + \myunit, -0.75cm) -- (\x + \layer - \myunit, 0.5cm * \y); }; }; % draw weights 2 --> 3 \foreach \y in {0cm, 2.5cm} { \foreach \z in {0cm, 2.5cm} { - \draw (2 * \layer + \unit, \y) -- (2 * \layer + \layer - \unit, \z); + \draw (2 * \layer + \myunit, \y) -- (2 * \layer + \layer - \myunit, \z); }; }; \foreach \y in {1.5,...,3.5} { \foreach \z in {1.5,...,3.5} { - \draw (2 * \layer + \unit, 0.5cm * \y) -- (2 * \layer + \layer - \unit, 0.5cm * \z); + \draw (2 * \layer + \myunit, 0.5cm * \y) -- (2 * \layer + \layer - \myunit, 0.5cm * \z); }; \foreach \z in {0cm, 2.5cm} { - \draw (2 * \layer + \unit, 0.5cm * \y) -- (2 * \layer + \layer - \unit, \z); + \draw (2 * \layer + \myunit, 0.5cm * \y) -- (2 * \layer + \layer - \myunit, \z); }; }; \foreach \y in {1.5,...,3.5} { - \draw (2 * \layer + \unit, 2.5cm) -- (2 * \layer + \layer - \unit, 0.5cm * \y); - \draw (2 * \layer + \unit, 0cm) -- (2 * \layer + \layer - \unit, 0.5cm * \y); + \draw (2 * \layer + \myunit, 2.5cm) -- (2 * \layer + \layer - \myunit, 0.5cm * \y); + \draw (2 * \layer + \myunit, 0cm) -- (2 * \layer + \layer - \myunit, 0.5cm * \y); }; % draw weights 3 --> 4 \foreach \y in {0cm, 2.5cm} { \foreach \z in {-0.75cm, 3.25cm} { - \draw (3 * \layer + \unit, \y) -- (3 * \layer + \layer - \unit, \z); + \draw (3 * \layer + \myunit, \y) -- (3 * \layer + \layer - \myunit, \z); }; }; \foreach \y in {1.5,...,3.5} { \foreach \z in {0,...,5} { - \draw (3 * \layer + \unit, 0.5cm * \y) -- (3 * \layer + \layer - \unit, 0.5cm * \z); + \draw (3 * \layer + \myunit, 0.5cm * \y) -- (3 * \layer + \layer - \myunit, 0.5cm * \z); }; \foreach \z in {0cm, 2.5cm} { - \draw (3 * \layer + \unit, 0.5cm * \y) -- (3 * \layer + \layer - \unit, \z); + \draw (3 * \layer + \myunit, 0.5cm * \y) -- (3 * \layer + \layer - \myunit, \z); }; }; \foreach \y in {0,...,5} { - \draw (3 * \layer + \unit, 2.5cm) -- (3 * \layer + \layer - \unit, 0.5cm * \y); - \draw (3 * \layer + \unit, 0cm) -- (3 * \layer + \layer - \unit, 0.5cm * \y); + \draw (3 * \layer + \myunit, 2.5cm) -- (3 * \layer + \layer - \myunit, 0.5cm * \y); + \draw (3 * \layer + \myunit, 0cm) -- (3 * \layer + \layer - \myunit, 0.5cm * \y); }; % draw weights 5 --> output \foreach \y in {0cm, 2.5cm} { - \draw (5 * \layer + \unit, \y) -- (5 * \layer + \layer - \unit, 1.25cm); + \draw (5 * \layer + \myunit, \y) -- (5 * \layer + \layer - \myunit, 1.25cm); }; \foreach \y in {1.5,...,3.5} { - \draw (5 * \layer + \unit, 0.5cm * \y) -- (5 * \layer + \layer - \unit, 1.25cm); + \draw (5 * \layer + \myunit, 0.5cm * \y) -- (5 * \layer + \layer - \myunit, 1.25cm); }; % draw hidden layers legend \node[anchor=base, align=center, text width=3.5cm, scale=0.5] (h) at (4cm, 4.5cm) {hidden layers (ReLU activation)}; -\draw[->] (h) -- (\layer + \unit, 3.6cm); -\draw[->] (h) -- (2 * \layer + \unit, 2.85cm); -\draw[->] (h) -- (3 * \layer + 0.5 * \unit, 2.85cm); +\draw[->] (h) -- (\layer + \myunit, 3.6cm); +\draw[->] (h) -- (2 * \layer + \myunit, 2.85cm); +\draw[->] (h) -- (3 * \layer + 0.5 * \myunit, 2.85cm); \draw[->] (h) -- (4 * \layer, 3.6cm); -\draw[->] (h) -- (5 * \layer - 0.5 * \unit, 2.85cm); +\draw[->] (h) -- (5 * \layer - 0.5 * \myunit, 2.85cm); \end{tikzpicture} -% vim: ft=tex \ No newline at end of file +% vim: ft=tex diff --git a/tikz/icnn.pgf b/tikz/icnn.pgf index 2ae093e..df0273a 100644 --- a/tikz/icnn.pgf +++ b/tikz/icnn.pgf @@ -2,7 +2,7 @@ %\newlength{\layerheight} %\newlength{\perspective} %\newlength{\filters} -%\newlength{\unit} +%\newlength{\myunit} \newlength{\upperlevel} \newlength{\bottomlevel} \newlength{\concatheight} @@ -11,7 +11,7 @@ \setlength{\layerheight}{3cm} \setlength{\perspective}{1cm} \setlength{\filters}{0.01cm} -\setlength{\unit}{0.225cm} +\setlength{\myunit}{0.225cm} \setlength{\upperlevel}{2.25cm} \setlength{\bottomlevel}{-2.25cm} \setlength{\concatheight}{0cm} @@ -52,8 +52,8 @@ \node[anchor=south west, scale=0.65, rotate=45] at (2 * \layer, \concatheight + \layerheight) {$64 @ 12 \times 15$}; \draw (\layer + 32 * \filters + 1.2 * \perspective, \upperlevel + 0.5 * \layerheight) -- (\layer + 32 * \filters + 1.7 * \perspective, \upperlevel + 0.5 * \layerheight) -- (\layer + 32 * \filters + 1.7 * \perspective, \bottomlevel + 0.5 * \layerheight) -- (\layer + 32 * \filters + 1.2 * \perspective, \bottomlevel + 0.5 * \layerheight); -\filldraw[fill=red!20, draw=black] (\layer + 32 * \filters + 1.7 * \perspective, \concatheight + 0.5 * \layerheight) node[anchor=center, scale=0.8] {$C$} circle (\unit); -\draw[-latex] (\layer + 32 * \filters + 1.7 * \perspective + \unit, \concatheight + 0.5 * \layerheight) -- (\layer + 32 * \filters + 1.7 * \perspective + 3 * \unit, \concatheight + 0.5 * \layerheight); +\filldraw[fill=red!20, draw=black] (\layer + 32 * \filters + 1.7 * \perspective, \concatheight + 0.5 * \layerheight) node[anchor=center, scale=0.8] {$C$} circle (\myunit); +\draw[-latex] (\layer + 32 * \filters + 1.7 * \perspective + \myunit, \concatheight + 0.5 * \layerheight) -- (\layer + 32 * \filters + 1.7 * \perspective + 3 * \myunit, \concatheight + 0.5 * \layerheight); % second layer \filldraw[dashed, fill=orange!20, draw=black, fill opacity=0.5] (3 * \layer, \upperlevel) -- (3 * \layer + 64 * \filters, \upperlevel) -- (3 * \layer + 64 * \filters + \perspective, \upperlevel + \perspective) -- (3 * \layer + \perspective, \upperlevel + \perspective) -- cycle; @@ -82,8 +82,8 @@ \node[anchor=south west, scale=0.65, rotate=45] at (4 * \layer, \concatheight + \layerheight) {$128 @ 12 \times 15$}; \draw (3 * \layer + 64 * \filters + 1.1 * \perspective, \upperlevel + 0.5 * \layerheight) -- (3 * \layer + 64 * \filters + 1.6 * \perspective, \upperlevel + 0.5 * \layerheight) -- (3 * \layer + 64 * \filters + 1.6 * \perspective, \bottomlevel + 0.5 * \layerheight) -- (3 * \layer + 64 * \filters + 1.1 * \perspective, \bottomlevel + 0.5 * \layerheight); -\filldraw[fill=red!20, draw=black] (3 * \layer + 64 * \filters + 1.6 * \perspective, \concatheight + 0.5 * \layerheight) node[anchor=center, scale=0.8] {$C$} circle (\unit); -\draw[-latex] (3 * \layer + 64 * \filters + 1.6 * \perspective + \unit, \concatheight + 0.5 * \layerheight) -- (3 * \layer + 64 * \filters + 1.6 * \perspective + 3 * \unit, \concatheight + 0.5 * \layerheight); +\filldraw[fill=red!20, draw=black] (3 * \layer + 64 * \filters + 1.6 * \perspective, \concatheight + 0.5 * \layerheight) node[anchor=center, scale=0.8] {$C$} circle (\myunit); +\draw[-latex] (3 * \layer + 64 * \filters + 1.6 * \perspective + \myunit, \concatheight + 0.5 * \layerheight) -- (3 * \layer + 64 * \filters + 1.6 * \perspective + 3 * \myunit, \concatheight + 0.5 * \layerheight); % third layer \filldraw[dashed, fill=orange!20, draw=black, fill opacity=0.5] (5 * \layer, \upperlevel) -- (5 * \layer + 32 * \filters, \upperlevel) -- (5 * \layer + 32 * \filters + \perspective, \upperlevel + \perspective) -- (5 * \layer + \perspective, \upperlevel + \perspective) -- cycle; @@ -112,23 +112,23 @@ \node[anchor=south west, scale=0.65, rotate=45] at (6 * \layer, \concatheight + \layerheight) {$64 @ 12 \times 15$}; \draw (5 * \layer + 32 * \filters + 1.2 * \perspective, \upperlevel + 0.5 * \layerheight) -- (5 * \layer + 32 * \filters + 1.7 * \perspective, \upperlevel + 0.5 * \layerheight) -- (5 * \layer + 32 * \filters + 1.7 * \perspective, \bottomlevel + 0.5 * \layerheight) -- (5 * \layer + 32 * \filters + 1.2 * \perspective, \bottomlevel + 0.5 * \layerheight); -\filldraw[fill=red!20, draw=black] (5 * \layer + 32 * \filters + 1.7 * \perspective, \concatheight + 0.5 * \layerheight) node[anchor=center, scale=0.8] {$C$} circle (\unit); -\draw[-latex] (5 * \layer + 32 * \filters + 1.7 * \perspective + \unit, \concatheight + 0.5 * \layerheight) -- (5 * \layer + 32 * \filters + 1.7 * \perspective + 3 * \unit, \concatheight + 0.5 * \layerheight); +\filldraw[fill=red!20, draw=black] (5 * \layer + 32 * \filters + 1.7 * \perspective, \concatheight + 0.5 * \layerheight) node[anchor=center, scale=0.8] {$C$} circle (\myunit); +\draw[-latex] (5 * \layer + 32 * \filters + 1.7 * \perspective + \myunit, \concatheight + 0.5 * \layerheight) -- (5 * \layer + 32 * \filters + 1.7 * \perspective + 3 * \myunit, \concatheight + 0.5 * \layerheight); % flatten layer \foreach \x in {0,...,4} { - \filldraw[fill=cyan!10, draw=black] (6 * \layer + 3cm, \concatheight + \unit + 0.75 * \x cm) circle (\unit); - \draw (6 * \layer + 3cm + \unit, \concatheight + \unit + 0.75 * \x cm) -- (7 * \layer + 2cm - \unit, \concatheight + \unit + 0.5 * \layerheight); + \filldraw[fill=cyan!10, draw=black] (6 * \layer + 3cm, \concatheight + \myunit + 0.75 * \x cm) circle (\myunit); + \draw (6 * \layer + 3cm + \myunit, \concatheight + \myunit + 0.75 * \x cm) -- (7 * \layer + 2cm - \myunit, \concatheight + \myunit + 0.5 * \layerheight); }; -\node[anchor=north, scale=0.5, below=15pt, align=center] at (6 * \layer + 3cm, \concatheight + \unit) {flatten}; +\node[anchor=north, scale=0.5, below=15pt, align=center] at (6 * \layer + 3cm, \concatheight + \myunit) {flatten}; % draw the "flatenisation" -\draw[dashed] (6 * \layer + 64 * \filters, \layerheight) -- (6 * \layer + 3 cm, 3cm + 2 * \unit) -- (6 * \layer + 64 * \filters + \perspective, \layerheight + \perspective) -- cycle; +\draw[dashed] (6 * \layer + 64 * \filters, \layerheight) -- (6 * \layer + 3 cm, 3cm + 2 * \myunit) -- (6 * \layer + 64 * \filters + \perspective, \layerheight + \perspective) -- cycle; \draw[dashed] (6 * \layer + 64 * \filters, 0cm) -- (6 * \layer + 3 cm, 0cm) -- (6 * \layer + 64 * \filters + \perspective, \perspective) -- cycle; % output layer -\filldraw[fill=cyan!10, draw=black] (7 * \layer + 2cm, \concatheight + \unit + 0.5 * \layerheight - \unit) -- (7 * \layer + 2cm, \concatheight + \unit + 0.5 * \layerheight) circle (\unit) -- (7 * \layer + 2cm, \concatheight + \unit + 0.5 * \layerheight + \unit); -\draw (7 * \layer + 2cm + 0.05cm, \concatheight + \unit + 0.5 * \layerheight) node[anchor=north, below=10pt, text width=2cm, scale=0.35, align=center] {output layer [1 unit]} -- (7 * \layer + 2cm + 0.10cm, \concatheight + \unit + 0.5 * \layerheight) -- (7 * \layer + 2cm + 0.15cm, \concatheight + \unit + 0.5 * \layerheight + 0.05cm); +\filldraw[fill=cyan!10, draw=black] (7 * \layer + 2cm, \concatheight + \myunit + 0.5 * \layerheight - \myunit) -- (7 * \layer + 2cm, \concatheight + \myunit + 0.5 * \layerheight) circle (\myunit) -- (7 * \layer + 2cm, \concatheight + \myunit + 0.5 * \layerheight + \myunit); +\draw (7 * \layer + 2cm + 0.05cm, \concatheight + \myunit + 0.5 * \layerheight) node[anchor=north, below=10pt, text width=2cm, scale=0.35, align=center] {output layer [1 unit]} -- (7 * \layer + 2cm + 0.10cm, \concatheight + \myunit + 0.5 * \layerheight) -- (7 * \layer + 2cm + 0.15cm, \concatheight + \myunit + 0.5 * \layerheight + 0.05cm); % draw the first convolution \filldraw[fill=red!50, draw=black, fill opacity=0.2] (1cm, 0.9 * \layerheight) -- (1cm + \perspective, 0.9 * \layerheight + \perspective) -- (1cm + \perspective, \layerheight + \perspective) -- (1cm, \layerheight) -- cycle; @@ -190,4 +190,4 @@ \end{tikzpicture} -% vim: ft=texft=texft=texft=texft=tex \ No newline at end of file +% vim: ft=texft=texft=texft=texft=tex